Skip to content
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

Update DateTime and DateTimeImmutable signatures #6040

Merged
merged 2 commits into from
Jul 4, 2021
Merged

Update DateTime and DateTimeImmutable signatures #6040

merged 2 commits into from
Jul 4, 2021

Conversation

j4nr6n
Copy link
Contributor

@j4nr6n j4nr6n commented Jul 3, 2021

DateTime::format and DateTimeImmutable::format will always return a string starting in PHP 8.0.

https://psalm.dev/r/b5d797f092
https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-changelog

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/b5d797f092
<?php

$theTime = new DateTimeImmutable();

$array = [
    $theTime->format('Y-m-d') => 'Y-m-d',
    $theTime->format('H:i:s') => 'H:i:s',
];

echo array_shift($array);
Psalm output (using commit 4cb1e2b):

ERROR: InvalidArrayOffset - 5:10 - Cannot create offset of type false|string, expecting array-key

tests/MethodCallTest.php Outdated Show resolved Hide resolved
@weirdan weirdan marked this pull request as draft July 3, 2021 07:20
`DateTime::format` and `DateTimeImmutable::format` will always
return a string starting in PHP 8.0.
@j4nr6n j4nr6n marked this pull request as ready for review July 3, 2021 09:15
@weirdan weirdan merged commit c27b51b into vimeo:master Jul 4, 2021
@weirdan
Copy link
Collaborator

weirdan commented Jul 4, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants