Files
laravel-starter-kit/phpstan.neon

99 lines
4.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
includes:
- ./vendor/larastan/larastan/extension.neon
- ./vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
paths:
- ./app
- ./database
- ./routes
# Level 9 is the highest level
level: 8
# By default, the default Laravel database migration path (database/migrations) is used to scan migration files to understand the table structure and model properties. If you have database migrations in other place than the default, you can use this config parameter to tell Larastan where the database migrations are stored.
# You can give absolute paths, or paths relative to the PHPStan config file.
databaseMigrationsPath:
- app/vendor/4netplayers/laravel-models/src/Migrations
exceptions:
check:
missingCheckedExceptionInThrows: false # Check for missing @throws
tooWideThrowType: true # Check if we have exceptions in @throws that are not actually thrown
ignoreErrors:
# It seems PHPStan > v2 cannot see Laravel's magic call methods in its static analysis, leading to
# false positives "dynamic call to static method" errors.
#- identifier: staticMethod.dynamicCall
# By default, PHPStan stores its cache files in sys_get_temp_dir() . '/phpstan' (usually /tmp/phpstan). You can override this by setting the tmpDir parameter. You can set this in extension settings as well.
#tmpDir: /mnt/ramdisk
# This rule checks every argument of a method or a function, and if the argument has the type model-property, it will try to check the given value against the model properties. And if the model does not have the given property, it'll produce an error.
# This rule is disabled by default.
checkModelProperties: false
# stricter analysis
# When set to false it prevents reading variables set in for loop initial statement and while loop condition after the loop. Default true.
polluteScopeWithLoopInitialAssignments: false
# When set to false it prevents reading key and value variables set in foreach when iterating over a non-empty array.
polluteScopeWithAlwaysIterableForeach: false
# When set to true, it reports code paths with missing return statement in functions and methods with @return mixed PHPDoc. Default false.
checkExplicitMixedMissingReturn: true
# When set to true, it reports function and method calls with incorrect name case. Default false.
checkFunctionNameCase: true
# When set to true, it reports references to built-in classes with incorrect name case. Default false.
checkInternalClassCaseSensitivity: true
# When set to true, it reports violations of parameter type contravariance and return type covariance. By default, PHPStan only reports completely incompatible types in signatures. Default false.
reportMaybesInMethodSignatures: true
# When set to true, it reports violations of property type invariance. By default, PHPStan only reports completely incompatible PHPDoc typescheckInternalClassCaseSensitivity. Default false
reportMaybesInPropertyPhpDocTypes: true
# When set to true, it reports violations of parameter type contravariance and return type covariance in static methods. Default false.
reportStaticMethodSignatures: true
# When set to true, it reports return typehints that could be narrowed down because some of the listed types are never returned from a public or protected method. For private methods PHPStan does this by default. Default false.
checkTooWideReturnTypesInProtectedAndPublicMethods: true
# When set to true, it reports properties with native types that werent initialized in the class constructor. Default false.
checkUninitializedProperties: true
# When set to true, it reports properties with native types that werent initialized in the class constructor. Default false.
checkDynamicProperties: true
# When set to true, PHPStan is strict about values with an unspecified (implicit mixed) type. It enables the same checks for values with no type specified that rule level 9 enables for explicitly specified mixed type values.
checkImplicitMixed: false
# Report ignoreErrors patterns that do not match any errors
reportUnmatchedIgnoredErrors: true
# Automatically infer the types of private properties from the constructor
inferPrivatePropertyTypeFromConstructor: true
# parallel processing
parallel:
jobSize: 40
maximumNumberOfProcesses: 64
minimumNumberOfJobsPerProcess: 2
processTimeout: 60.0
# strict rules
strictRules:
disallowedLooseComparison: true
booleansInConditions: true
uselessCast: true
requireParentConstructorCall: true
overwriteVariablesWithLoop: true
closureUsesThis: true
matchingInheritedMethodNames: true
numericOperandsInArithmeticOperators: true
switchConditionsMatchingType: true
noVariableVariables: true