Skip to content

Commit

Permalink
Update shipmonk PHPStan rules
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Dec 4, 2022
1 parent da138dc commit 979240a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 23 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -30,7 +30,7 @@
"phpstan/phpstan-strict-rules": "1.4.4",
"nepada/phpstan-nette-tester": "1.0.0",
"spaze/phpstan-disallowed-calls": "2.10.0",
"shipmonk/phpstan-rules": "1.2.0",
"shipmonk/phpstan-rules": "2.0.1",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"nepada/coding-standard": "7.6.0"
},
Expand Down
74 changes: 52 additions & 22 deletions tests/PHPStan/shipmonk.neon
@@ -1,23 +1,53 @@
rules:
- ShipMonk\PHPStan\Rule\BackedEnumGenericsRule
- ShipMonk\PHPStan\Rule\ForbidAssignmentNotMatchingVarDocRule
- ShipMonk\PHPStan\Rule\ForbidEnumInFunctionArgumentsRule
- ShipMonk\PHPStan\Rule\ForbidFetchOnMixedRule
- ShipMonk\PHPStan\Rule\ForbidMatchDefaultArmForEnumsRule
- ShipMonk\PHPStan\Rule\ForbidMethodCallOnMixedRule
- ShipMonk\PHPStan\Rule\ForbidReturnInConstructorRule
- ShipMonk\PHPStan\Rule\ForbidUnsetClassFieldRule
- ShipMonk\PHPStan\Rule\ForbidUnusedExceptionRule
- ShipMonk\PHPStan\Rule\ForbidUnusedMatchResultRule
- ShipMonk\PHPStan\Rule\ForbidVariableTypeOverwritingRule
- ShipMonk\PHPStan\Rule\RequirePreviousExceptionPassRule
includes:
- ../../vendor/shipmonk/phpstan-rules/rules.neon

services:
-
type: ShipMonk\PHPStan\Visitor\UnusedExceptionVisitor
tags:
- phpstan.parser.richParserNodeVisitor
-
class: ShipMonk\PHPStan\Visitor\UnusedMatchVisitor
tags:
- phpstan.parser.richParserNodeVisitor
parameters:
shipmonkRules:
allowComparingOnlyComparableTypes:
enabled: false
allowNamedArgumentOnlyInAttributes:
enabled: false
backedEnumGenerics:
enabled: true
enforceReadonlyPublicProperty:
enabled: false
forbidAssignmentNotMatchingVarDoc:
enabled: true
forbidCustomFunctions:
enabled: false
list: []
forbidEnumInFunctionArguments:
enabled: true
forbidFetchOnMixed:
enabled: true
forbidMatchDefaultArmForEnums:
enabled: true
forbidMethodCallOnMixed:
enabled: true
forbidNullInAssignOperations:
enabled: true
blacklist: ['??=']
forbidNullInBinaryOperations:
enabled: true
blacklist: [
'**', '!=', '==', '+', 'and', 'or', '&&', '||', '%', '-', '/', '*', # checked by phpstan-strict-rules
'>', '>=', '<', '<=', '<=>', # allow comparisons
'===', '!==', '??' # valid
]
forbidVariableTypeOverwriting:
enabled: true
forbidUnsetClassField:
enabled: true
forbidUselessNullableReturn:
enabled: false
forbidUnusedException:
enabled: true
forbidUnusedMatchResult:
enabled: true
requirePreviousExceptionPass:
enabled: true
reportEvenIfExceptionIsNotAcceptableByRethrownOne: false
uselessPrivatePropertyDefaultValue:
enabled: true
uselessPrivatePropertyNullability:
enabled: true

0 comments on commit 979240a

Please sign in to comment.