Skip to content

Commit fca1268

Browse files
authored
Merge branch refs/heads/1.12.x into 2.0.x
2 parents 57519cc + f7f2be8 commit fca1268

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,4 +844,12 @@ public function testClosureBind(): void
844844
]);
845845
}
846846

847+
public function testBug10872(): void
848+
{
849+
$this->checkThisOnly = false;
850+
$this->checkExplicitMixed = true;
851+
$this->checkImplicitMixed = true;
852+
$this->analyse([__DIR__ . '/data/bug-10872.php'], []);
853+
}
854+
847855
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
namespace Bug10872;
4+
5+
class HelloWorld
6+
{
7+
/**
8+
* @return array<string, string|null>
9+
*/
10+
public function getRow(): array
11+
{
12+
return [];
13+
}
14+
15+
/**
16+
* @template ExpectedType of array<mixed>
17+
* @param ExpectedType $expected
18+
* @param array<mixed> $actual
19+
* @psalm-assert =ExpectedType $actual
20+
*/
21+
public static function assertSame(array $expected, array $actual): void
22+
{
23+
if ($actual !== $expected) {
24+
throw new \Exception();
25+
}
26+
}
27+
28+
public function testEscapeIdentifier(): void
29+
{
30+
$names = [
31+
'foo',
32+
'2',
33+
];
34+
35+
$expected = array_combine($names, array_fill(0, count($names), 'x'));
36+
37+
self::assertSame(
38+
$expected,
39+
$this->getRow()
40+
);
41+
}
42+
}

0 commit comments

Comments
 (0)