-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Code Analysis Fixes - PHPStan #89
Conversation
@drupol I noticed the Psalm level set up in the config is 7, which is very lenient: https://psalm.dev/docs/running_psalm/error_levels/. A bit confusingly, the levels go the other way in PHPStan's case, where higher is stricter 😄 . Was Psalm added later to project? Or how come it's level is not very strict compared to PHPStan? |
@drupol I decided to err on the side of caution with this and so only fixed some of the things what were not very problematic. I tried diving into the issues in I added a baseline file so now these are clearly visible and can be tackled separately. How do we make PHPStan+Psalm blocking in GrumPHP? Do we do it via a parameter in this project which overwrites the drup-conventions parameter? Or do we change the one in that repository? (not sure how it affects other projects of yours) |
Trying the library in a project that uses a stricter Psalm level results in errors 😢
I scratched my head with this one a bit but still couldn't see what the issue was 😅 |
Excellent, I really like that!
Like this: diff --git a/grumphp.yml b/grumphp.yml
index a5dba304..0bb8a40e 100644
--- a/grumphp.yml
+++ b/grumphp.yml
@@ -5,6 +5,7 @@ parameters:
tasks.phpcsfixer.config: .php-cs-fixer.dist.php
tasks.license.holder: Pol Dellaiera
tasks.license.date_from: 2019
+ tasks.phpstan.blocking: true
extra_tasks:
phpspec:
verbose: true |
Yeah I'm aware of this :(
The
Try with something like this:
|
Unfortunately I don't think that's the issue as the map should be able to be used without those too. Adding them still errors:
I think it has to do with the |
This is something that we need to sort out. I know that annotations are not well done, but this is a huge work. I haven't been able to find the right balance. |
I know, it'll be hard to fix them with the code already in place because there are interdependencies. What would be the best place to put that code? I don't think it quite fits in docs, src, spec, or tests (also the last 2 are excluded from analysis). Should we create a new folder |
Update on this, I think a folder called |
Yeah I did that for this: https://github.com/loophp/combinator |
Ah nice! Yeah this library needs that too. Don't keep the best stuff for your other projects 😜 😄 |
I have a local branch of loophp/collection completely rewritten with loophp/fpt :) But this is for later, much later! |
Let me know if there's anything else to address on this, it's ready from my side :) |
You're on a roll ! Thanks again !!! |
This PR aims to fix current issues reported by PHPStan.