NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1607 most downloaded on Packagist
Various extra strict PHPStan rules we found useful in ShipMonk.
Latest stable
4.4.1
Last release 1 months ago
01 Oct 2026
Release timing varies
gaps range from 8 days to 5 months
Nearly every release is documented
notes for 56 of 56 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
56 releases · first in 2022
Drag across the ruler to compare, or tap a release to open it.
forbidCheckedExceptionInCallable: resolve static call caller type from expressions (#368, @maryo)
forbidCheckedExceptionInCallable: resolve static call caller type from expressions (#368, @maryo)requirePreviousExceptionPass: accept exception passed to nested call (#369)allowComparingOnlyComparableTypes: add support for BcMath\Number
allowComparingOnlyComparableTypes: add support for BcMath\Number (#360)PHP 8.1+ (#361)forbidVariableTypeOverwriting: fix false positive with fluent $this returns
Your coding agent can read these notes before it upgrades. Set up the MCP server →
forbidVariableTypeOverwriting: fix false positive with fluent $this returns (#350)forbidUnusedException & forbidUnusedMatchResult support remaining edge cases like string concat (#353)forbidUselessNullableReturn: fix false positive with property hooks (https://github.com/shipmonk-rnd/phpstan-rules/pull/355)forbidCheckedExceptionInYieldingMethod: support functions and (immediately-invoked) closures
forbidCheckedExceptionInYieldingMethod: support functions and (immediately-invoked) closures (#345)forbidCheckedExceptionInCallable: fix reported file for traits
forbidCheckedExceptionInCallable: fix reported file for traits (#342)No crash or false-positives when running with fibers-based PHPStan 2.1.34+ (#340, #337)
forbidCast: avoid failure on (void) cast (#336, @dragosprotung)
forbidCast: avoid failure on (void) cast (#336, @dragosprotung)enforceReadonlyPublicProperty: skip untyped props + add excludePropertyWithDefaultValue option (#334, @devfrey)
enforceReadonlyPublicProperty: skip untyped props + add excludePropertyWithDefaultValue option (#334, @devfrey)enforceReadonlyPublicProperty: skip static properties (#333, @devfrey)
enforceReadonlyPublicProperty: skip static properties (#333, @devfrey)
enforceReadonlyPublicProperty support asymmetric visibility (#331, @JanTvrdik)
enforceReadonlyPublicProperty support asymmetric visibility (#331, @JanTvrdik)forbidArithmeticOperationOnNonNumber add support for BcMath\Number (#321, @JokubasR)enforceNativeReturnTypehint fix false positive for unions with template type (#325, @mspirkov)forbidPhpDocNullabilityMismatchWithNativeTypehint: ignore void methods (#328, @mspirkov)phpstan/phpstan now requires ^2.1.32 (#331)forbidUselessNullableReturn: no error for overridable methods (#314 by @vrana)
forbidUselessNullableReturn: no error for overridable methods (#314 by @vrana)forbidUnusedClosureParameters: report unused trailing params for closures and array functions
forbidUnusedClosureParameters: report unused trailing params for closures and array functions (#313)enforceNativeReturnTypehint: fix property hook false positive
enforceNativeReturnTypehint: fix property hook false positive (#309)forbidUnusedMatchResult: fix false positive for usage in arrow function (#305, @maryo)
forbidUnusedMatchResult: fix false positive for usage in arrow function (#305, @maryo)enforceReadonlyPublicProperty: fix false positive with hooked properties
enforceReadonlyPublicProperty: fix false positive with hooked properties (#303)forbidUnusedException: fix ->getException()::class false positive
forbidUnusedException: fix ->getException()::class false positive (#299)forbidCast: fix custom blacklist configuration (#297, @forrest79)
forbidCast: fix custom blacklist configuration (#297, @forrest79)phpstan/phpstan requires ^2.1.8 (#296)forbidCustomFunctions now detects even fist class callables, anonymous classes and array/string callables in arguments
new class extends DeniedParent {} $this->deniedMethod(...)array_map([$this, 'deniedMethod'], $a)array_map('denied_function', $a)Dropped uselessPrivatePropertyNullability as it got implemented in native PHPStan
phpstan/phpstan now requires 2.0.0 (#274)Fix reflection error on unknown symbols
phpstan/phpstan now requires 1.12.5 (was 1.11.0) (#272)Ease enabling rules one-by-one (#260) ```neon parameters: shipmonkRules: enableAllRules: false
parameters:
shipmonkRules:
enableAllRules: false
allowComparingOnlyComparableTypes:
enabled: true
forbidUnsafeArrayKey: allow only int|string in array keys (deny null, bool, float etc)
int|string in array keys (deny null, bool, float etc) (#254)forbidAssignmentNotMatchingVarDoc: removed as there is better native replacement when bleedingEdge is enabled
immediatelyCalledCallables (we now respect native @param-immediately-invoked-callable, see docs) (#240)reportRegardlessOfReturnType is now true by defaultphpstan/phpstan now requires at least 1.11.0 (was 1.10.51)
1.11.0 comes with error identifiers (which we support since 2.10.0)forbidNotNormalizedType: check invalid Parent|Child even in multi-catch and @throws (#231, #232)
Parent|Child even in multi-catch and @throws (#231, #232)forbidCheckedExceptionInCallable: call_user_func & forward_static_call is immediatelly called
call_user_func & forward_static_call is immediatelly called (#212)nikic/php-parser requirement (#222)
Fix compatibility with PHPStan >=1.10.51
phpstan/phpstan now requires at least 1.10.51 (was 1.10.30) (#206)allow array_unique($enums, SORT_REGULAR)
array_unique($enums, SORT_REGULAR) (#196)natcasesort (#197)forbidNotNormalizedType: deny Child|Parent within unions or intersections; there is no mixed|false, just mixed
Child|Parent within unions or intersections; there is no mixed|false, just mixed (#185)forbidUnusedMatchResult: fix void false positive in latest PHPStan (>= 1.10.49)
allowComparingOnlyComparableTypes: allow safe tuple comparison (lists of equal size & item types)
usort($items, fn ($a, $b) => [$a->updatedAt, $a->id] <=> [$b->updatedAt, $b->id])forbidArithmeticOperationOnNonNumber: deny arithmetic operations like $a + $b over non numbers
$a + $b over non numbers (#180)$i++, $i--, ++$i, --$i with any non-integer (#179)forbidUnusedMatchResult: fix false positive with assign operators, += etc
+= etc (#171)ImmediatelyCalledCallableThrowTypeExtension: ignore implicit throw points https://github.com/shipmonk-rnd/phpstan-rules/pull/163
enforceIteratorToArrayPreserveKeys: ensure $preserve_keys is explicitly set (mitigate data loss / failure risk)
$preserve_keys is explicitly set (mitigate data loss / failure risk) (#154)EntityManagerInterface::transactional (#157)forbidFetchOnMixed & forbidMethodCallOnMixed:
forbidCheckedExceptionInCallableRule: exception tracking elevated to next level (https://github.com/shipmonk-rnd/phpstan-rules/pull/137) !
EntityManager::transactionalphpstan/phpstan now requires at least 1.10.30 (was 1.10.0, see https://github.com/shipmonk-rnd/phpstan-rules/pull/137)enforceNativeReturnTypehint: fix wrong never suggestion
forbidIdenticalClassComparison: fix false positive with TemplateMixedType
forbidCheckedExceptionInYieldingMethod: fix false positive when no checked exception is configured
forbidCheckedExceptionInYieldingMethod: denies throwing checked exception within yielding methods are those gets thrown upon iteration, not within met
forbidUnusedMatchResult: fix nested match false positive
classSuffixNaming: allows you to enforce class name suffix for specific children, e.g. \Exception to have Exception suffix
\Exception to have Exception suffix (#102)uselessPrivatePropertyNullability: fix false positive when mixed is assigned
enforceEnumMatchRule: new rule enforcing usage of match ($enum) instead of exhaustive elseifs for enums
match ($enum) instead of exhaustive elseifs for enums (#94)
allowNarrowing: true (#92)
phpstan/phpstan now requires at least 1.10.0 (was 1.9.1, see https://github.com/shipmonk-rnd/phpstan-rules/pull/84)enforceReadonlyPublicProperty: fix false positive on old PHP versions
enforceListReturn: prefer @return list over @return array where possible
@return list<T> over @return array<T> where possible (https://github.com/shipmonk-rnd/phpstan-rules/pull/76)===, !== for configured objects (useful for DateTimeInterface, Brick/Money and similar)return; (#82)phpstan/phpstan now requires at least 1.9.1 (was 1.8.7, see https://github.com/shipmonk-rnd/phpstan-rules/pull/76)installable by extension-installer, see official docs how to use it
forbidPhpDocNullabilityMismatchWithNativeTypehint: fix false positive with templates
forbidCast: denies casting you configure - by default only (object), (array) and (unset)
(object), (array) and (unset)"Hi $name!"phpstan/phpstan now requires at least 1.8.7 (was 1.8.1, see https://github.com/shipmonk-rnd/phpstan-rules/pull/69)nikic/php-parser now requires at least 4.14.0 (was 4.13.2, see https://github.com/shipmonk-rnd/phpstan-rules/pull/69)uselessPrivatePropertyNullability: fix false positive within promoted properties
Much easier setup. Just include `vendor/shipmonk/phpstan-rules/rules.neon` in your codebase; no need to register all rules, visitors and tags as befor
vendor/shipmonk/phpstan-rules/rules.neon in your codebase; no need to register all rules, visitors and tags as before (https://github.com/shipmonk-rnd/phpstan-rules/pull/44)
includes:
- vendor/shipmonk/phpstan-rules/rules.neon
parameters:
shipmonkRules:
allowNamedArgumentOnlyInAttributes:
enabled: false
ForbidNullInAssignOperationsRule: checking no null is involved in +=, *= etcForbidAssignmentNotMatchingVarDocRule: added option to allow type narrowing for individual var docs by /** @var Type allow-narrowing */, thx @MartinMystikJonas (https://github.com/shipmonk-rnd/phpstan-rules/pull/45)ForbidFetchOnMixedRule and ForbidMethodCallOnMixedRule does not make sense on level9, so it gets autodisabled in that case (https://github.com/shipmonk-rnd/phpstan-rules/pull/38)ForbidAssignmentNotMatchingVarDocRule now reports type narrowing with different message (https://github.com/shipmonk-rnd/phpstan-rules/pull/45)New rule `EnforceReadonlyPublicPropertyRule` for protecting all your public properties by requiring readonly modifier
EnforceReadonlyPublicPropertyRule for protecting all your public properties by requiring readonly modifierForbidAssignmentNotMatchingVarDocRule that verifies if the assignment to the variable with inline phpdoc matches the typeForbidUnusedMatchResultRule detecting forgotten usage of match resultForbidNullInBinaryOperationsRule to ensure no null value is involved in binary operationsForbidVariableTypeOverwritingRule denying type change when overwriting variablesFixed duplicate registration of ForbidUnsetClassFieldRule in deprecated rules.neon
rules.neon (#25)`RequirePreviousExceptionPassRule` can be checking more cases when reportEvenIfExceptionIsNotAcceptableByRethrownOne option is used
RequirePreviousExceptionPassRule can be checking more cases when reportEvenIfExceptionIsNotAcceptableByRethrownOne option is usedAllowComparingOnlyComparableTypesRule for strict usage of <,>,<=,>=,<=>BackedEnumGenericsRule allowing to hack generics into BackedEnum in PHP 8.1ForbidEnumInFunctionArgumentsRule checking dangerous usage of enums in array functions like array_diff, sort, implode and much moreForbidCustomFunctionsRule allowing you to deny method calls as you need, e.g.: useless ReflectionProperty::setAccessible on PHP 8.1phpstan/phpstan now requires at least 1.8.1 (was 1.5.6, see https://github.com/shipmonk-rnd/phpstan-rules/pull/15)Use reliable static reflection concepts, no is_a inside rules
First 11 rules open-sourced, see readme
One column per quarter.