Increase php-parser use#278
Conversation
|
Generated: Sat, Jun 27, 2026, 0:48:06 UTC.
|
There was a problem hiding this comment.
Code Review
This pull request refactors the symbol discovery and replacement logic, moving from a regex-based implementation to an AST-based approach using the PHP-Parser library. It introduces a DiscoveredSymbols collection to manage various symbol types and updates the Prefixer to handle global symbols, namespace aliasing, and PHPDoc replacements. The review feedback highlights several critical areas for improvement: the regex for string-based classname replacement is too restrictive and incorrectly uses preg_quote, the AST walker may process comments multiple times leading to invalid offsets, and the circular dependency workaround in the File class is fragile. Additionally, the heuristic for closing braces in partial snippets is unreliable, and some log messages need updating to reflect the new architecture.
maybe it should be optional/configurable
Not sure how best to deal with them though.
Actual array: ['GLOBAL_CONST']. Failed asserting that an array contains 'MYPREFIX_GLOBAL_CONST'.
This should eliminate some bugs.
Also includes:
SymlinkProtectFilesystemAdapter#170 Add and extractSymlinkFileSystempackage #151TODO:
Prefixer.php