Skip to content

Commit b3575ec

Browse files
committed
add strict typing
1 parent 8f7c90b commit b3575ec

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

src/Element.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
/**
35
* phpDocumentor
46
*

src/File.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
/**
35
* This file is part of phpDocumentor.
46
*

src/Fqsen.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
/**
35
* phpDocumentor
46
*
@@ -35,7 +37,7 @@ final class Fqsen
3537
*
3638
* @throws \InvalidArgumentException when $fqsen is not matching the format.
3739
*/
38-
public function __construct($fqsen)
40+
public function __construct(string $fqsen)
3941
{
4042
$matches = [];
4143
$result = preg_match(
@@ -65,7 +67,7 @@ public function __construct($fqsen)
6567
*
6668
* @return string
6769
*/
68-
public function __toString()
70+
public function __toString(): string
6971
{
7072
return $this->fqsen;
7173
}
@@ -75,7 +77,7 @@ public function __toString()
7577
*
7678
* @return string
7779
*/
78-
public function getName()
80+
public function getName(): string
7981
{
8082
return $this->name;
8183
}

src/Location.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
/**
35
* This file is part of phpDocumentor.
46
*
@@ -29,7 +31,7 @@ final class Location
2931
* @param int $lineNumber
3032
* @param int $columnNumber
3133
*/
32-
public function __construct($lineNumber, $columnNumber = 0)
34+
public function __construct(int $lineNumber, int $columnNumber = 0)
3335
{
3436
$this->lineNumber = $lineNumber;
3537
$this->columnNumber = $columnNumber;
@@ -40,7 +42,7 @@ public function __construct($lineNumber, $columnNumber = 0)
4042
*
4143
* @return integer
4244
*/
43-
public function getLineNumber()
45+
public function getLineNumber(): int
4446
{
4547
return $this->lineNumber;
4648
}
@@ -50,7 +52,7 @@ public function getLineNumber()
5052
*
5153
* @return integer
5254
*/
53-
public function getColumnNumber()
55+
public function getColumnNumber(): int
5456
{
5557
return $this->columnNumber;
5658
}

src/Project.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
/**
35
* phpDocumentor
46
*
@@ -21,5 +23,5 @@ interface Project
2123
*
2224
* @return string
2325
*/
24-
public function getName();
26+
public function getName(): string;
2527
}

src/ProjectFactory.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
declare(strict_types=1);
3+
24
/**
35
* phpDocumentor
46
*
@@ -24,5 +26,5 @@ interface ProjectFactory
2426
* @param File[] $files
2527
* @return Project
2628
*/
27-
public function create($name, array $files);
29+
public function create($name, array $files): Project;
2830
}

0 commit comments

Comments
 (0)