# This file is copied from ./core/phpstan.neon.dist then set to only
# ignore errors applicable to this project rather than all errors ignored
# from Core as phpstan throws errors when ignore lines here are unused.

# Configuration file for PHPStan static code checking, see https://phpstan.org .
# PHPStan is triggered on Drupal CI in commit-code-check.sh.
includes:
  - phar://phpstan.phar/conf/bleedingEdge.neon

parameters:
  level: 1

  paths:
    - .

  fileExtensions:
    - php
    - module
    - inc
    - install

  ignoreErrors:
    # new static() is a best practice in Drupal, so we cannot fix that.
    - "#^Unsafe usage of new static#"
    -
      message: "#extends @internal class Drupal\\\\Core\\\\Render\\\\Element\\\\FormElementBase#"
      reportUnmatched: false
    # As per https://drupal.slack.com/archives/C1BMUQ9U6/p1749477598489399
    - "#Attribute class Drupal\\\\Core\\\\Hook\\\\Attribute\\\\Hook does not exist.#"
    - "#Attribute class Drupal\\\\Core\\\\Hook\\\\Attribute\\\\LegacyHook does not exist.#"
    - "#Attribute class PHPUnit\\\\Framework\\\\Attributes\\\\RunTestsInSeparateProcesses does not exist.#"
  reportUnmatchedIgnoredErrors: false
  excludePaths:
    - modules/ai_search/tests/modules/test_ai_vdb_provider_mysql/src/TestVectorTable.php
    - modules/ai_assistant_api/src/Service/AgentRunner.php
    - modules/ai_assistant_api/src/Event/AiAssistantPassContextToAgentEvent.php
