-
-
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
Improve Collection Typings + Add strict
Operation
#102
Conversation
As an aside, there seem to be some differences between the CI setup and running GrumPHP locally. The failures seen in CI don't happen on local. Do you think it could be due to the fact that Psalm is configured to use a cache in CI? (I think we should disable this btw)
|
No I don't think this is the case. However, you can try to disable it by adding:
in the local grumphp file, under the |
You're right looks like disabling the cache didn't fix the issue. I can't explain the difference in the errors reported but I've reverted the Psalm config change to report unused psalm-suppress annotations which was causing the issue. I'll probably just use it in local development. |
Since this pull request has not had any activity within the last 5 days, I have marked it as stale. |
strict
Operation
Hi Alex, I reviewed locally your pull request. I can't wait to merge this :) However I have a few remarks:
WDYT? |
Hey @drupol , thanks for this.
|
Yes, this is also a valid option.
Wait wait wait, it's not because you have the I'm all in favor of using the I can provide an example if you want to, but a bit later today. |
Here's an extremely basic (and streamlined) example on how to extend the collection: https://gist.github.com/drupol/8b646ec5e1b91d45cf20969b4eabb3af |
strict
Operationstrict
Operation
@drupol refactored into a There's an issue with phpcsfixer and phpcs where they are in opposition -> phpcs wants space here |
I think you can get rid of the parenthesis after the class keyword ? |
I tried but you cannot, because phpcsfixer adds it back 😄 |
looks like this issue: squizlabs/PHP_CodeSniffer#3200 |
It has also been reported here: PHP-CS-Fixer/PHP-CS-Fixer#5463 |
I think you should fix it by doing this: https://gist.github.com/drupol/39a459e29764efdc41cfacb28ee4b751 |
I added a note on how to extend this library here: https://loophp-collection.readthedocs.io/en/latest/pages/usage.html#extending-collection |
Nice 👍 |
do you not think it's better to just ignore the |
This also broke PHPStan but I've added an ignore for |
Ok! |
@drupol let's get this released if you've had the chance to review 🚀 |
Thanks mate! Very nice stuff :) |
Thank you for the help on this, I think we had some good collaboration! |
…Possum) This PR was merged into the master branch. Discussion ---------- ClassDefinitionFixer - PSR12 for anonymous class Adds PSR12 support for `anonymous class` notation with a space following `new class`, like `new class (1,2) {}` (note that `new class {}` is currently already covered) Closes: #5463 (comment) Also reported here loophp/collection#102 (comment) (cc `@drupol` ) Closes one of the points here #4502 New feature so targets `master`, no BC break, new behavior through configuration (by default configuration acts the same) Commits ------- 4d84a83 ClassDefinitionFixer - PSR12 for anonymous class
This PR starts a process of improving the types on the operations to make the Collection behave like a single-type one, without enforcing the type restriction at runtime unless the
strict
operation is used. Based on multiple discussions had in this PR and in #99.