rainlab/builder-plugin

Version rollback not working in PHP 8

angelcoding opened this issue · 1 comments

If I try to rollback my plugin's version I get this message and it does not complete the rollback ...

Migration code should define a migration or seeder class. Leave the code field blank if you only want to update the version number.

The problem seems to be in \RainLab\Builder\Classes\MigrationFileParser::extractNamespace.
There have been some tokens added since PHP 8 - namely T_NAME_QUALIFIED - which is causing the namespace extraction to fail.

So, on line 67 I changed this ...

return $stream->getNextExpectedTerminated([T_STRING, T_NS_SEPARATOR], [T_WHITESPACE, ';']);

to ...

return $stream->getNextExpectedTerminated([T_STRING, T_NS_SEPARATOR, T_NAME_QUALIFIED], [T_WHITESPACE, ';']);

and it now works.

I hope that helps fix the problem.

Thanks!