Skip to content

Commit d919fc5

Browse files
committed
add failling test
1 parent c5479ba commit d919fc5

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,12 @@ public function testBug10924(): void
13261326
$this->analyse([__DIR__ . '/data/bug-10924.php'], []);
13271327
}
13281328

1329+
public function testBug8985(): void
1330+
{
1331+
$this->checkExplicitMixed = true;
1332+
$this->analyse([__DIR__ . '/data/bug-8985.php'], []);
1333+
}
1334+
13291335
public function testBug11430(): void
13301336
{
13311337
$this->analyse([__DIR__ . '/../../Analyser/nsrt/bug-11430.php'], []);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Bug8985;
6+
7+
class HelloWorld
8+
{
9+
/**
10+
* @return array<string, callable>
11+
*/
12+
protected function getDefaultFunctions(): array
13+
{
14+
/** @var array<string, callable> $x */
15+
$x = (new Defaults())->getFunctions();
16+
return $x;
17+
}
18+
}
19+
20+
class HelloWorld2
21+
{
22+
/**
23+
* @return array<string, callable>
24+
*/
25+
protected function getDefaultFunctions(): array
26+
{
27+
/** @var array<string, callable> */
28+
return (new Defaults())->getFunctions();
29+
}
30+
}
31+
32+
class Defaults
33+
{
34+
public function getFunctions(): mixed
35+
{
36+
return [];
37+
}
38+
}

0 commit comments

Comments
 (0)