Skip to content
Snippets Groups Projects

PHPStan rule to enforce \Drupal::service

Open Michael Strelan requested to merge issue/drupal-2066993:2066993-phpstan-rule into 11.x
1 unresolved thread

Closes #2066993

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
25 return PropertyFetch::class;
26 }
27
28 /**
29 * {@inheritdoc}
30 */
31 public function processNode(Node $node, Scope $scope): array {
32 $class = $scope->getClassReflection();
33
34 if ($class === null || !$class->isSubclassOf(BrowserTestBase::class)) {
35 return [];
36 }
37
38 if ($node instanceof PropertyFetch && $node->name instanceof Node\Identifier && $node->name->name === 'container') {
39 return [
40 RuleErrorBuilder::message('Functional tests should not access $this->container. Use \Drupal::service() instead.')
  • Michael Strelan added 4 commits

    added 4 commits

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Michael Strelan added 3 commits

    added 3 commits

    • 1dca3e91 - Fix NodeRevisionsAllTest
    • b0f860c8 - Fix NodeRevisionsTest
    • 405e2917 - ignore NodeAccessGrantsCacheContextTest

    Compare with previous version

  • Please register or sign in to reply
    Loading