Skip to content
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

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

Merged
merged 3 commits into from
Nov 17, 2021

Conversation

staabm
Copy link
Collaborator

@staabm staabm commented Nov 1, 2021

phpstan 0.x will no longer be supported. prepare the rule for phpstan 1.0+

Fixes #25

@staabm staabm marked this pull request as ready for review November 1, 2021 11:34
@staabm staabm marked this pull request as draft November 1, 2021 11:39
@staabm
Copy link
Collaborator Author

staabm commented Nov 1, 2021

locally the tests pass now. I have 0 experience with this lib, please take it with a grain of salt

@staabm staabm marked this pull request as ready for review November 1, 2021 11:50
@staabm staabm changed the title support phpstan 1.0 support phpstan 1.0; drop support for phpstan < 1.0 Nov 1, 2021
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..

@t-heuser
Copy link

t-heuser commented Nov 2, 2021

Fixes #25

@t-heuser
Copy link

Any updates on this?
@moufmouf
@thecodingmachine

@mfn
Copy link

mfn commented Nov 10, 2021

I can confirm it "just works" for my use-case; I referenced the last commit in this PR:

    "thecodingmachine/phpstan-safe-rule": "dev-master#a630c7bf9f3060b6e3dc74a4d9ef5edc0feec052",

and added this repository to my composer.json:

    {
      "type": "package",
      "package": {
        "name": "thecodingmachine/phpstan-safe-rule",
        "type": "library",
        "version": "dev-master",
        "dist": {
          "url": "https://codeload.github.com/thecodingmachine/phpstan-safe-rule/legacy.zip/a630c7bf9f3060b6e3dc74a4d9ef5edc0feec052",
          "type": "zip"
        },
        "autoload": {
          "psr-4": {
            "TheCodingMachine\\Safe\\PHPStan\\": "src/"
          }
        }
      }
    }

@OskarStark
Copy link
Collaborator

Can someone please merge and release this?

Thanks

@moufmouf
Copy link
Member

Hey @staabm ,

Thanks a lot for the PR!

Could you also please update the composer.json file to switch the alias master from "1.0.x" to "1.1.x"?

https://github.com/thecodingmachine/phpstan-safe-rule/blob/master/composer.json#L38-L40

This way, the "1.0.x" tags will stay associated with PHPStan <= 0.12 and the 1.1.x tags will remain associated with PHPStan 1

@staabm
Copy link
Collaborator Author

staabm commented Nov 17, 2021

@moufmouf done

@moufmouf
Copy link
Member

So quick! Thanks a lot for the PR ❤️

@moufmouf moufmouf merged commit 71bd8c1 into thecodingmachine:master Nov 17, 2021
@moufmouf
Copy link
Member

And it's tagged: https://github.com/thecodingmachine/phpstan-safe-rule/releases/tag/v1.1.0

@OskarStark
Copy link
Collaborator

OskarStark commented Nov 17, 2021

Bäm, thank you very much! 🎉

@staabm staabm deleted the patch-1 branch November 17, 2021 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prepare for PHPStan 1.0
7 participants