Skip to content
Prev Previous commit
Next Next commit
Get full text
  • Loading branch information
dantleech committed Dec 7, 2025
commit 74366da8df8d60262a14670875a652431ff1591a
2 changes: 1 addition & 1 deletion lib/TolerantAstDiff/AstDiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

private SourceFileNode $fileSource2;

private array $visited = [];

Check failure on line 21 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Property Phpactor\TolerantAstDiff\AstDiff::$visited type has no value type specified in iterable type array.

public function merge(Node $node1, Node $node2): void
{
Expand Down Expand Up @@ -111,7 +111,7 @@
$this->applyEdit(TextEdit::create(
$node1Child->getFullStartPosition(),
$node1Child->getFullWidth(),
$node2Child->getFullText(),
$node2Child->getFullText($this->fileSource2->getFileContents()),
));
continue;
}
Expand Down Expand Up @@ -142,24 +142,24 @@
// if the original member is NULL but the new member is
// NOT null then just replace it
if ($member2 === null && $member1 !== null) {
$node1->$childName = $this->copyNode($member2);

Check failure on line 145 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Parameter #1 $node of method Phpactor\TolerantAstDiff\AstDiff::copyNode() expects Microsoft\PhpParser\Node|Microsoft\PhpParser\Token, null given.
$this->applyEdit(TextEdit::create(
$lastPosition,
0,
$member2?->getFullText($this->fileSource2->getFileContents()) ?? '',

Check failure on line 149 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Expression on left side of ?? is always null.

Check failure on line 149 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Cannot call method getFullText() on null.
));
continue;
}

// if the members are both nodes then just replace it and continue
if ($member2 instanceof Node && $member2::class !== $member1::class) {

Check failure on line 155 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Cannot access constant class on mixed.
// update the reference content in the source node by
// applying a text edit - we'll reindex the offsets later.
$node1->$childName = $this->copyNode($member2);
$this->applyEdit(TextEdit::create(
$lastPosition,
$member1?->getFullWidth(),

Check failure on line 161 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Parameter #2 $length of static method Phpactor\TextDocument\TextEdit::create() expects int, mixed given.

Check failure on line 161 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Cannot call method getFullWidth() on mixed.
$member2?->getFullText($this->fileSource2->getFileContents()) ?? '',

Check failure on line 162 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Using nullsafe method call on non-nullable type Microsoft\PhpParser\Node. Use -> instead.

Check failure on line 162 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Method Microsoft\PhpParser\Node::getFullText() invoked with 1 parameter, 0 required.

Check failure on line 162 in lib/TolerantAstDiff/AstDiff.php

View workflow job for this annotation

GitHub Actions / PHPStan (8.1)

Expression on left side of ?? is not nullable.
));
continue;
}
Expand Down
Loading