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

RenderCallbackRule: Check if method exists in trustedCallbacks #562

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

Boegie
Copy link
Contributor

@Boegie Boegie commented May 12, 2023

Resolves #561

@mglaman mglaman changed the title PR for #561: RenderCallbackRule ignores ::trustedCallbacks() RenderCallbackRule: Check if method exists in trustedCallbacks Jun 28, 2023
@mglaman
Copy link
Owner

mglaman commented Jun 28, 2023

😩

     Internal error: Internal error: Method of class                                                  
     Drupal\Tests\Core\Render\PlaceholdersTest cannot be used as the class                            
     does not exist in file                                                                           
     /home/runner/work/_temp/drupal/core/tests/Drupal/Tests/Core/Render/PlaceholderGeneratorTest.php  

That is because PlaceholdersTest is in core/tests/Drupal/Tests/Core/Render/RendererTestBase.php. The test class \Drupal\Tests\Core\Render\PlaceholderGeneratorTest extends \Drupal\Tests\Core\Render\RendererTestBase. But it's not brought into scope.

Copy link
Owner

@mglaman mglaman left a comment

Choose a reason for hiding this comment

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

We need to run PHPStan with phpstan-drupal and this PR against Drupal core using --debug, at least against RendererPlaceholdersTest to get the full stacktrace. I don't know why PHPStan can detect but PHP's internal reflection breaks.

Comment on lines +225 to 232
$classMap = [
'\\Drupal\\Tests\\Core\\Render\\BubblingTest' => $this->drupalRoot . '/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php',
'\\Drupal\\Tests\\Core\\Render\\PlaceholdersTest' => $this->drupalRoot . '/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php',
'\\Drupal\\Tests\\Core\\Render\\TestAccessClass' => $this->drupalRoot . '/core/tests/Drupal/Tests/Core/Render/RendererTest.php',
'\\Drupal\\Tests\\Core\\Render\\TestCallables' => $this->drupalRoot . '/core/tests/Drupal/Tests/Core/Render/RendererTest.php',
];
$this->autoloader->addClassMap($classMap);
}
Copy link
Owner

Choose a reason for hiding this comment

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

This didn't fix the internal error:

Error: Internal error: Internal error: Method of class Drupal\Tests\Core\Render\BubblingTest cannot be used as the class does not exist in file /home/runner/work/_temp/drupal/core/tests/Drupal/Tests/Core/Render/RendererBubblingTest.php

I don't know what to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RenderCallbackRule ignores ::trustedCallbacks()
2 participants