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.
2
Answers
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.
As of the new PHP 8, those aren’t comments, they’re Attributes.
They’ve changed the Attribute syntax from
<<attr>>
to#[attr]
. (See this.)