Skip to content

Commit

Permalink
Fix non-working type assertions in NodeScopeResolverTest cases
Browse files Browse the repository at this point in the history
  • Loading branch information
herndlm authored and ondrejmirtes committed Nov 11, 2022
1 parent 582a9cb commit 2177d4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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

0 comments on commit 2177d4e

Please sign in to comment.