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

fix: work correctly for a switch/case with ternary operator #7756

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

kubawerlos
Copy link
Contributor

Fixes #7740

@coveralls
Copy link

coveralls commented Jan 16, 2024

Coverage Status

coverage: 94.753%. remained the same
when pulling ba2b410 on 6b7562617765726c6f73:fix_SwitchAnalyzer
into 1d34bb2 on PHP-CS-Fixer:master.

@kubawerlos kubawerlos marked this pull request as ready for review January 16, 2024 22:24
Copy link
Member

@Wirone Wirone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be there more integration tests and priority graph entries since priorities of 3 fixers were changed?

@kubawerlos
Copy link
Contributor Author

Shouldn't be there more integration tests and priority graph entries since priorities of 3 fixers were changed?

That's not the case. To be able to add tests/Fixtures/Integration/misc/ternary_operator_spaces,operator_linebreak.test (notice that it is misc category, not priority) the 2 fixers there need (there is a test for this) to have different priorities.

Then, operator_linebreak is not in the priorities graph, thus, it has priority 0 and I could not invent any priority case for it. Not being in the priorities graph means priority has to stay 0 (there is a test to check that if the priority is different than 0 then there must be some priority test for such fixer).

So, as changing the priority of operator_linebreak was a no-go, I've changed the priority of ternary_operator_spaces, and the others are the result of that change.

@Wirone Wirone enabled auto-merge (squash) January 17, 2024 10:33
@Wirone
Copy link
Member

Wirone commented Jan 17, 2024

@kubawerlos unfortunately I can't rebase and merge, so please update the PR when you have time 🙂.

@Wirone Wirone merged commit 3c27597 into PHP-CS-Fixer:master Jan 17, 2024
25 checks passed
@Wirone
Copy link
Member

Wirone commented Jan 17, 2024

Thank you @kubawerlos 🍻

@kubawerlos kubawerlos deleted the fix_SwitchAnalyzer branch January 17, 2024 11:21
danog pushed a commit to zoonru/PHP-CS-Fixer that referenced this pull request Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lint not correct for a switch/case with ternary operator
3 participants