Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented Feb 10, 2022

The "parse error due to reserved keyword as alias" tests for use .... as function and use ... as class already showed what the real expected output should be.

The test for use ... as const did not, as the code after it did not contain a semi-colon.

As part of the underlying issue for this code sample (the semi-colon being tokenized as T_STRING) has been fixed in PHPCS 3.7.0, this now meant that the test would give a different result in PHPCS 3.7.0+ vs PHPCS < 3.7.0.

As use statements are generally at the top of a file, it would be extraordinarily rare for code like that to ever occur in real life. On top of that, this is a parse error.
With both of those things in mind, just fixing the test code to allow the test to return consistent results PHPCS cross-version feels like the appropriate fix.

The "parse error due to reserved keyword as alias" tests for `use .... as function` and `use ... as class` already showed what the _real_ expected output should be.

The test for `use ... as const` did not, as the code after it did not contain a semi-colon.

As part of the underlying issue for this code sample (the semi-colon being tokenized as `T_STRING`) has been fixed in PHPCS 3.7.0, this now meant that the test would give a different result in PHPCS 3.7.0+ vs PHPCS < 3.7.0.

As use statements are generally at the top of a file, it would be extraordinarily rare for code like that to ever occur in real life. On top of that, this is a parse error.
With both of those things in mind, just fixing the test code to allow the test to return consistent results PHPCS cross-version feels like the appropriate fix.
@jrfnl jrfnl added this to the 1.0.0-alpha4 milestone Feb 10, 2022
@jrfnl jrfnl merged commit 0c3da06 into develop Feb 10, 2022
@jrfnl jrfnl deleted the feature/usestatements-make-test-for-splitting-more-consistent branch February 10, 2022 13:16
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.

2 participants