Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: update PHPStan lvl to 5#91

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SMillerDev wants to merge5 commits intoresque:develop
base:develop
Choose a base branch
Loading
fromSMillerDev:feat/general/phpstan_4

Conversation

@SMillerDev
Copy link
Contributor

@SMillerDevSMillerDev commentedMar 5, 2025
edited
Loading

This updates the PHPStan check to lvl 5. There are still some unresolved issues and the method types are based on the redis docs so might not be complete.

@SMillerDevSMillerDev changed the titlefeat: update PHPStan lvl to 4feat: update PHPStan lvl to 5Mar 5, 2025
Copy link
Collaborator

@pprkutpprkut left a comment

Choose a reason for hiding this comment

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

For a couple of type changes you can have a look at#92. Or wait until that one is in. It should make a couple things easier.

@SMillerDev
Copy link
ContributorAuthor

Updated based on the latest state of the develop branch.

@SMillerDevSMillerDev requested a review frompprkutMarch 17, 2025 11:38
@pprkut
Copy link
Collaborator

For the one remaining failure, it looks like the documentation forblpop in Credis is incomplete. It does, in fact, allow an array input.
https://github.com/colinmollenhour/credis/blob/v1.16.2/Client.php#L1670 will take the list of strings we pass inhttps://github.com/resque/php-resque/blob/develop/lib/Resque.php#L195 and make it a vararg essentially, so the signature is more likeblpop(string $key1, string $key2, string $key3, ..., int $timeout), but that's obviously not supported by PHP.

I think adjusting that tostring|string[] should be good enough.

@pprkut
Copy link
Collaborator

I won't stop you from pushing ahead here, but I feel like scope-creep is setting in 🙂
We don't need to push to level 5 directly, we can totally do intermediate steps which would keep the changes more manageable IMHO. But I leave that up to you

@SMillerDev
Copy link
ContributorAuthor

I think it was mostly editing in the web UI that made it seem bad. I've covered everything now, except the fact that$instance can be unset but phpstan doesn't acknowledge that.

@danhunsaker
Copy link
Member

$instance can be unset but phpstan doesn't acknowledge that.

With a type hint that doesn't include an uninitialized value as an option, it can't assumenull is valid. Add|null and it should sort itself.

@SMillerDev
Copy link
ContributorAuthor

Add|null and it should sort itself.

Yeah, I had that until#91 (comment)

@pprkut
Copy link
Collaborator

I'll check it some more. Especially in newer PHP versions the assumption of "unitinitialized == null" is no longer true, that's why I don't think adding a type hint for it is correct. But maybe it's the simplest solution.

@Redominus
Copy link

A simpler solution would be to bump the project to php 7.4+ or even to a supported php version. Once the native type hint is added to the instance property phpstan stops complaining.

@Redominus
Copy link

Here is the needed changes to make phpstan accept the code.
https://github.com/Redominus/php-resque/tree/feat/general/phpstan_4
I had to restrict credis version to 1.16.* as the newer versions have changed the cluster class constructor.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@danhunsakerdanhunsakerdanhunsaker left review comments

@pprkutpprkutpprkut requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@SMillerDev@pprkut@danhunsaker@Redominus

[8]ページ先頭

©2009-2025 Movatter.jp