Skip to content

Commit 7a21423

Browse files
committed
Merge remote-tracking branch 'origin/1.12.x' into 2.1.x
2 parents c4cc640 + 8a6f7e9 commit 7a21423

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

tests/PHPStan/Analyser/AnalyserIntegrationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ public function testExtendsPdoStatementCrash(): void
153153
$this->assertNoErrors($errors);
154154
}
155155

156+
public function testBug12803(): void
157+
{
158+
$errors = $this->runAnalyse(__DIR__ . '/data/bug-12803.php');
159+
$this->assertNoErrors($errors);
160+
}
161+
156162
public function testArrayDestructuringArrayDimFetch(): void
157163
{
158164
$errors = $this->runAnalyse(__DIR__ . '/data/array-destructuring-array-dim-fetch.php');
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Bug12803;
4+
5+
/** @template T */
6+
class Generic {}
7+
8+
class A
9+
{
10+
/** @param array{foo: int, bar: string} $foo */
11+
public function b(array $foo): void
12+
{
13+
/** @var Generic<object{foo: 2, bar: 1}> $a */
14+
$a = $this->c(fn() => (object) ['bar' => 1, 'foo' => 2]);
15+
$b = $this->c(fn() => (object) ['bar' => 1, 'foo' => 2]);
16+
}
17+
18+
/**
19+
* @template T
20+
* @param callable(): T $callback
21+
* @return Generic<T>
22+
*/
23+
public function c(callable $callback): Generic
24+
{
25+
return new Generic();
26+
}
27+
}

0 commit comments

Comments
 (0)