Skip to content

Commit 824170b

Browse files
committed
AC-14557:: False positives in the backward-incompatible changes report (SVC)
1 parent b55be5f commit 824170b

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

src/Analyzer/ClassMethodAnalyzer.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,7 @@ protected function reportChanged($report, $contextBefore, $contextAfter, $method
259259
$report->add($this->context, $data);
260260
$signatureChanged = true;
261261
} elseif ($signatureChanges['parameter_typing_changed']) {
262-
if (
263-
$signatureChanges['parameter_nullable_type_added']
264-
|| $signatureChanges['parameter_nullable_type_removed']
265-
) {
262+
if ($signatureChanges['parameter_nullable_type_added']) {
266263
$data = new ClassMethodParameterTypingChangedNullable(
267264
$this->context,
268265
$this->fileAfter,
@@ -468,8 +465,7 @@ private function isReturnsEqualByNullability(ClassMethod $before, ClassMethod $a
468465
*/
469466
private function getDocReturnDeclaration(ClassMethod $method)
470467
{
471-
if (
472-
($parsedComment = $method->getAttribute('docCommentParsed'))
468+
if (($parsedComment = $method->getAttribute('docCommentParsed'))
473469
&& isset($parsedComment['return'])
474470
) {
475471
if ($parsedComment['return'][0] instanceof NullableType) {

src/Comparator/Signature.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,8 @@ public static function analyze(array $parametersA, array $parametersB): array
147147
if ($parametersA[$i]->type !== null && $parametersB[$i]->type !== null) {
148148
$changes['parameter_typing_changed'] = true;
149149
// Custom: detect nullable added
150-
if (
151-
$typeBefore instanceof \PhpParser\Node\NullableType
150+
if ($typeBefore instanceof \PhpParser\Node\NullableType
152151
&& !$typeAfter instanceof \PhpParser\Node\NullableType
153-
) {
154-
$changes['parameter_nullable_type_removed'] = true;
155-
} elseif (
156-
!$typeBefore instanceof \PhpParser\Node\NullableType
157-
&& $typeAfter instanceof \PhpParser\Node\NullableType
158152
) {
159153
$changes['parameter_nullable_type_added'] = true;
160154
}

0 commit comments

Comments
 (0)