Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
179 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
|
||
namespace Bug10080; | ||
|
||
/** | ||
* @param array{ | ||
* a1?: string, | ||
* a2?: string, | ||
* a3?: string, | ||
* a4?: string, | ||
* a5?: string, | ||
* a6?: string, | ||
* a7?: string, | ||
* a8?: string, | ||
* a9?: string, | ||
* a10?: string, | ||
* a11?: string, | ||
* a12?: string, | ||
* a13?: string, | ||
* a14?: string, | ||
* a15?: string, | ||
* a16?: string, | ||
* a17?: string, | ||
* a18?: string, | ||
* a19?: string, | ||
* a20?: string, | ||
* a21?: string, | ||
* a22?: string, | ||
* a23?: string, | ||
* a24?: string, | ||
* a25?: string, | ||
* a26?: string, | ||
* a27?: string, | ||
* a28?: string, | ||
* a29?: string, | ||
* a30?: string, | ||
* a31?: string, | ||
* a32?: string, | ||
* a33?: string, | ||
* a34?: string, | ||
* a35?: string, | ||
* a36?: string, | ||
* a37?: string, | ||
* a38?: string, | ||
* a39?: string, | ||
* a40?: string, | ||
* a41?: string, | ||
* a42?: string, | ||
* a43?: string, | ||
* a44?: string, | ||
* a45?: string, | ||
* a46?: string, | ||
* a47?: string, | ||
* a48?: string, | ||
* a49?: string, | ||
* a50?: string, | ||
* a51?: string, | ||
* a52?: string, | ||
* a53?: string, | ||
* a54?: string, | ||
* a55?: string, | ||
* a56?: string, | ||
* a57?: string, | ||
* a58?: string, | ||
* a59?: string, | ||
* a60?: string, | ||
* a61?: string, | ||
* a62?: string|string[]|int|float, | ||
* a63?: string | ||
* } $row | ||
*/ | ||
function doStuff(array $row): void | ||
{ | ||
\PHPStan\Testing\assertType('string', $row['a51'] ?? ''); | ||
\PHPStan\Testing\assertType('string', $row['a51'] ?? ''); | ||
} |
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,101 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace Bug9397; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
final class Money { | ||
public static function zero(): Money { | ||
return new Money(); | ||
} | ||
} | ||
|
||
|
||
class HelloWorld | ||
{ | ||
/** | ||
* @return array<int, array{ | ||
* foo1: Money, | ||
* foo2: ?Money, | ||
* foo3: string, | ||
* foo4: string, | ||
* foo5: string, | ||
* foo6: string, | ||
* foo7: string, | ||
* foo8: string, | ||
* foo9: string, | ||
* foo10:string, | ||
* foo11:int, | ||
* foo12:int, | ||
* foo13:int, | ||
* foo14:int, | ||
* foo15:int, | ||
* foo16:int, | ||
* foo17:int, | ||
* foo18:int, | ||
* foo19:int, | ||
* foo20:int, | ||
* foo21:bool, | ||
* foo22:bool, | ||
* foo23:bool, | ||
* foo24:bool, | ||
* foo25:bool, | ||
* foo26:bool, | ||
* foo27:bool, | ||
* foo28:bool, | ||
* foo29:bool, | ||
* foo30:bool, | ||
* foo31:bool, | ||
* foo32:string, | ||
* foo33:string, | ||
* foo34:string, | ||
* foo35:string, | ||
* foo36:string, | ||
* foo37:string, | ||
* foo38:string, | ||
* foo39:string, | ||
* foo40:string, | ||
* foo41:string, | ||
* foo42:string, | ||
* foo43:string, | ||
* foo44:string, | ||
* foo45:string, | ||
* foo46:string, | ||
* foo47:string, | ||
* foo48:string, | ||
* foo49:string, | ||
* foo50:string, | ||
* foo51:string, | ||
* foo52:string, | ||
* foo53:string, | ||
* foo54:string, | ||
* foo55:string, | ||
* foo56:string, | ||
* foo57:string, | ||
* foo58:string, | ||
* foo59:string, | ||
* foo60:string, | ||
* foo61:string, | ||
* foo62:string, | ||
* foo63:string, | ||
* }> | ||
* If the above type has 63 or more properties, the bug occurs | ||
*/ | ||
private static function callable(): array { | ||
return []; | ||
} | ||
|
||
public function callsite(): void { | ||
$result = self::callable(); | ||
foreach ($result as $id => $p) { | ||
assertType(Money::class, $p['foo1']); | ||
assertType(Money::class . '|null', $p['foo2']); | ||
assertType('string', $p['foo3']); | ||
|
||
$baseDeposit = $p['foo2'] ?? Money::zero(); | ||
assertType(Money::class, $p['foo1']); | ||
assertType(Money::class . '|null', $p['foo2']); | ||
assertType('string', $p['foo3']); | ||
} | ||
} | ||
} |