-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
PHPStan Fixes #4136
PHPStan Fixes #4136
Conversation
It appears that Rector does not understand explicit strings for PHPDoc types, which PHPStan requires. @samsonasik or @paulbalandan have any suggestions? |
E.g.
|
That seems related to Format preserving doc, ref :
I may create a workaround patch for this in rector side, eg in the ContentPatcher class when I have a chance: For now, I think we can do with: /** @var string 'Lax'|'None'|'Strict' */ ref : |
Try this if you need to be explicit of the type in phpstan. // for vars
* @var string
* @phpstan-var 'Lax'|'None'|'Strict'
// for returns
* @return object
* @phpstan-return TObject Seems phpstan understand those pseudo-docblocks just like in psalm. Deeper fix for the cookie samesite issue is to let phpstan know that we are actually filtering and formatting the allowed values to samesite. This way it can infer that samesite is indeed within the allowed values and the |
@paulbalandan the Need a workaround patch in rector side while wait for a real fix in nikic/php-parser side. |
It actually works for me though. You need to have both https://getrector.org/demo/7ed7b50f-7193-4f45-bade-322d372d7343 |
Ok, that seems a solution, but need different https://phpstan.org/r/15ddc4ad-57a1-4d3b-ac04-bbb2075dda73 vs |
No need. You just have a typo in your second phpstan ref |
@paulbalandan oh yeah, you're correct 👍 |
Thanks for taking a look guys. Can someone either push the final version you agreed on or suggest it in a review? |
Thank you both. GitHub is not allowing me to commit revisions for some reason, looks like a bug, but I will get these applied later when I can get back to my server with this branch. |
Co-authored-by: John Paul E. Balandan, CPA <[email protected]>
Co-authored-by: John Paul E. Balandan, CPA <[email protected]>
Co-authored-by: John Paul E. Balandan, CPA <[email protected]>
Co-authored-by: John Paul E. Balandan, CPA <[email protected]>
Is it possible to use this : |
@MGatner @paulbalandan the /** @var string 'Lax'|'None'|'Strict' */ as I previously suggested for develop branch ( php 7.2 ). @totoprayogo1916 this patch want a quoted doc. |
I am going to merge it right now, I will try to fix the error affected in system/Security/Security.php and system/Session/Session.php in separate PR |
Thank you all, I created new PR for temporary ignore the phpstan notice in Security and Session class, with |
Thanks all. Sorry to be MIA finishing this up - special thanks to @samsonasik |
Description
See #4134
Checklist: