Skip to content

Commit

Permalink
Fix comparing constant PHPDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Nov 8, 2023
1 parent cfffeac commit 2597096
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion extractor/extract.php
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,15 @@ private function stmtDiff(Node $old, Node $new, string $updateTo): array
*/
private function compareConstants(Node\Stmt\ClassConst $old, Node\Stmt\ClassConst $new, string $updateTo): array
{
if ($old->getDocComment() !== $new->getDocComment()) {
if ($old->getDocComment() !== null) {
if ($new->getDocComment() === null) {
return $this->stmtDiff($old, $new, $updateTo);
}

if ($old->getDocComment()->getText() !== $new->getDocComment()->getText()) {
return $this->stmtDiff($old, $new, $updateTo);
}
} elseif ($new->getDocComment() !== null) {
return $this->stmtDiff($old, $new, $updateTo);
}
if ($old->flags !== $new->flags) {
Expand Down

0 comments on commit 2597096

Please sign in to comment.