Skip to content

2.0 | ObjectDeclarations::getName(): sync with PHPCS 4.0 #675

Open
@jrfnl

Description

@jrfnl

PHPCS 4.0 makes a couple of changes to the File::getDeclarationName() method, which have been applied to the BCFile::getDeclarationName() method via PR #674 for PHPCSUtils 1.1.0, but should be considered a breaking change for the PHPCSUtils native ObjectDeclarations::getName() method.

To be specific, the changes we're talking about are:

  • The [BC]File::getDeclarationName() method(s) no longer accepting T_CLOSURE or T_ANON_CLASS tokens.
    If these tokens are passed, an exception should be thrown instead.
  • The [BC]File::getDeclarationName() method(s) will now always return a string, which could potentially be an empty string if the name could not be determined.
    I.e. the method will no longer return null for anonymous structures and parse errors, but will throw an exception for the first (as per above) and return an empty string for the second.

These changes should still be made for the ObjectDeclarations::getName() method, but need to be deferred to PHPCSUtils 2.0.0.

Ref: PHPCSStandards/PHP_CodeSniffer#1007

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions