PHP 8.3 Support: Arbitrary static variable initializers#8085
Merged
junichi11 merged 3 commits intoapache:masterfrom Dec 23, 2024
Merged
Conversation
- apache#6701 - apache#8073 - https://wiki.php.net/rfc/arbitrary_static_variable_initializers - Fix the grammar file (parser) - Add unit tests for the parser Example: ```php class Example { private int $field = 1; public function method(): int { return 1; } public function run(int $param1) : void { static $example1 = rand(); static $example2 = $param1; static $example3 = $this->field; static $example4 = $this->method(); static $example5 = new class() {}; static $example6 = new stdClass(...[0]); static $example6 = new stdClass($param1); static $example7 = new (Test); static $example8 = new static; static $example9 = $param1 <= 100 ? run($param1 + 1) : "Test $param1"; static $example10 = rand(), $example11 = rand(); } } $variable = 1; static $example1 = rand(); static $example2 = $variable; ```
- apache#6701 - apache#8073 - https://wiki.php.net/rfc/arbitrary_static_variable_initializers - Fix the formatter - Add unit tests - Formatter - Code Completion - GotoDeclaration and MarkOccurrences
- apache#6701 - apache#8073 - https://wiki.php.net/rfc/arbitrary_static_variable_initializers - Fix the `PHP83UnhandledError` - Fix the bracket barance for the `ASTPHP5Scanner` - Add unit tests for the scanner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 1
Example:
Part 2
Part 3
PHP83UnhandledErrorASTPHP5ScannerPHP 8.2
PHP 8.3