Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Sep 13, 2024
1 parent a4be978 commit 62ef6dd
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 14 deletions.
6 changes: 6 additions & 0 deletions tests/PHPStan/Analyser/NodeScopeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public function dataFileAsserts(): iterable
yield from $this->gatherAssertTypes(__DIR__ . '/data/mb-strlen-php73.php');
}
}

if (PHP_VERSION_ID < 80000) {
yield from $this->gatherAssertTypes(__DIR__ . '/data/explode-php74.php');
} else {
yield from $this->gatherAssertTypes(__DIR__ . '/data/explode-php8.php');
}

yield from $this->gatherAssertTypes(__DIR__ . '/../Rules/Methods/data/bug-6856.php');

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

namespace ExplodePhp74;

use function PHPStan\Testing\assertType;

class ExplodingStrings
{
public function doFoo(string $s): void
{
assertType('non-empty-list<lowercase-string>|false', explode($s, 'foo'));
assertType('non-empty-list<string>|false', explode($s, 'FOO'));
}
}
14 changes: 14 additions & 0 deletions tests/PHPStan/Analyser/data/explode-php80.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace ExplodePhp80;

use function PHPStan\Testing\assertType;

class ExplodingStrings
{
public function doFoo(string $s): void
{
assertType('non-empty-list<lowercase-string>', explode($s, 'foo'));
assertType('non-empty-list<string>', explode($s, 'FOO'));
}
}
14 changes: 0 additions & 14 deletions tests/PHPStan/Analyser/nsrt/lowercase-string-implode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,7 @@

namespace LowercaseStringImplode;

use function htmlspecialchars;
use function lcfirst;
use function PHPStan\Testing\assertType;
use function strtolower;
use function strtoupper;
use function ucfirst;

class ExplodingStrings
{
public function doFoo(string $s): void
{
assertType('non-empty-list<lowercase-string>', explode($s, 'foo'));
assertType('non-empty-list<string>', explode($s, 'FOO'));
}
}

class ImplodingStrings
{
Expand Down

0 comments on commit 62ef6dd

Please sign in to comment.