Search code examples
phpdebuggingphp-8

PHP 8 Comments bug


In previous version of PHP we have code comments written like

#[Socket panel]

After Updating to PHP 8 we are getting Error

syntax error, unexpected identifier "panel", expecting "]"

Is this bug in new PHP 8 or i am missing something ? Is there any solution to support older comment.


Solution

  • In PHP 8 you have now Attributes which are used in the following style #[Testclass] this is why you get this error.

    https://stitcher.io/blog/attributes-in-php-8

    You have to change that comments to another style.