Change @phpstan-ignore-next-line to more specific @phpstan-ignore

Created on 17 May 2024, 12 months ago
Updated 8 August 2024, 9 months ago

Problem/Motivation

Following the update to PHPStan 1.11 we can now use the more specific @phpstan-ignore instead of @phpstan-ignore-next-line, where we can now specify exactly what we are ignoring so other errors on the same line do not get ignored.

Documentation for this feature is at https://phpstan.org/user-guide/ignoring-errors#ignoring-in-code-using-ph...

Steps to reproduce

Proposed resolution

Remove all @phpstan-ignore-next-line.
Run PHPStan in verbose mode.
Re-add all comments back using @phpstan-ignore with the specific error identifier.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Fixed

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 3 hours ago

Created by

πŸ‡¬πŸ‡§United Kingdom longwave UK

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @longwave
  • πŸ‡¬πŸ‡§United Kingdom longwave UK
  • First commit to issue fork.
  • Merge request !81803447950: Use specific phpstan-ignore identifiers β†’ (Closed) created by diegoe
  • Pipeline finished with Failed
    12 months ago
    Total: 190s
    #181875
  • Pipeline finished with Success
    12 months ago
    Total: 612s
    #181891
  • πŸ‡΅πŸ‡ͺPeru diegoe Lima, PerΓΊ

    The attached MR updates core to use specific phpstan error identifiers.

    Unfortunately, phpstan-drupal hasn't updated to use the new Error Identifiers feature, so we can't ignore the specific errors coming from it. These remaining ignores are:

    core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php:    // @phpstan-ignore-next-line
    core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php-    \Drupal::service('deprecation_test.service');
    core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php:    // @phpstan-ignore-next-line
    core/tests/Drupal/FunctionalTests/Core/Container/ServiceDeprecationTest.php-    \Drupal::service('deprecation_test.alias');
    --
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php:        // @phpstan-ignore-next-line
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php-        ['#pre_render' => ['\Drupal\Tests\Core\Render\callback'], '#type' => 'container'],
    --
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php:        // @phpstan-ignore-next-line
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php-        ['#post_render' => ['\Drupal\Tests\Core\Render\RendererCallbackTest::renderCallback'], '#type' => 'container'],
    --
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php:        // @phpstan-ignore-next-line
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php-        ['#access_callback' => [new static('test'), 'renderCallback'], '#type' => 'container'],
    --
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php:        // @phpstan-ignore-next-line
    core/tests/Drupal/Tests/Core/Render/RendererCallbackTest.php-        ['#lazy_builder' => ['\Drupal\Tests\Core\Render\callback', []]],
    --
    core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php:    // @phpstan-ignore-next-line
    core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php-    $this->storage->getQuery()->execute();
    --
    core/modules/navigation/src/Plugin/Block/NavigationShortcutsBlock.php:        // @phpstan-ignore-next-line
    core/modules/navigation/src/Plugin/Block/NavigationShortcutsBlock.php-        '#lazy_builder' => ['navigation.shortcut_lazy_builder:lazyLinks', [$this->configuration['label']]],
    --
    core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php:          // @phpstan-ignore-next-line
    core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php-          'hello_or_hi',
    --
    core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php:        // @phpstan-ignore-next-line
    core/modules/big_pipe/tests/modules/big_pipe_test/src/BigPipePlaceholderTestCases.php-        '#pre_render' => ['current_time'],
    
  • Status changed to Needs review 12 months ago
  • πŸ‡΅πŸ‡ͺPeru diegoe Lima, PerΓΊ
  • πŸ‡΅πŸ‡ͺPeru diegoe Lima, PerΓΊ

    diegoe β†’ changed the visibility of the branch 3447950_diegoe_specific-phpstan-ignores to hidden.

  • Status changed to Needs work 12 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Unfortunately, phpstan-drupal hasn't updated to use the new

    Do we have a ticket tracking the update for this?

    Could we open a follow up for this to address the other instances and postpone on the ticket for updating phpstan-drupal.

    Love the idea too so +1 from me.

  • πŸ‡΅πŸ‡ͺPeru diegoe Lima, PerΓΊ

    > Could we open a follow up for this to address the other instances and postpone on the ticket for updating phpstan-drupal.

    Opened https://www.drupal.org/project/drupal/issues/3456364 πŸ“Œ Use specific Error Identifiers with @phpstan-ignore for phpstan-drupal errors Postponed , hopefully marked it correctly too.

    Upstream now has https://github.com/mglaman/phpstan-drupal/issues/772

    Removing Needs followup tag.

  • Pipeline finished with Success
    11 months ago
    Total: 1534s
    #205241
  • Status changed to Needs review 10 months ago
  • πŸ‡΅πŸ‡ͺPeru diegoe Lima, PerΓΊ
  • Status changed to RTBC 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Follow up seems good to me, has the details from here and upstream link. Suppose this is good to move forward

    • catch β†’ committed d0348a31 on 11.x
      Issue #3447950 by diegoe, longwave, smustgrave: Change @phpstan-ignore-...
  • πŸ‡¬πŸ‡§United Kingdom catch

    Committed/pushed to 11.x, thanks!

  • Status changed to Fixed 10 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024