Skip to content

Commit e386f84

Browse files
committed
AC-15344:: Add change level to breaking change table report in SVC
1 parent 6e82f83 commit e386f84

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/Comparator/Signature.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace Magento\SemanticVersionChecker\Comparator;
1111

1212
use PHPSemVerChecker\Comparator\Node;
13+
use PhpParser\Node\NullableType;
1314

1415
class Signature extends \PHPSemVerChecker\Comparator\Signature
1516
{
@@ -47,6 +48,7 @@ public static function isOptionalParams(array $params)
4748

4849
/**
4950
* Checks type hinting to determine if each parameter is non-Scalar.
51+
*
5052
* It assumes proper PHP code style is followed, meaning only non-Scalar parameters have type hinting.
5153
*
5254
* @param array $params Array of PhpParser\Node\Param objects
@@ -147,14 +149,12 @@ public static function analyze(array $parametersA, array $parametersB): array
147149
if ($parametersA[$i]->type !== null && $parametersB[$i]->type !== null) {
148150
$changes['parameter_typing_changed'] = true;
149151
// Custom: detect nullable added
150-
if (
151-
$typeBefore instanceof \PhpParser\Node\NullableType
152-
&& !$typeAfter instanceof \PhpParser\Node\NullableType
152+
if ($typeBefore instanceof NullableType
153+
&& !$typeAfter instanceof NullableType
153154
) {
154155
$changes['parameter_nullable_type_added'] = true;
155-
} elseif (
156-
!$typeBefore instanceof \PhpParser\Node\NullableType
157-
&& $typeAfter instanceof \PhpParser\Node\NullableType
156+
} elseif (!$typeBefore instanceof NullableType
157+
&& $typeAfter instanceof NullableType
158158
) {
159159
$changes['parameter_nullable_type_removed'] = true;
160160
}

src/Reporter/BreakingChangeTableReporter.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use PHPSemVerChecker\Report\Report;
1111
use PHPSemVerChecker\SemanticVersioning\Level;
1212
use Symfony\Component\Console\Output\OutputInterface;
13+
use PHPSemVerChecker\Operation\Operation;
1314

1415
class BreakingChangeTableReporter extends TableReporter
1516
{
@@ -104,7 +105,7 @@ protected function outputTable(OutputInterface $output, Report $report, $context
104105
continue;
105106
}
106107
$reportForLevel = $report[$context][$level];
107-
/** @var \PHPSemVerChecker\Operation\Operation $operation */
108+
/** @var Operation $operation */
108109
foreach ($reportForLevel as $operation) {
109110
// Skip private method/property changes as they shouldn't be in breaking change reports
110111
if ($this->isPrivateMemberChange($operation)) {
@@ -146,10 +147,10 @@ private function getLevelLabel(int $level): string
146147
*
147148
* Private changes are filtered out as they don't affect the public API contract.
148149
*
149-
* @param \PHPSemVerChecker\Operation\Operation $operation
150+
* @param Operation $operation
150151
* @return bool
151152
*/
152-
private function isPrivateMemberChange(\PHPSemVerChecker\Operation\Operation $operation): bool
153+
private function isPrivateMemberChange(Operation $operation): bool
153154
{
154155
$target = $operation->getTarget();
155156
$reason = $operation->getReason();

0 commit comments

Comments
 (0)