-
Notifications
You must be signed in to change notification settings - Fork 30
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
NEW action PHPStan & 36 little 🐛 fixes #931
Conversation
Hello @mauteri , I would call this: 38 chances to not get more trouble, than needed. |
…g, int<50207, max> given.
…a file or it does not exist.
…, string given.
…priority() should return int but returns bool.
…y): int, array{$this(GatherPress\Core\Rsvp), 'sort_by_timestamp'} given.
…ing, int given." This reverts commit 968ac3b.
…alink returns FALSE, not NULL if it fails)
Because 'pre_get_comments' is an action, not a filter.
…ways evaluate to true.
Which is way more performant: vendor/bin/phpstan analyze -vv --memory-limit=2G Elapsed time: 5 seconds Used memory: 663.28 MB Elapsed time: 10 seconds Used memory: 1.08 GB composer test:phpstan (which runs `vendor/bin/phpstan analyze -vv --memory-limit=2G` under the hood) Elapsed time: Used memory: 70.5 MB
…oid) of echo cannot be converted to string.) which was a false positive.
…t, string given. AND Parameter #1 $object_ids of function wp_get_object_terms expects array<int>|int, string given.
… evaluate to false.
…nt, spam: int, trash: int, post-trashed: int, total_comments: int, all: int} on left side of ?? always exists and is not nullable.
…array<int, string>.
Ok 36/38 done, this was a nice ride through the codebase. Special invitation to @mauteri : The last two remaining errors need a bit more love. ------ --------------------------------------------------------------
Line core/classes/class-event-rest-api.php
------ --------------------------------------------------------------
:60 Action callback returns bool but should not return anything.
🪪 return.void
------ --------------------------------------------------------------
------ -------------------------------------------------------------------------
Line core/classes/class-rsvp.php
------ -------------------------------------------------------------------------
:499 Parameter #3 $group of function wp_cache_set expects string, int given.
🪪 argument.type
------ -------------------------------------------------------------------------
[ERROR] Found 2 errors
The second is already described at #933 |
Preview changes with PlaygroundYou can preview the recent changes for PR#931 with the following PHP versions: PHP Version 8.3
PHP Version 7.4
Download Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions. |
@carstingaxion I made some more changes. Please look over when you can. Thx! |
@carstingaxion there was a bug where we only support to 6.6, so we are testing 0.31.0 a bit longer. going to merge this one into it since there's a lot of good bug fixes here. |
Cool. Thank you! What bug have been there? |
@ajskelton reported and I reproduced that all the GstherPress blocks were broken in the editor in versions under 6.6. I did some debugging and this has actually been an issue since 0.29. It is related to some package updates that were done at that time. |
Description of the Change
This PR introduces a new GitHub action workflow to run PHPStan incl. the WordPress extension.
On behalf of this static analysis I fixed a lot of little problems. While most of the fixes are simple & self-explanatory, the following 6/36 fixes may need a second pair of eyes:
Closes #How to test the Change
Compare the results of the first PHPStan test run, with the last run of the same action.
Looking at the Files changed, may not be very helpful for this PR, instead going through the commits one-by-one is recommended here.
Changelog Entry
Credits
Props @carstingaxion @mauteri
Checklist: