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
Return type added as string|bool
instead of string|false
#2588
Comments
This is due to the phpstorm stubs, it would be good to replace/augment those with better stubs (e.g. the ones Psalm/PHPStan uses) for better types all round. |
So the /**
* ...
* @param int|null $timestamp [optional] Default value: time(). The optional timestamp parameter is an integer Unix timestamp
* that defaults to the current local time if a timestamp is not given.
* @return string|false a formatted date string. If a non-numeric value is used for
* timestamp, false is returned and an
* E_WARNING level error is emitted.
*/
#[Pure(true)]
#[LanguageLevelTypeAware(["8.0" => "string"], default: "string|false")]
function date(string $format, ?int $timestamp) {} The types appear to be correct? |
Hrmph, then it's a "bug" |
For some reason we were downgrading the return types and not downgrading them didn't break any tests, so, let's see if anything breaks... :) note that this will only work if the Phpactor thinks the project is on PHP 8.2 |
Awesome thanks! |
Hello!
There are several php functions that return
false
if an error occurs (e.g.,date()
). Given thatfalse
is now a first class type I would expect phpactor to automatically set the return type for a function to bestring|false
instead ofstring|bool
:Thanks!
The text was updated successfully, but these errors were encountered: