Closed gemal closed 2 years ago
Can you please post the code sample that reports this?
/cc @MartinMystikJonas
$this->{$model}->localeDetails['Country'] = $country['Country'];
doesn't allRules: false
disable all the strict rules?
Yeah, it should, there's gonna be some misconfiguration that should be obvious by looking at rules.neon.
I will check it
perhaps I dont understand the documentation I used to have this in the phpstan.neon
services:
-
class: PHPStan\Rules\SwitchConditions\MatchingTypeInSwitchCaseConditionRule
tags:
- phpstan.rules.rule
then I updated strict and deleted it and replaced it with:
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
parameters:
strictRules:
allRules: false
and now all kind of errors
This is the problem: https://github.com/phpstan/phpstan-strict-rules/blob/6f0133dae1ed2d5fc674ad8324441c563720a0d3/rules.neon#L133-L134
Besides allRules: false
you should also check the additional parameters (that are off by default in PHPStan core but strict-rules enable them too): https://github.com/phpstan/phpstan-strict-rules/blob/6f0133dae1ed2d5fc674ad8324441c563720a0d3/rules.neon#L2-L14
Yeah I found it too. I am already working on PR with fix.
Should be fixed by PR #186
I tried to use 1.4.2 and even with allRules: false
I get:
153 PHPDoc type array of property App\Controller\AppController::$helpers is not the same as PHPDoc type mixed of overridden property
Controller::$helpers.
💡 You can fix 3rd party PHPDoc types with stub files:
https://phpstan.org/user-guide/stub-files
This error can be turned off by setting
reportMaybesInPropertyPhpDocTypes: false in your ../phpstan.neon.
Parameter #2 $status (int) of method App\Controller\AppController::redirect() should be contravariant with parameter $status (array|int|string|null)
of method Controller::redirect()
first one fixed by setting reportMaybesInPropertyPhpDocTypes:false
but the other remain
@gemal That could be probably fixed by reportMaybesInMethodSignatures: false
but I am not sure without code example.
@gemal Strict rules does not only add new rules (that could be disabled by allRules: false
) but also modify settings of standard rules.
Here is complete list of settings modifications did by including strict rules:
polluteScopeWithLoopInitialAssignments: false
polluteScopeWithAlwaysIterableForeach: false
checkAlwaysTrueCheckTypeFunctionCall: true
checkAlwaysTrueInstanceof: true
checkAlwaysTrueStrictComparison: true
checkAlwaysTrueLooseComparison: true
checkDynamicProperties: %featureToggles.bleedingEdge%
checkExplicitMixedMissingReturn: true
checkFunctionNameCase: true
checkInternalClassCaseSensitivity: true
reportMaybesInMethodSignatures: true
reportStaticMethodSignatures: true
reportMaybesInPropertyPhpDocTypes: true
You can switch them back to default if you do not want stricter settings enabled.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I just updated to strict v1.4.0 and I added:
but now I'm getting this:
Variable property access on $this(App\Controller\AppController).
is this correct? I thought that
allRules: false
disabled all strict rules