Skip to content
This repository was archived by the owner on Nov 5, 2025. It is now read-only.

Commit 02dbf2c

Browse files
committed
Add typing
1 parent 616ec19 commit 02dbf2c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+167
-167
lines changed

src/PHPSemVerChecker/Analyzer/Analyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Analyzer
1414
* @param \PHPSemVerChecker\Registry\Registry $registryAfter
1515
* @return \PHPSemVerChecker\Report\Report
1616
*/
17-
public function analyze(Registry $registryBefore, Registry $registryAfter)
17+
public function analyze(Registry $registryBefore, Registry $registryAfter): Report
1818
{
1919
$finalReport = new Report();
2020

src/PHPSemVerChecker/Analyzer/ClassAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ClassAnalyzer
2020
* @param \PHPSemVerChecker\Registry\Registry $registryAfter
2121
* @return \PHPSemVerChecker\Report\Report
2222
*/
23-
public function analyze(Registry $registryBefore, Registry $registryAfter)
23+
public function analyze(Registry $registryBefore, Registry $registryAfter): Report
2424
{
2525
$report = new Report();
2626

src/PHPSemVerChecker/Analyzer/ClassMethodAnalyzer.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ class ClassMethodAnalyzer
3636
protected $fileAfter;
3737

3838
/**
39-
* @param string $context
40-
* @param string $fileBefore
41-
* @param string $fileAfter
39+
* @param string $context
40+
* @param string|null $fileBefore
41+
* @param string|null $fileAfter
4242
*/
43-
public function __construct($context, $fileBefore = null, $fileAfter = null)
43+
public function __construct(string $context, string $fileBefore = null, string $fileAfter = null)
4444
{
4545
$this->context = $context;
4646
$this->fileBefore = $fileBefore;
@@ -52,7 +52,7 @@ public function __construct($context, $fileBefore = null, $fileAfter = null)
5252
* @param \PhpParser\Node\Stmt $contextAfter
5353
* @return \PHPSemVerChecker\Report\Report
5454
*/
55-
public function analyze(Stmt $contextBefore, Stmt $contextAfter)
55+
public function analyze(Stmt $contextBefore, Stmt $contextAfter): Report
5656
{
5757
$report = new Report();
5858

src/PHPSemVerChecker/Analyzer/FunctionAnalyzer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use PHPSemVerChecker\Operation\FunctionImplementationChanged;
1010
use PHPSemVerChecker\Operation\FunctionOperationUnary;
1111
use PHPSemVerChecker\Operation\FunctionParameterAdded;
12-
use PHPSemVerChecker\Operation\FunctionParameterChanged;
1312
use PHPSemVerChecker\Operation\FunctionParameterDefaultAdded;
1413
use PHPSemVerChecker\Operation\FunctionParameterDefaultRemoved;
1514
use PHPSemVerChecker\Operation\FunctionParameterDefaultValueChanged;
@@ -33,7 +32,7 @@ class FunctionAnalyzer
3332
* @param \PHPSemVerChecker\Registry\Registry $registryAfter
3433
* @return \PHPSemVerChecker\Report\Report
3534
*/
36-
public function analyze(Registry $registryBefore, Registry $registryAfter)
35+
public function analyze(Registry $registryBefore, Registry $registryAfter): Report
3736
{
3837
$report = new Report();
3938

src/PHPSemVerChecker/Analyzer/InterfaceAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class InterfaceAnalyzer
2020
* @param \PHPSemVerChecker\Registry\Registry $registryAfter
2121
* @return \PHPSemVerChecker\Report\Report
2222
*/
23-
public function analyze(Registry $registryBefore, Registry $registryAfter)
23+
public function analyze(Registry $registryBefore, Registry $registryAfter): Report
2424
{
2525
$report = new Report();
2626

src/PHPSemVerChecker/Analyzer/PropertyAnalyzer.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class PropertyAnalyzer
2424
protected $fileAfter;
2525

2626
/**
27-
* @param string $context
28-
* @param string $fileBefore
29-
* @param string $fileAfter
27+
* @param string $context
28+
* @param string|null $fileBefore
29+
* @param string|null $fileAfter
3030
*/
31-
public function __construct($context, $fileBefore = null, $fileAfter = null)
31+
public function __construct(string $context, string $fileBefore = null, string $fileAfter = null)
3232
{
3333
$this->context = $context;
3434
$this->fileBefore = $fileBefore;
@@ -40,7 +40,7 @@ public function __construct($context, $fileBefore = null, $fileAfter = null)
4040
* @param \PhpParser\Node\Stmt $contextAfter
4141
* @return \PHPSemVerChecker\Report\Report
4242
*/
43-
public function analyze(Stmt $contextBefore, Stmt $contextAfter)
43+
public function analyze(Stmt $contextBefore, Stmt $contextAfter): Report
4444
{
4545
$report = new Report();
4646

@@ -82,7 +82,7 @@ public function analyze(Stmt $contextBefore, Stmt $contextAfter)
8282
* @param \PhpParser\Node\Stmt $context
8383
* @return array
8484
*/
85-
protected function getProperties(Stmt $context)
85+
protected function getProperties(Stmt $context): array
8686
{
8787
$properties = [];
8888
foreach ($context->stmts as $stmt) {
@@ -97,7 +97,7 @@ protected function getProperties(Stmt $context)
9797
* @param \PhpParser\Node\Stmt\Property $property
9898
* @return string
9999
*/
100-
protected function getName(Property $property)
100+
protected function getName(Property $property): string
101101
{
102102
return $property->props[0]->name->toString();
103103
}

src/PHPSemVerChecker/Analyzer/TraitAnalyzer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class TraitAnalyzer
2020
* @param \PHPSemVerChecker\Registry\Registry $registryAfter
2121
* @return \PHPSemVerChecker\Report\Report
2222
*/
23-
public function analyze(Registry $registryBefore, Registry $registryAfter)
23+
public function analyze(Registry $registryBefore, Registry $registryAfter): Report
2424
{
2525
$report = new Report();
2626

src/PHPSemVerChecker/Comparator/Implementation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Implementation
1111
* @param array $statementsB
1212
* @return bool
1313
*/
14-
public static function isSame(array $statementsA, array $statementsB)
14+
public static function isSame(array $statementsA, array $statementsB): bool
1515
{
1616
// Naive way to check if two implementation are the same
1717
$nodeDumper = new NodeDumper();

src/PHPSemVerChecker/Comparator/Node.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Node
99
* @param \PhpParser\Node $nodeB
1010
* @return bool
1111
*/
12-
public static function isEqual(\PhpParser\Node $nodeA, \PhpParser\Node $nodeB)
12+
public static function isEqual(\PhpParser\Node $nodeA, \PhpParser\Node $nodeB): bool
1313
{
1414
if ($nodeA->getType() !== $nodeB->getType()) {
1515
return false;

src/PHPSemVerChecker/Comparator/Signature.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Signature
99
* @param array $parametersB
1010
* @return array
1111
*/
12-
public static function analyze(array $parametersA, array $parametersB)
12+
public static function analyze(array $parametersA, array $parametersB): array
1313
{
1414
$changes = [
1515
'parameter_added' => false,

0 commit comments

Comments
 (0)