-
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
docs: add correct array signatures for Modules #8106
Conversation
@@ -72,7 +72,7 @@ class Modules extends BaseModules | |||
* | |||
* If it is not listed, only the base application elements will be used. | |||
* | |||
* @var string[] | |||
* @var list<string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If list
is okay with @var
, we can remove @phpstan-var
tags like:
* @var array<int, string>
* @phpstan-var list<string>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I think vscode intelephense has now support for this type, as well as Closure signatures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then let's remove @phpstan-var
from now on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm all for this; I can confirm that Intelephense (in BBEdit) supports list
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I always ask this... these are different, right?
list<string>
string[]
I think the latter just means "values are all strings" without any indication of keys. But I can't find the answer explicitly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
/** @return ValueType[] */
In Psalm this annotation is equivalent to @psalm-return array<array-key, ValueType>.
https://psalm.dev/docs/annotating_code/type_syntax/array_types/#phpdoc-syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for phpstan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sent PR: #8114
I changed |
@paulbalandan Since it's vaguely related could you roll in the CS Fixer change to this PR? +++ /home/runner/work/CodeIgniter4/CodeIgniter4/system/Exceptions/FrameworkException.php |
fad19b3
to
ca13b97
Compare
Description
See #7731
Checklist: