Skip to content

Fix errors for phpstan level 6 #684

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

Closed
wants to merge 1 commit into from
Closed

Conversation

j3j5
Copy link

@j3j5 j3j5 commented Oct 20, 2021

Hi, I tried to fix all errors from phpstan on level 6. Not sure if you have a specific wish for the format for iterable types (array<int,string> vs string[]) but for the rest it should be fine.

Actually, I think I've found a bug on the implementation of strip-hosts, but please double check that part before merging just in case I misunderstood how it's supposed to work.

It should fix #658

@alcohol
Copy link
Member

alcohol commented Oct 21, 2021

I have approved the workflow actions; which have raised several issues. Also it seems your proposed fix makes the tests fail, so I am not sure if that works as you intended.

@j3j5
Copy link
Author

j3j5 commented Oct 21, 2021

I'll try to take a look later in the day. I run the tests locally and there was one failing, but it was also failing on main so I thought it was known. Same for phpstan, level 5 is failing on the tests folder on main so I thought you were just checking on src. I can try to fix the current issues on level 5 on a different MR if you want. I have no idea about JS, I haven't touched any of those files so I can only assume they also fail on main.

@alcohol
Copy link
Member

alcohol commented Oct 21, 2021

I think they're failing now because the config has been raised to 6 in this PR.

The config applies to both src and tests.

paths:
- src
- tests

@alcohol
Copy link
Member

alcohol commented Oct 21, 2021

I stand corrected. It was failing on level 5 for tests too. You don't have to fix those, but it would be very much appreciated if you do.

@@ -87,6 +99,12 @@ protected function isOneOfNamesInList(array $names, array $list): bool
return false;
}

/**
*
* @param string $name
Copy link
Contributor

Choose a reason for hiding this comment

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

Some @param and @return annotations are redundant with method signature; is it really required by phpstan?

Copy link
Member

Choose a reason for hiding this comment

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

I don't believe so.

These was a discussion about the superfluous phpdoc rule; but so far consensus was to keep the rule in place.

Choose a reason for hiding this comment

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

It is also more consistent for the time being.
And to be honest:
Removing some and adding others is usually counterproductive in readability, it really confuses people as to the positioning of those lines then if they ever need to be added.

@alcohol
Copy link
Member

alcohol commented Mar 21, 2022

That merge commit was not what I intended to do. Let me see if I can resolve this from CLI.

@alcohol
Copy link
Member

alcohol commented Sep 15, 2023

See #731

@alcohol alcohol closed this Sep 15, 2023
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.

Increase PHPStan to level 6
5 participants