Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parsing of PHP 8.4 property hooks #411

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

TysonAndre
Copy link
Contributor

As part of this, stricten the parsing of property names and use a narrower syntax but reuse AssignmentExpression for backwards compatibility of applications that originally used tolerant-php-parser's result of parseExpression.

References:
https://wiki.php.net/rfc/property-hooks and the linked php-src PR's zend_language_parser.y

https://wiki.php.net/rfc/property-hooks#abbreviated_syntax https://wiki.php.net/rfc/property-hooks#interaction_with_constructor_property_promotion

As part of this, stricten the parsing of property names and use a
narrower syntax but reuse AssignmentExpression for backwards
compatibility of applications that originally used tolerant-php-parser's
result of parseExpression.

References:
https://wiki.php.net/rfc/property-hooks and the linked php-src PR's
zend_language_parser.y

https://wiki.php.net/rfc/property-hooks#abbreviated_syntax
https://wiki.php.net/rfc/property-hooks#interaction_with_constructor_property_promotion
* @param PropertyHooks $parentNode
* @return PropertyHook
*/
private function parsePropertyHook($parentNode) {
Copy link
Contributor

@dantleech dantleech Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can safely add a real type hint here I think and a real return type?

/** @var CompoundStatementNode|Expression|Token|null */
public $body;
/** @var Token|null */
public $semicolon;
Copy link
Contributor

@dantleech dantleech Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this PR but I guess we could consider bumping the minimum version to 8.0 or even 7.4? (nikic parser requires at least 7.4)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants