-
Couldn't load subscription status.
- Fork 2k
refactor: PHPDocs in env()
#9468
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
Conversation
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.
We get rid of "mixed" wherever possible. array<int|string, mixed> is better.
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.
hey, can this be better suited if we use generics instead?
|
Do you mean like this? i think better --- a/system/Common.php
+++ b/system/Common.php
@@ -371,9 +371,11 @@ if (! function_exists('env')) {
* retrieving values set from the .env file for
* use in config files.
*
- * @param array<int|string, mixed>|bool|float|int|string|null $default
+ * @template T
*
- * @return array<int|string, mixed>|bool|float|int|string|null
+ * @param T|null $default
+ *
+ * @return T|null
*/
function env(string $key, $default = null)
{ |
|
I think you can drop the null part in the phpdocs: see https://phpstan.org/r/b764e608-6ea7-4edf-aa2d-5821cc80057b. But please try again with your examples. |
|
When i set default from my config property is passed. The problem is EDIT : Now all passed using |
|
@paulbalandan I'm not familiar with |
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.
Sorry, please disregard the generics idea. I tried tinkering it on the phpstan playground and I got no luck.
|
Local and runner already passed |
|
The thing is |
Description
default not sync with return
Checklist: