Problem/Motivation

Amongst of the errors in found in the current PHPStan baseline core/phpstan-baseline.neon is: #do callback class 'Bar\Baz')' at key 'X' does not implement Drupal\Core\Security\TrustedCallbackInterface. .

This issue exists to fix all of those.

Steps to reproduce

Proposed resolution

- Solve all of the above reported errors.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Spokje created an issue. See original summary.

spokje’s picture

StatusFileSize
new1.48 KB

Since all, or rather both, occurrences are deliberate callbacks with invalid Classes to test the Exception to catch invalid callbacks, I think the only way to "fix" this error is to @phpstan-ignore them.

spokje’s picture

Status: Active » Needs review
spokje’s picture

Title: Fix PHPStan L2 errors "#post_render callback class 'Foo\Bar')' at key 'X' does not implement Drupal\Core\Security\TrustedCallbackInterface." » Fix PHPStan L1 errors "#post_render callback class 'Foo\Bar')' at key 'X' does not implement Drupal\Core\Security\TrustedCallbackInterface."
Issue tags: -PHPStan-2 +PHPStan-1
StatusFileSize
new2.74 KB

Ah, it is already a base-lined error at PHPStan level 1.

spokje’s picture

Issue summary: View changes
spokje’s picture

Title: Fix PHPStan L1 errors "#post_render callback class 'Foo\Bar')' at key 'X' does not implement Drupal\Core\Security\TrustedCallbackInterface." » Fix PHPStan L1 errors "#foo callback class 'Bar\Baz')' at key 'X' does not implement Drupal\Core\Security\TrustedCallbackInterface."
Issue summary: View changes
mondrake’s picture

Status: Needs review » Needs work

I suggest adding a comment as to why we are phpstan-ignoring those lines. It's actually what @Spokje said in #2 I think.

spokje’s picture

Status: Needs work » Needs review
StatusFileSize
new2.95 KB
new1.68 KB
mondrake’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

kleiton_rodrigues’s picture

The #8 patch applies cleanly and works as expected.
LGTM.

  • catch committed 60c2916b on 10.1.x
    Issue #3335110 by Spokje, mondrake: Fix PHPStan L1 errors "#foo callback...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 60c2916 and pushed to 10.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.