Skip to content

support phpstan 1.0; drop support for phpstan < 1.0 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
],
"require": {
"php": "^7.1 || ^8.0",
"phpstan/phpstan": "^0.10 | ^0.11 | ^0.12",
"phpstan/phpstan": "^1.0",
"thecodingmachine/safe": "^1.0"
},
"require-dev": {
Expand All @@ -36,7 +36,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "1.1-dev"
},
"phpstan": {
"includes": [
Expand Down
7 changes: 5 additions & 2 deletions tests/Rules/CallMethodRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

namespace TheCodingMachine\Safe\PHPStan\Rules;

use PHPStan\Php\PhpVersion;
use PHPStan\Rules\FunctionCallParametersCheck;
use PHPStan\Rules\Methods\CallMethodsRule;
use PHPStan\Rules\NullsafeCheck;
use PHPStan\Rules\PhpDoc\UnresolvableTypeHelper;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleLevelHelper;
use PHPStan\Testing\RuleTestCase;
Expand All @@ -14,10 +17,10 @@ class CallMethodRuleTest extends RuleTestCase
protected function getRule(): Rule
{
$broker = $this->createBroker();
$ruleLevelHelper = new RuleLevelHelper($broker, true, true, true);
$ruleLevelHelper = new RuleLevelHelper($broker, true, true, true, false);
return new CallMethodsRule(
$broker,
new FunctionCallParametersCheck($ruleLevelHelper, true, true, true, true),
new FunctionCallParametersCheck($ruleLevelHelper, new NullsafeCheck(), new PhpVersion(PHP_VERSION_ID), new UnresolvableTypeHelper(), true, false, false, false),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

especially I am not sure about these 3 new added false passed for the 3 new args:
grafik

Copy link

@p4veI p4veI Nov 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just looking around, but from looking into phpstan core, I don't see that the booleans are added to the FunctionCallParametersCheck, only the last boolean was removed.

Frankly, it seems odd that the instantiation of FunctionCallParametersCheck did not include the nullsafe check, phpversion and helper before and was just passing the booleans instead..

Feels like it should either stay the same as:
...true, true, true, true unless there's a reason for disabling the checks..

Anyways, I temporarily updated phpstan-safe-rule in my project with this fork and it seems it works just as well as previously. Hope this helps..

EDIT: sorry just noticed it's a test..

$ruleLevelHelper,
true,
true
Expand Down