rainlab / builder-plugin

Visual development tool for October CMS
Other
171 stars 61 forks source link

Version rollback not working in PHP 8 #360

Closed angelcoding closed 2 years ago

angelcoding commented 2 years ago

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.

daftspunk commented 2 years ago

Thanks!