-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
array_merge lost non-empty-string keys type
- Loading branch information
Showing
4 changed files
with
121 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
namespace Bug6927; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class Foo | ||
{ | ||
/** | ||
* @param array<non-empty-string, string> $params1 | ||
* @param array<non-empty-string, string> $params2 | ||
*/ | ||
function foo1(array $params1, array $params2): void | ||
{ | ||
$params2 = array_merge($params1, $params2); | ||
|
||
assertType('array<non-empty-string, string>', $params2); | ||
} | ||
|
||
/** | ||
* @param array<non-empty-string, string> $params1 | ||
* @param array<string, string> $params2 | ||
*/ | ||
function foo2(array $params1, array $params2): void | ||
{ | ||
$params2 = array_merge($params1, $params2); | ||
|
||
assertType('array<string, string>', $params2); | ||
} | ||
|
||
/** | ||
* @param array<string, string> $params1 | ||
* @param array<non-empty-string, string> $params2 | ||
*/ | ||
function foo3(array $params1, array $params2): void | ||
{ | ||
$params2 = array_merge($params1, $params2); | ||
|
||
assertType('array<string, string>', $params2); | ||
} | ||
|
||
/** | ||
* @param array<literal-string&non-empty-string, string> $params1 | ||
* @param array<non-empty-string, string> $params2 | ||
*/ | ||
function foo4(array $params1, array $params2): void | ||
{ | ||
$params2 = array_merge($params1, $params2); | ||
|
||
assertType('array<non-empty-string, string>', $params2); | ||
} | ||
|
||
/** | ||
* @param array{return: int, stdout: string, stderr: string} $params1 | ||
* @param array{return: int, stdout?: string, stderr?: string} $params2 | ||
*/ | ||
function foo5(array $params1, array $params2): void | ||
{ | ||
$params3 = array_merge($params1, $params2); | ||
|
||
assertType('array{return: int, stdout: string, stderr: string}', $params3); | ||
} | ||
|
||
} |