Commit 60c2916b authored by catch's avatar catch
Browse files

Issue #3335110 by Spokje, mondrake: Fix PHPStan L1 errors "#foo callback class...

Issue #3335110 by Spokje, mondrake: Fix PHPStan L1 errors "#foo callback class 'Bar\Baz')' at key 'X' does not implement Drupal\Core\Security\TrustedCallbackInterface."
parent 341af8bf
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -3175,21 +3175,11 @@ parameters:
			count: 1
			path: tests/Drupal/Tests/Core/Plugin/TestPluginManager.php

		-
			message: "#^\\#access_callback callback class '\\$this\\(Drupal\\\\Tests\\\\Core\\\\Render\\\\RendererCallbackTest\\)' at key '0' does not implement Drupal\\\\Core\\\\Security\\\\TrustedCallbackInterface\\.$#"
			count: 1
			path: tests/Drupal/Tests/Core/Render/RendererCallbackTest.php

		-
			message: "#^\\#lazy_builder callback '\\\\\\\\Drupal\\\\\\\\Tests\\\\\\\\Core…' at key '0' is not trusted\\.$#"
			count: 1
			path: tests/Drupal/Tests/Core/Render/RendererCallbackTest.php

		-
			message: "#^\\#post_render callback class 'static\\(Drupal\\\\Tests\\\\Core\\\\Render\\\\RendererCallbackTest\\)' at key '0' does not implement Drupal\\\\Core\\\\Security\\\\TrustedCallbackInterface\\.$#"
			count: 1
			path: tests/Drupal/Tests/Core/Render/RendererCallbackTest.php

		-
			message: "#^\\#pre_render callback '\\\\\\\\Drupal\\\\\\\\Tests\\\\\\\\Core…' at key '0' is not trusted\\.$#"
			count: 1
+6 −0
Original line number Diff line number Diff line
@@ -46,10 +46,16 @@ public function providerTestCallback() {
        'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was \Drupal\Tests\Core\Render\callback. See https://www.drupal.org/node/2966725',
      ],
      'Static object method post render' => [
        // We specifically test an invalid callback here. We need to let PHPStan
        // ignore it.
        // @phpstan-ignore-next-line
        ['#post_render' => ['\Drupal\Tests\Core\Render\RendererCallbackTest::renderCallback'], '#type' => 'container'],
        'Render #post_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was \Drupal\Tests\Core\Render\RendererCallbackTest::renderCallback. See https://www.drupal.org/node/2966725',
      ],
      'Object method access callback' => [
        // We specifically test an invalid callback here. We need to let PHPStan
        // ignore it.
        // @phpstan-ignore-next-line
        ['#access_callback' => [$this, 'renderCallback'], '#type' => 'container'],
        'Render #access_callback callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was Drupal\Tests\Core\Render\RendererCallbackTest::renderCallback. See https://www.drupal.org/node/2966725',
      ],