Skip to content

Classes/NewInterfaces: start using PHPCSUtils 1.1.0 getDeclared*()#1856

Merged
wimg merged 2 commits intodevelopfrom
PHPCSUtils-1.1.0/newinterfaces-use-new-getdeclaredproperties-methods
Aug 13, 2025
Merged

Classes/NewInterfaces: start using PHPCSUtils 1.1.0 getDeclared*()#1856
wimg merged 2 commits intodevelopfrom
PHPCSUtils-1.1.0/newinterfaces-use-new-getdeclaredproperties-methods

Conversation

@jrfnl
Copy link
Copy Markdown
Member

@jrfnl jrfnl commented Aug 13, 2025

Classes/NewInterfaces: start using PHPCSUtils 1.1.0 getDeclaredProperties()

PHPCSUtils 1.1.0 introduces a new ObjectDeclarations::getDeclaredProperties() method which can retrieve a list of all properties declared in an OO structure.

This method is highly optimized and will cache its results, which means that if multiple sniffs use the method, the results will be instantaneously returned on subsequent uses.

As T_CLASS tokens (and other OO tokens) occur much less often than T_VARIABLE, this change should lead to some small performance benefits.

Includes adding protection against throwing multiple errors for multi-property declarations and updating a test to test this.

Classes/NewInterfaces: start using PHPCSUtils 1.1.0 getDeclaredMethods()

PHPCSUtils 1.1.0 introduces a new ObjectDeclarations::getDeclaredMethods() method which can retrieve a list of all methods declared in an OO structure.

This method is highly optimized and will cache its results, which means that if multiple sniffs use the method, the results will be instantaneously returned on subsequent uses.

jrfnl added 2 commits August 13, 2025 21:13
…ties()

PHPCSUtils 1.1.0 introduces a new `ObjectDeclarations::getDeclaredProperties()` method which can retrieve a list of all properties declared in an OO structure.

This method is highly optimized and will cache its results, which means that if multiple sniffs use the method, the results will be instantaneously returned on subsequent uses.

As `T_CLASS` tokens (and other OO tokens) occur much less often than `T_VARIABLE`, this change should lead to some small performance benefits.

Includes adding protection against throwing multiple errors for multi-property declarations and updating a test to test this.
PHPCSUtils 1.1.0 introduces a new `ObjectDeclarations::getDeclaredMethods()` method which can retrieve a list of all methods declared in an OO structure.

This method is highly optimized and will cache its results, which means that if multiple sniffs use the method, the results will be instantaneously returned on subsequent uses.
@jrfnl jrfnl added this to the 10.0.0 milestone Aug 13, 2025
@jrfnl jrfnl requested a review from wimg August 13, 2025 19:17
@wimg wimg enabled auto-merge August 13, 2025 19:34
@wimg wimg merged commit a72efa5 into develop Aug 13, 2025
47 of 49 checks passed
@wimg wimg deleted the PHPCSUtils-1.1.0/newinterfaces-use-new-getdeclaredproperties-methods branch August 13, 2025 19:43
@github-actions github-actions bot removed PR: quick merge PR only contains relatively simple changes PR: ready for review labels Aug 13, 2025
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.

2 participants