-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'Replacement data still remain' logic error cause #340
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This isn't really a bug report, just an error report, more to help others.
when installing via composer your library kenjis/ci-phpunit-test:2.x-dev
this installed the most recent version of nikic/php-parser V4.7.0
when php-parser v4.7 tokenises a file, this version has a post-processing step. This step changes the offsets of the nodes, so that functions that have to be substituted out (from the white-list + overloads) are out of sync with the nodes from token_get_all().
so when your code gets around to using static::$replacement in abstract class AbstractPatcher, the nodes have the wrong index.
This in turn causes the function to not be found in FunctionPatcher::generateNewSource, generating a throw new LogicException('Replacement data still remain');
While the cause took me many hours to locate, the fix is simple, explicitly use the recommended version of php-parser, so my composer.json becomes:
then just update composer and the problem was fixed!
The text was updated successfully, but these errors were encountered: