Skip to content

Commit b891ef3

Browse files
authored
Merge pull request #13 from ashnazg/strict
add strict typing
2 parents 8f7c90b + 213d017 commit b891ef3

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
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: 6 additions & 10 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
*
@@ -31,11 +33,9 @@ final class Fqsen
3133
/**
3234
* Initializes the object.
3335
*
34-
* @param string $fqsen
35-
*
36-
* @throws \InvalidArgumentException when $fqsen is not matching the format.
36+
* @throws InvalidArgumentException when $fqsen is not matching the format.
3737
*/
38-
public function __construct($fqsen)
38+
public function __construct(string $fqsen)
3939
{
4040
$matches = [];
4141
$result = preg_match(
@@ -62,20 +62,16 @@ public function __construct($fqsen)
6262

6363
/**
6464
* converts this class to string.
65-
*
66-
* @return string
6765
*/
68-
public function __toString()
66+
public function __toString(): string
6967
{
7068
return $this->fqsen;
7169
}
7270

7371
/**
7472
* Returns the name of the element without path.
75-
*
76-
* @return string
7773
*/
78-
public function getName()
74+
public function getName(): string
7975
{
8076
return $this->name;
8177
}

src/Location.php

Lines changed: 5 additions & 10 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
*
@@ -25,32 +27,25 @@ final class Location
2527

2628
/**
2729
* Initializes the location for an element using its line number in the file and optionally the column number.
28-
*
29-
* @param int $lineNumber
30-
* @param int $columnNumber
3130
*/
32-
public function __construct($lineNumber, $columnNumber = 0)
31+
public function __construct(int $lineNumber, int $columnNumber = 0)
3332
{
3433
$this->lineNumber = $lineNumber;
3534
$this->columnNumber = $columnNumber;
3635
}
3736

3837
/**
3938
* Returns the line number that is covered by this location.
40-
*
41-
* @return integer
4239
*/
43-
public function getLineNumber()
40+
public function getLineNumber(): int
4441
{
4542
return $this->lineNumber;
4643
}
4744

4845
/**
4946
* Returns the column number (character position on a line) for this location object.
50-
*
51-
* @return integer
5247
*/
53-
public function getColumnNumber()
48+
public function getColumnNumber(): int
5449
{
5550
return $this->columnNumber;
5651
}

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)