Skip to content

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

Merged
jrfnl merged 1 commit into
developfrom
backcompat/bcfile-getdeclarationname-sync-with-upstream
Jul 16, 2023
Merged

BCFile::getDeclarationName(): sync with upstream#494
jrfnl merged 1 commit into
developfrom
backcompat/bcfile-getdeclarationname-sync-with-upstream

Conversation

@jrfnl

@jrfnl jrfnl commented Jul 16, 2023

Copy link
Copy Markdown
Member

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

Development

Successfully merging this pull request may close these issues.

1 participant