Skip to content

Commit

Permalink
php8 vs php7 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
janedbal committed Apr 24, 2024
1 parent 2a69a34 commit 1e2cef8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-1014.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-pr-339.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/pow.php');
if (PHP_VERSION_ID >= 80000) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/pow-php8.php');
} else {
yield from $this->gatherAssertTypes(__DIR__ . '/data/pow-php7.php');
}
yield from $this->gatherAssertTypes(__DIR__ . '/data/throw-expr.php');
yield from $this->gatherAssertTypes(__DIR__ . '/data/bug-5351.php');

Expand Down
8 changes: 8 additions & 0 deletions tests/PHPStan/Analyser/data/pow-php7.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace PowFunction;

use function PHPStan\Testing\assertType;

assertType('4', '4a' ** 1);
assertType('0', 'a' ** 1);
8 changes: 8 additions & 0 deletions tests/PHPStan/Analyser/data/pow-php8.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

namespace PowFunction;

use function PHPStan\Testing\assertType;

assertType('4', '4a' ** 1);
assertType('*ERROR*', 'a' ** 1);
3 changes: 0 additions & 3 deletions tests/PHPStan/Analyser/data/pow.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,6 @@ function doFoo(int $intA, int $intB, string $s, bool $bool, $numericS, float $fl
assertType('*ERROR*', $s ** $arr);
assertType('*ERROR*', $s ** []);

assertType('4', '4a' ** 1);
assertType('*ERROR*', 'a' ** 1);

assertType('1', pow($bool, 0));
assertType('1', $bool ** '0');
assertType('1', $bool ** false);
Expand Down

0 comments on commit 1e2cef8

Please sign in to comment.