Skip to content

PSR12/AnonClassDeclaration: prevent fixer creating parse error#56

Merged
jrfnl merged 1 commit into
masterfrom
feature/3790-psr12-anonclassdeclaration-prevent-parse-error
Dec 5, 2023
Merged

PSR12/AnonClassDeclaration: prevent fixer creating parse error#56
jrfnl merged 1 commit into
masterfrom
feature/3790-psr12-anonclassdeclaration-prevent-parse-error

Conversation

@jrfnl

@jrfnl jrfnl commented Nov 9, 2023

Copy link
Copy Markdown
Member

Description

Recreation of upstream PR squizlabs/PHP_CodeSniffer#3791:

This fix prevents the fixer from removing the opening brace when there is no whitespace between the last character of the name of an interface and the open brace.

With this fix in place, all other symptoms reported are also gone as they were a side-effect of the parse error being created.

Includes unit test.

Fixes squizlabs/PHP_CodeSniffer#3790

Suggested changelog entry

PSR12/AnonClassDeclaration: prevent fixer creating parse error

This fix prevents the fixer from removing the opening brace when there is no whitespace between the last character of the name of an interface and the open brace.

With this fix in place, all other symptoms reported are also gone as they were a side-effect of the parse error being created.

Includes unit test.

Fixes 3790
@jrfnl
jrfnl force-pushed the feature/3790-psr12-anonclassdeclaration-prevent-parse-error branch from 172e8b3 to 884d702 Compare December 5, 2023 00:57
@jrfnl
jrfnl merged commit 0dfc8ab into master Dec 5, 2023
@jrfnl
jrfnl deleted the feature/3790-psr12-anonclassdeclaration-prevent-parse-error branch December 5, 2023 01:02
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.

Anonymous classes with interfaces missing space before opening bracket cause parse error with PSR-12 ruleset

1 participant