Skip to content

chore: make options that have default and allowed sets the same size the same array#8529

Merged
kubawerlos merged 8 commits intoPHP-CS-Fixer:masterfrom
6b7562617765726c6f73:enhancement_options_default_set_order
Mar 24, 2025
Merged

chore: make options that have default and allowed sets the same size the same array#8529
kubawerlos merged 8 commits intoPHP-CS-Fixer:masterfrom
6b7562617765726c6f73:enhancement_options_default_set_order

Conversation

@kubawerlos
Copy link
Copy Markdown
Member

Currently, some sets are the same size, but the order is different, e.g.:
image
(from https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/v3.73.1/doc/rules/class_notation/visibility_required.rst)

Let's make them in the same order.

@kubawerlos kubawerlos force-pushed the enhancement_options_default_set_order branch from 493b53c to 1d84914 Compare March 22, 2025 15:49
@kubawerlos kubawerlos changed the title chore: make options that have default and allowed sets the same size the same array chore: make options that have default and allowed sets the same size the same array Mar 22, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 22, 2025

Coverage Status

coverage: 94.873%. remained the same
when pulling c68fa6b on 6b7562617765726c6f73:enhancement_options_default_set_order
into a01fa57 on PHP-CS-Fixer:master.

Comment thread tests/Test/AbstractFixerTestCase.php Outdated
Comment thread tests/Test/AbstractFixerTestCase.php Outdated
private static function assertOptionDefault(FixerOptionInterface $option, FixerInterface $fixer): void
{
if (!$option->hasDefault()) {
return;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if we claim it's assertion method, it should execute assertion in all paths

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

what would you prefer?

  1. making the function dynamic to call addToAssertionCount (which is a dynamic method)
  2. self::assertTru(true) 😁
  3. wrapping everything in a huge assert

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

assertion without assert count increased is weird. please increase the count (pick the best option you believe)

Copy link
Copy Markdown
Member

@keradus keradus left a comment

Choose a reason for hiding this comment

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

good idea

kubawerlos and others added 2 commits March 22, 2025 18:17
Co-authored-by: Dariusz Rumiński <dariusz.ruminski@gmail.com>
@kubawerlos kubawerlos enabled auto-merge (squash) March 22, 2025 17:42
@kubawerlos kubawerlos merged commit 1ec2ab4 into PHP-CS-Fixer:master Mar 24, 2025
30 checks passed
@kubawerlos kubawerlos deleted the enhancement_options_default_set_order branch March 24, 2025 21:22
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.

3 participants