Skip to content

Commit

Permalink
add test case derived from issue vimeo#7428
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokinoue committed Sep 17, 2022
1 parent faf4e8e commit 2f87077
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/TypeReconciliation/ArrayKeyExistsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,4 +459,29 @@ class Foo {

$this->analyzeFile('somefile.php', new Context());
}

public function testAllowStaticPropertyFetchAsNeedle(): void
{
Config::getInstance()->ensure_array_int_offsets_exist = true;

$this->addFile(
'somefile.php',
'<?php
class Foo {
/** @var self::STATE_* $status */
public static int $status = self::STATE_A;
public const STATE_A = 0;
public const STATE_B = 1;
}
/** @var array<string> $bar */
$bar = [];
if (array_key_exists(Foo::$status, $bar)) {
echo $bar[Foo::$status];
}'
);

$this->analyzeFile('somefile.php', new Context());
}
}

0 comments on commit 2f87077

Please sign in to comment.