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

php_unit_test_annotation set to prefix erroneously adds 'test' to single line doc blocks with the @depends tag #6457

Closed
Bbansjkl opened this issue Jul 5, 2022 · 2 comments · Fixed by #6824
Labels
status/input required For the issue to be confirmed or the PR to be process; additional input of the author is required

Comments

@Bbansjkl
Copy link

Bbansjkl commented Jul 5, 2022

Versions used

  • php-cs-fixer: 3.8.0 BerSzcz against war!
  • PHP runtime: 8.1.6

What did I do

Executed vendor/bin/php-cs-fixer fix -v --allow-risky=yes tests/Unit/ItemTest.php.

What happened

The string test was appended to single-line-docblocks with the @depends tag.

      ---------- begin diff ----------
--- /var/www/tests/Unit/ItemTest.php
+++ /var/www/tests/Unit/ItemTest.php
@@ -120,7 +120,7 @@
         <irrelevant code>
     }

-    /** @depends testSaveStoppedWhenPostponed */
+    /** @depends testSaveStoppedWhenPostponed test*/
     public function testSaveResumedAfterPostpone()
     {
         <irrelevant code>

      ----------- end diff -----------

What I expected to happen

Nothing. Considering that the rule php_unit_test_annotation is imported from @PhpCsFixer:risky and wasn't changed (so it's still on the default prefix), it shouldn't act here at all.

Notes

The following PhpDoc blocks were not affected by the rule. Not sure if there are other single-line comments this would affect, as I only tested @covers

    /**
     * @depends testCanSave
     */

    /** @covers Edit::save */

Probably not an urgent issue, since the workaround is to simply expand the PhpDoc block

Used Ruleset

[
    '@PhpCsFixer'                            => true,
    '@PhpCsFixer:risky'                      => true,
    'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
    'yoda_style'                             => [
        'equal'                => null,
        'identical'            => null,
        'less_and_greater'     => null,
        'always_move_variable' => false,
    ],
    'phpdoc_to_comment'                      => [
        'ignored_tags' => ['noinspection', 'var'],
    ],
    'self_accessor'                          => false,
    'binary_operator_spaces'                 => [
        'operators' => [
            '=>' => 'align',
        ],
    ],
    'strict_comparison'                      => false,
    'phpdoc_no_alias_tag'                    => ['replacements' => ['type' => 'var', 'link' => 'see']],
]
@Wirone
Copy link
Member

Wirone commented Mar 12, 2023

@Bbansjkl is this issue still valid? Can you check it with most recent version of Fixer?

@Wirone Wirone added the status/input required For the issue to be confirmed or the PR to be process; additional input of the author is required label Mar 12, 2023
@Bbansjkl
Copy link
Author

@Wirone Sorry, I can't check it since I no longer have a setup for PHP development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/input required For the issue to be confirmed or the PR to be process; additional input of the author is required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants