Closed
Description
Preconditions
- PHP 7.0.8 (any compatible PHP 7 release should be sufficient though)
Steps to reproduce
- Blank install
- Create a new block and add a method with a return type in PHP7 format e.g
: string
- Use the block in some layout somewhere
- Hit the frontend to use the block
Expected result
- The page should load and the block code be executed correctly
Actual result
Instead you get a fatal error from PHP because the generated interceptor class doesn't have a return type at all.
PHP Fatal error: Declaration of XX\YY\Block\CustomBlock\Interceptor::someMethod() must be compatible with XX\YY\Block\CustomBlock\::someMethod(): bool in .../var/generation/XX/YY/Block/CustomBlock/Interceptor.php on line X
This of course can be a tricky one to resolve purely based on the fact you wouldn't want to break BC with PHP 5.X.
The only resolutions I can think of at this point is...
- Check the version at runtime
- Set the PHP version (like we set the deploy mode)