Skip to content

PHP 8.1 | Tokenizer/PHP: fix nullable type tokenization for readonly properties #908

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

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Mar 29, 2025

Description

Discovered while investigating something else.

The ? in a type for a readonly property declared without visibility, would be tokenized as T_INLINE_THEN, not T_NULLABLE.

Fixed now.

Includes perfunctory test.
Realistically, a lot more tests are needed for the T_NULLABLE vs T_INLINE_THEN tokenization, but at least, this is a start and covers the current change.

Suggested changelog entry

Fixed tokenization of ? in nullable types for readonly properties.

…properties

The `?` in a type for a `readonly` property declared without visibility, would be tokenized as `T_INLINE_THEN`, not `T_NULLABLE`.

Fixed now.

Includes perfunctory test.
Realistically, a lot more tests are needed for the `T_NULLABLE` vs `T_INLINE_THEN` tokenization, but at least, this is a start and covers the current change.
@jrfnl jrfnl force-pushed the feature/tokenizer-php-nullable-types-on-php-8.1-readonly-properties branch from a0d63bf to 55bb12f Compare March 29, 2025 00:20
@jrfnl jrfnl merged commit 049b27d into master Apr 1, 2025
72 checks passed
@jrfnl jrfnl deleted the feature/tokenizer-php-nullable-types-on-php-8.1-readonly-properties branch April 1, 2025 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants