Skip to content

Commit 79d25f8

Browse files
committed
Update AstHasher for parser v5 compatibility
Changed the ParserFactory creation method to use the newest supported version in AstHasher. Updated the expected hash value in the unit test to align with the new parser's output.
1 parent f08f450 commit 79d25f8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Diff for: src/External/AstHasher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class AstHasher implements AstHasherInterface
1717

1818
public function __construct()
1919
{
20-
$this->parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
20+
$this->parser = (new ParserFactory())->createForNewestSupportedVersion();
2121
$this->dumper = new NodeDumper();
2222
}
2323

Diff for: tests/unit/External/AstHasherTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getLongString($seed): string
3535
}
3636
CODE;
3737
$actual = $this->subject->get($source);
38-
$expected = 'abcd814e2805dc8935a669bccd6671a7';
38+
$expected = 'e972738f82f2733237099fa4f141582f';
3939
$this->assertSame($expected, $actual);
4040
}
4141

0 commit comments

Comments
 (0)