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

feat: @PhpCsFixer ruleset - enable php_unit_data_provider_static #7685

Merged
merged 4 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/ruleSets/PhpCsFixerRisky.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Rules
- `no_unset_on_property <./../rules/language_construct/no_unset_on_property.rst>`_
- `php_unit_data_provider_name <./../rules/php_unit/php_unit_data_provider_name.rst>`_
- `php_unit_data_provider_return_type <./../rules/php_unit/php_unit_data_provider_return_type.rst>`_
- `php_unit_data_provider_static <./../rules/php_unit/php_unit_data_provider_static.rst>`_
Copy link
Member

@keradus keradus Jan 7, 2024

Choose a reason for hiding this comment

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

👎

This is not about style, this is about migration - in Fixer we applied this only because of migration purposes.
All migration rules shall be part of PHPUnit migration ruleset.

I would rather recommend projects to keep config like following:

[
    '@PHP{xy}Migration' => true,
    '@PHPUnit{xy}Migration' => true,
    '@PhpCsFixer' => true, // or @Symfony, @PSR, ...
]

if there is a non-migration rule, it could be part of vendor style (eg @Fixer..., @Symfony)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if static providers make sense in all PHPUnits?

Copy link
Member

Choose a reason for hiding this comment

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

Were static data providers always available? If yes, then I would consider it as style rule rather than migration rule. But if they were introduced in some specific version, then it surely is migration rule 😉. Personally: I don't know 😅.

Copy link
Contributor

Choose a reason for hiding this comment

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

- `php_unit_strict <./../rules/php_unit/php_unit_strict.rst>`_
- `php_unit_test_case_static_method_calls <./../rules/php_unit/php_unit_test_case_static_method_calls.rst>`_ with config:

Expand Down
3 changes: 2 additions & 1 deletion doc/rules/php_unit/php_unit_data_provider_static.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ With configuration: ``['force' => false]``.
Rule sets
---------

The rule is part of the following rule set:
The rule is part of the following rule sets:

- `@PHPUnit100Migration:risky <./../../ruleSets/PHPUnit100MigrationRisky.rst>`_ with config:

``['force' => true]``

- `@PhpCsFixer:risky <./../../ruleSets/PhpCsFixerRisky.rst>`_

References
----------
Expand Down
1 change: 1 addition & 0 deletions src/RuleSet/Sets/PhpCsFixerRiskySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function getRules(): array
'no_unset_on_property' => true,
'php_unit_data_provider_name' => true,
'php_unit_data_provider_return_type' => true,
'php_unit_data_provider_static' => true,
mvorisek marked this conversation as resolved.
Show resolved Hide resolved
'php_unit_strict' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'static_lambda' => true,
Expand Down