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

Fix non-working type assertions in NodeScopeResolverTest cases #1992

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions tests/PHPStan/Analyser/data/DateTimeModifyReturnTypes.php
Expand Up @@ -4,12 +4,13 @@

use DateTime;
use DateTimeImmutable;
use function PHPStan\Testing\assertType;

class Foo
{
public function modify(DateTime $datetime, DateTimeImmutable $dateTimeImmutable, string $modify): void {
assertType('DateTime|false', $datetime->modify($modify));
assertType('DateTimeImmutable|false', $dateTimeImmutable->modify($modify));
assertType('(DateTime|false)', $datetime->modify($modify));
assertType('(DateTimeImmutable|false)', $dateTimeImmutable->modify($modify));
}

/**
Expand All @@ -32,8 +33,8 @@ public function modifyWithInvalidConstant(DateTime $datetime, DateTimeImmutable
* @param '+1 day'|'koko' $modify
*/
public function modifyWithBothConstant(DateTime $datetime, DateTimeImmutable $dateTimeImmutable, string $modify): void {
assertType('DateTime|false', $datetime->modify($modify));
assertType('DateTimeImmutable|false', $dateTimeImmutable->modify($modify));
assertType('(DateTime|false)', $datetime->modify($modify));
assertType('(DateTimeImmutable|false)', $dateTimeImmutable->modify($modify));
}

}
2 changes: 2 additions & 0 deletions tests/PHPStan/Analyser/data/bug-7031.php
Expand Up @@ -2,6 +2,8 @@

namespace Bug7031;

use function PHPStan\Testing\assertType;

class SomeKey {}

function () {
Expand Down