phpstan.dist.neon 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. includes:
  2. - dev-tools/vendor/phpstan/phpstan/conf/bleedingEdge.neon
  3. # Baseline, should only shrink! To regenerate it, just execute `composer phpstan:baseline`.
  4. - dev-tools/phpstan/baseline.php
  5. parameters:
  6. level: 7
  7. paths:
  8. - src
  9. - tests
  10. excludePaths:
  11. - tests/Fixtures
  12. polluteScopeWithLoopInitialAssignments: true # Do not enforce assignments outside of the loops
  13. reportUnmatchedIgnoredErrors: true # Do not allow outdated errors in the baseline
  14. treatPhpDocTypesAsCertain: false
  15. ignoreErrors:
  16. - '/^Class [a-zA-Z\\]+ extends @final class PhpCsFixer\\(ConfigurationException\\InvalidConfigurationException|ConfigurationException\\InvalidFixerConfigurationException|Tokenizer\\Tokens|Console\\Command\\FixCommand)\.$/'
  17. - '/^\$this\(PhpCsFixer\\Tokenizer\\Tokens\) does not accept PhpCsFixer\\Tokenizer\\Token\|null\.$/'
  18. # We often need to iterate multiple times within single method and we re-use variable name
  19. -
  20. message: '/^For loop initial assignment overwrites variable \$(i|index|endIndex)+\.$/'
  21. paths:
  22. - src/Fixer/Comment/CommentToPhpdocFixer.php
  23. - src/Fixer/ControlStructure/YodaStyleFixer.php
  24. - src/Fixer/Import/GlobalNamespaceImportFixer.php
  25. - src/Fixer/Import/OrderedImportsFixer.php
  26. - src/Fixer/LanguageConstruct/SingleSpaceAroundConstructFixer.php
  27. - src/Fixer/Operator/NoUselessConcatOperatorFixer.php
  28. - src/Fixer/PhpUnit/PhpUnitDedicateAssertInternalTypeFixer.php
  29. - src/Fixer/ReturnNotation/ReturnAssignmentFixer.php
  30. - src/Fixer/Whitespace/StatementIndentationFixer.php
  31. - tests/DocBlock/TypeExpressionTest.php
  32. -
  33. message: '/^Foreach overwrites \$index with its key variable.$/'
  34. paths:
  35. - src/Fixer/DoctrineAnnotation/DoctrineAnnotationIndentationFixer.php
  36. - src/Fixer/Import/GlobalNamespaceImportFixer.php
  37. - src/Fixer/LanguageConstruct/GetClassToClassKeywordFixer.php
  38. # Types related to tokens collections are purposefully narrowed, because we expect only tokens there
  39. - '/^Parameter #1 \$array \(array<int, PhpCsFixer\\(Tokenizer|Doctrine\\Annotation)+\\Token>\) of method PhpCsFixer\\(Tokenizer|Doctrine\\Annotation)+\\Tokens::fromArray\(\) should be contravariant with parameter \$array \(array<int, mixed>\) of method SplFixedArray<PhpCsFixer\\(Tokenizer|Doctrine\\Annotation)+\\Token>::fromArray\(\)$/'
  40. - '/^Parameter .* of method PhpCsFixer\\Tokenizer\\Tokens::offsetSet\(\) should be contravariant with parameter .* of method .*::offsetSet\(\)$/'
  41. - '/^Parameter .* of method PhpCsFixer\\Tests\\Test\\TokensWithObservedTransformers::offsetSet\(\) should be contravariant with parameter .* of method .*::offsetSet\(\)$/'
  42. # This one is tricky, because adding @param to PHPDoc causes failures on PHP7.4 with lowest deps (phpdoc_to_param_type), using @phpstan-param causes failures on all PHP versions (phpdoc_add_missing_param_annotation)
  43. - '/^Parameter #1 \$class \(string\) of method PhpCsFixer\\StdinFileInfo::get(File|Path)+Info+\(\) should be contravariant with parameter \$class \(string\|null\) of method SplFileInfo::get(File|Path)+Info\(\)$/'
  44. # Contract for configurable fixers defines `array<string, mixed>`, but we want narrowed array shape for each fixer
  45. # See: https://github.com/phpstan/phpstan/discussions/9686
  46. - '/^Parameter #1 \$configuration \(.*\) of method PhpCsFixer\\Fixer\\.*::configure\(\) should be contravariant with parameter \$configuration \(array<string, mixed>\) of method PhpCsFixer\\(AbstractFixer|Fixer\\ConfigurableFixerInterface)+::configure\(\)$/'
  47. # PHPUnit data providers return type were not maintained originally, this exception should shrink over time (eg with help of custom, re-usable type)
  48. -
  49. message: '#^Method PhpCsFixer\\Tests\\.+::provide.+Cases\(\) return type has no value type specified in iterable type iterable\.$#'
  50. path: tests
  51. count: 1014
  52. tipsOfTheDay: false
  53. tmpDir: dev-tools/phpstan/cache