-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [PHP] Tweak type-hint performance This commit adjusts type hint implementation to avoid some redundant lookaheads once a type hint context is on stack. The new test case is meant to ensure not to break reference operator precedence in function parameter lists as this is the only change in behavior this commit includes. Benchmark: 10k lines of: function unionTypeFunction(int | string $param0, Foo | \Foo\Bar | ?int $param1, Foo|\Foo\Bar|?int $param2, (?A|B)&(C|?D)&?E $param2, string $param3, $param4): Foo|\Foo\Bar|?int|static {} Result: -5% parsing time * [PHP] Tweak property type hints This commit simplifies patterns needed to handle property type hints. Properties begin with at least one visibility or type modifier optionally followed by a type hint. The `type-hint` context is used by `property-type-hints` only. The complicated lookahead pattern is not needed in this use case. Benchmark: 10k lines of: readonly $var = 0; public int | string $param0; public Foo | \Foo\Bar | ?int $param1; public Foo|\Foo\Bar|?int $param2; public (?A|B)&(C|?D)&?E $param2; public string $param3; public $param4; Result: -4% parsing time * [PHP] Tweak function parameter type-hints This commit... 1. improves behavior with regards to incomplete type-hints to limit escalation of broken syntax highlighting. 2. improves performance of function parameter lists Benchmark: 10k lines of: function unionTypeFunction(int | string $param0, Foo | \Foo\Bar | ?int $param1, Foo|\Foo\Bar|?int $param2, (?A|B)&(C|?D)&?E $param2, string $param3, $param4): Foo|\Foo\Bar|?int|static {} Result: -10% parsing time * [PHP] Optimize type-hints in catch expression This commit applies new type-hint strategy to `catch(<type> $e)` statements to get rid of `type-hints` context.
- Loading branch information
Showing
2 changed files
with
298 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.