|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +use PHPStan\DependencyInjection\ProjectConfig\CacheConfig; |
| 6 | +use PHPStan\DependencyInjection\ProjectConfig\ExceptionsCheckConfig; |
| 7 | +use PHPStan\DependencyInjection\ProjectConfig\ExceptionsConfig; |
| 8 | +use PHPStan\DependencyInjection\ProjectConfig\ExcludePathsConfig; |
| 9 | +use PHPStan\DependencyInjection\ProjectConfig\IgnoreErrorsConfig; |
| 10 | +use PHPStan\DependencyInjection\ProjectConfig\ParametersConfig; |
| 11 | +use PHPStan\DependencyInjection\ProjectConfig\ProjectConfig; |
| 12 | + |
| 13 | +return new ProjectConfig( |
| 14 | + includes: [ |
| 15 | + '../vendor/phpstan/phpstan-deprecation-rules/rules.neon', |
| 16 | + '../vendor/phpstan/phpstan-nette/rules.neon', |
| 17 | + '../vendor/phpstan/phpstan-phpunit/extension.neon', |
| 18 | + '../vendor/phpstan/phpstan-phpunit/rules.neon', |
| 19 | + '../vendor/phpstan/phpstan-strict-rules/rules.neon', |
| 20 | + '../conf/bleedingEdge.neon', |
| 21 | + '../phpstan-baseline.neon', |
| 22 | + '../phpstan-baseline.php', |
| 23 | + 'ignore-by-php-version.neon.php', |
| 24 | + 'ignore-by-architecture.neon.php', |
| 25 | + ], |
| 26 | + parameters: new ParametersConfig( |
| 27 | + level: 8, |
| 28 | + paths: [ |
| 29 | + __DIR__ . '/PHPStan', |
| 30 | + __DIR__ . '/../src', |
| 31 | + __DIR__ . '/../tests', |
| 32 | + ], |
| 33 | + bootstrapFiles: [__DIR__ . '/../tests/phpstan-bootstrap.php'], |
| 34 | + cache: new CacheConfig(nodesByStringCountMax: 128), |
| 35 | + checkUninitializedProperties: true, |
| 36 | + checkMissingCallableSignature: true, |
| 37 | + excludePaths: new ExcludePathsConfig( |
| 38 | + analyseAndScan: [ |
| 39 | + __DIR__ . '/../tests/*/data/*', |
| 40 | + __DIR__ . '/../tests/tmp/*', |
| 41 | + __DIR__ . '/../tests/PHPStan/Analyser/nsrt/*', |
| 42 | + __DIR__ . '/../tests/PHPStan/Analyser/traits/*', |
| 43 | + __DIR__ . '/../tests/notAutoloaded/*', |
| 44 | + __DIR__ . '/../tests/PHPStan/Reflection/UnionTypesTest.php', |
| 45 | + __DIR__ . '/../tests/PHPStan/Reflection/MixedTypeTest.php', |
| 46 | + __DIR__ . '/../tests/e2e/magic-setter/*', |
| 47 | + __DIR__ . '/../tests/PHPStan/Rules/Properties/UninitializedPropertyRuleTest.php', |
| 48 | + __DIR__ . '/../tests/PHPStan/Command/IgnoredRegexValidatorTest.php', |
| 49 | + __DIR__ . '/../src/Command/IgnoredRegexValidator.php', |
| 50 | + ], |
| 51 | + ), |
| 52 | + exceptions: new ExceptionsConfig( |
| 53 | + uncheckedExceptionClasses: [ |
| 54 | + 'PHPStan\ShouldNotHappenException', |
| 55 | + 'Symfony\Component\Console\Exception\InvalidArgumentException', |
| 56 | + 'PHPStan\BetterReflection\SourceLocator\Exception\InvalidFileLocation', |
| 57 | + 'PHPStan\BetterReflection\SourceLocator\Exception\InvalidArgumentException', |
| 58 | + 'Symfony\Component\Finder\Exception\DirectoryNotFoundException', |
| 59 | + 'InvalidArgumentException', |
| 60 | + 'PHPStan\DependencyInjection\ParameterNotFoundException', |
| 61 | + 'PHPStan\DependencyInjection\DuplicateIncludedFilesException', |
| 62 | + 'PHPStan\Analyser\UndefinedVariableException', |
| 63 | + 'RuntimeException', |
| 64 | + 'Nette\Neon\Exception', |
| 65 | + 'Nette\Utils\JsonException', |
| 66 | + 'PHPStan\File\CouldNotReadFileException', |
| 67 | + 'PHPStan\File\CouldNotWriteFileException', |
| 68 | + 'PHPStan\Parser\ParserErrorsException', |
| 69 | + 'ReflectionException', |
| 70 | + 'Nette\Utils\AssertionException', |
| 71 | + 'PHPStan\File\PathNotFoundException', |
| 72 | + 'PHPStan\Broker\ClassNotFoundException', |
| 73 | + 'PHPStan\Broker\FunctionNotFoundException', |
| 74 | + 'PHPStan\Broker\ConstantNotFoundException', |
| 75 | + 'PHPStan\Reflection\MissingMethodFromReflectionException', |
| 76 | + 'PHPStan\Reflection\MissingPropertyFromReflectionException', |
| 77 | + 'PHPStan\Reflection\MissingConstantFromReflectionException', |
| 78 | + 'PHPStan\Type\CircularTypeAliasDefinitionException', |
| 79 | + 'PHPStan\Broker\ClassAutoloadingException', |
| 80 | + 'LogicException', |
| 81 | + 'Error', |
| 82 | + ], |
| 83 | + check: new ExceptionsCheckConfig(missingCheckedExceptionInThrows: true, tooWideThrowType: true), |
| 84 | + ), |
| 85 | + ignoreErrors: [ |
| 86 | + '#^Dynamic call to static method PHPUnit\\\Framework\\\\\S+\(\)\.$#', |
| 87 | + '#should be contravariant with parameter \$node \(PhpParser\\\Node\) of method PHPStan\\\Rules\\\Rule<PhpParser\\\Node>::processNode\(\)$#', |
| 88 | + '#Variable property access on PhpParser\\\Node#', |
| 89 | + '#Test::data[a-zA-Z0-9_]+\(\) return type has no value type specified in iterable type#', |
| 90 | + new IgnoreErrorsConfig( |
| 91 | + message: '#Fetching class constant class of deprecated class DeprecatedAnnotations\\\DeprecatedFoo.#', |
| 92 | + path: __DIR__ . '/../tests/PHPStan/Reflection/Annotations/DeprecatedAnnotationsTest.php', |
| 93 | + ), |
| 94 | + new IgnoreErrorsConfig( |
| 95 | + message: '#Fetching class constant class of deprecated class DeprecatedAnnotations\\\DeprecatedWithMultipleTags.#', |
| 96 | + path: __DIR__ . '/../tests/PHPStan/Reflection/Annotations/DeprecatedAnnotationsTest.php', |
| 97 | + ), |
| 98 | + new IgnoreErrorsConfig( |
| 99 | + message: '#^Variable property access on T of PHPStan\\\Rules\\\RuleError\.$#', |
| 100 | + path: __DIR__ . '/../src/Rules/RuleErrorBuilder.php', |
| 101 | + ), |
| 102 | + new IgnoreErrorsConfig( |
| 103 | + message: '#^Parameter \#1 (?:\$argument|\$objectOrClass) of class ReflectionClass constructor expects class\-string\<PHPStan\\\ExtensionInstaller\\\GeneratedConfig\>\|PHPStan\\\ExtensionInstaller\\\GeneratedConfig, string given\.$#', |
| 104 | + count: 1, |
| 105 | + path: __DIR__ . '/../src/Command/CommandHelper.php', |
| 106 | + ), |
| 107 | + new IgnoreErrorsConfig( |
| 108 | + message: '#^Parameter \#1 (?:\$argument|\$objectOrClass) of class ReflectionClass constructor expects class\-string\<PHPStan\\\ExtensionInstaller\\\GeneratedConfig\>\|PHPStan\\\ExtensionInstaller\\\GeneratedConfig, string given\.$#', |
| 109 | + count: 1, |
| 110 | + path: __DIR__ . '/../src/Diagnose/PHPStanDiagnoseExtension.php', |
| 111 | + ), |
| 112 | + '#^Short ternary operator is not allowed#', |
| 113 | + ], |
| 114 | + reportStaticMethodSignatures: true, |
| 115 | + tmpDir: '%rootDir%/tmp', |
| 116 | + stubFiles: [ |
| 117 | + __DIR__ . '/stubs/ReactChildProcess.stub', |
| 118 | + __DIR__ . '/stubs/ReactStreams.stub', |
| 119 | + __DIR__ . '/stubs/NetteDIContainer.stub', |
| 120 | + __DIR__ . '/stubs/PhpParserName.stub', |
| 121 | + ], |
| 122 | + ), |
| 123 | + _extra: [ |
| 124 | + 'services' => [ |
| 125 | + [ |
| 126 | + 'class' => 'PHPStan\Build\ServiceLocatorDynamicReturnTypeExtension', |
| 127 | + 'tags' => ['phpstan.broker.dynamicMethodReturnTypeExtension'], |
| 128 | + ], |
| 129 | + [ |
| 130 | + 'class' => 'PHPStan\Build\ContainerDynamicReturnTypeExtension', |
| 131 | + 'tags' => ['phpstan.broker.dynamicMethodReturnTypeExtension'], |
| 132 | + ], |
| 133 | + ] |
| 134 | + ] |
| 135 | +); |
0 commit comments