-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
Description
Bug report
from phpstan/phpstan-src#1135 (comment)
there is a interessting test-case, I tried to add.
/**
* @param array<numeric-string&non-empty-string, string> $params1
* @param array<numeric-string, string> $params2
*/
function foo5(array $params1, array $params2): void
{
$params2 = array_merge($params1, $params2);
assertType('array<numeric-string, string>', $params2);
}it errors with
There was 1 failure:
1) PHPStan\Analyser\NodeScopeResolverTest::testFileAsserts with data set "C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\Analyser/data/bug-6927.php:61" ('type', 'C:\dvl\Workspace\phpstan-src-...27.php', PHPStan\Type\Constant\ConstantStringType Object (...), PHPStan\Type\ArrayType Object (...), 61)
Expected type array<numeric-string, string>, got type array<int, string> in C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\Analyser/data/bug-6927.php on line 61.
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'array<numeric-string, string>'
+'array<int, string>'
C:\dvl\Workspace\phpstan-src-staabm\src\Testing\TypeInferenceTestCase.php:97
C:\dvl\Workspace\phpstan-src-staabm\tests\PHPStan\Analyser\NodeScopeResolverTest.php:846Code snippet that reproduces the problem
https://phpstan.org/r/7188229f-71b8-4990-a977-5494b1e7d2ee
Expected output
no error
Metadata
Metadata
Assignees
Labels
No labels