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

BCFile::getDeclarationName(): sync with upstream #494

Merged

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Jul 16, 2023

Follow up on #451

Upstream PR squizlabs/PHP_CodeSniffer#3797, which will be included in PHPCS 3.8.0, fixes a tokenizer issue which affected the File::getDeclarationName() and, by extension, the BackCompat::getDeclarationName() method.

The function name for functions named self, parent or static and declared to return by reference, could previously not be retrieved.

The PHPCSUtils native version of the method ObjectDeclarations::getName() already handled things correctly.

This commit adds back the BC-layer for the getDeclarationName() method and polyfills the fix from PHPCS 3.8.0 to backport it for PHPCS < 3.8.0.

As the methods will now handle these functions in the same way, this commit also moves the related tests from the GetNameDiffTest to the GetDeclarationNameTest.

Follow up on 451

Upstream PR squizlabs/PHP_CodeSniffer 3797, which will be included in PHPCS 3.8.0, fixes a tokenizer issue which affected the `File::getDeclarationName()` and, by extension, the `BackCompat::getDeclarationName()` method.

The function name for functions named `self`, `parent` or `static` and declared to return by reference, could previously not be retrieved.

The PHPCSUtils native version of the method `ObjectDeclarations::getName()` already handled things correctly.

This commit adds back the BC-layer for the `getDeclarationName()` method and polyfills the fix from PHPCS 3.8.0 to backport it for PHPCS < 3.8.0.

As the methods will now handle these functions in the same way, this commit also moves the related tests from the `GetNameDiffTest` to the `GetDeclarationNameTest`.
@jrfnl jrfnl added this to the 1.0.x Next milestone Jul 16, 2023
@jrfnl jrfnl merged commit 79abb87 into develop Jul 16, 2023
@jrfnl jrfnl deleted the backcompat/bcfile-getdeclarationname-sync-with-upstream branch July 16, 2023 21:25
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.

1 participant