Skip to content

Commit f905199

Browse files
committed
Code cleanup.
1 parent 0e1c322 commit f905199

File tree

3 files changed

+2
-79
lines changed

3 files changed

+2
-79
lines changed

src/PHPSemVerChecker/Comparator/Implementation.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ public static function isSame(array $statementsA, array $statementsB)
1919
$dumpA = $nodeDumper->dump($statementsA);
2020
$dumpB = $nodeDumper->dump($statementsB);
2121

22-
// var_dump($dumpA === $dumpB);
23-
// var_dump($statementsA == $statementsB);
24-
// echo '-----'.PHP_EOL;
25-
2622
return $dumpA === $dumpB;
2723
}
2824
}

src/PHPSemVerChecker/Comparator/Signature.php

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -64,77 +64,4 @@ public static function analyze(array $parametersA, array $parametersB)
6464

6565
return $changes;
6666
}
67-
68-
/**
69-
* @param array $paramsA
70-
* @param array $paramsB
71-
* @return string|bool
72-
*/
73-
public static function requiredParametersChanges(array $paramsA, array $paramsB)
74-
{
75-
$iterations = min(count($paramsA), count($paramsB));
76-
// Verify that all params default value match (either they're both null => parameter is required, or both
77-
// set to the same required value)
78-
for ($i = 0; $i < $iterations; ++$i) {
79-
if ($paramsA[$i]->default !== $paramsB[$i]->default) {
80-
return $paramsB[$i]->default ? 'removed' : 'added';
81-
}
82-
}
83-
84-
// Only one of these will return its remaining values, the other returning an empty array
85-
$toCheck = array_slice($paramsA, $iterations) + array_slice($paramsB, $iterations);
86-
$operation = count($paramsA) < count($paramsB) ? 'added' : 'removed';
87-
// If any additional argument does not have a default value, the signature has changed
88-
foreach ($toCheck as $param) {
89-
if ($param->default === null) {
90-
return $operation;
91-
}
92-
}
93-
return false;
94-
}
95-
96-
/**
97-
* @param array $paramsA
98-
* @param array $paramsB
99-
* @return bool
100-
*/
101-
public static function isSameTypehints(array $paramsA, array $paramsB)
102-
{
103-
$iterations = min(count($paramsA), count($paramsB));
104-
for ($i = 0; $i < $iterations; ++$i) {
105-
// TODO: Allow for contravariance <[email protected]>
106-
if ( ! Type::isSame($paramsA[$i]->type, $paramsB[$i]->type)) {
107-
return false;
108-
}
109-
}
110-
// Only one of these will return its remaining values, the other returning an empty array
111-
$toCheck = array_slice($paramsA, $iterations) + array_slice($paramsB, $iterations);
112-
// If any additional argument does not have a default value, the signature has changed
113-
foreach ($toCheck as $param) {
114-
if ($param->default === null) {
115-
return false;
116-
}
117-
}
118-
return true;
119-
}
120-
121-
/**
122-
* @param array $paramsA
123-
* @param array $paramsB
124-
* @return bool
125-
*/
126-
public static function isSameVariables(array $paramsA, array $paramsB)
127-
{
128-
if (count($paramsA) !== count($paramsB)) {
129-
return false;
130-
}
131-
132-
$iterations = min(count($paramsA), count($paramsB));
133-
for ($i = 0; $i < $iterations; ++$i) {
134-
if ($paramsA[$i]->name != $paramsB[$i]->name) {
135-
return false;
136-
}
137-
}
138-
return true;
139-
}
14067
}

src/PHPSemVerChecker/Operation/ClassMethodOperationDelta.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ abstract class ClassMethodOperationDelta extends Operation {
2020
*/
2121
protected $fileBefore;
2222
/**
23-
* @var Stmt
23+
* @var \PhpParser\Node\Stmt
2424
*/
2525
protected $contextBefore;
2626
/**
@@ -32,7 +32,7 @@ abstract class ClassMethodOperationDelta extends Operation {
3232
*/
3333
protected $fileAfter;
3434
/**
35-
* @var Stmt
35+
* @var \PhpParser\Node\Stmt
3636
*/
3737
protected $contextAfter;
3838
/**

0 commit comments

Comments
 (0)