Skip to content

Commit 5ad7169

Browse files
authored
Merge branch refs/heads/1.12.x into 2.1.x
2 parents fb02c76 + 2539ab7 commit 5ad7169

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

tests/PHPStan/Rules/Methods/MethodSignatureRuleTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,4 +548,37 @@ public function testGenericStaticType(): void
548548
$this->analyse([__DIR__ . '/data/method-signature-generic-static-type.php'], []);
549549
}
550550

551+
public function testBug10240(): void
552+
{
553+
if (PHP_VERSION_ID < 80000) {
554+
$this->markTestSkipped('Test requires PHP 8.0.');
555+
}
556+
557+
$this->reportMaybes = true;
558+
$this->reportStatic = true;
559+
$this->analyse([__DIR__ . '/data/bug-10240.php'], []);
560+
}
561+
562+
public function testBug10488(): void
563+
{
564+
if (PHP_VERSION_ID < 80000) {
565+
$this->markTestSkipped('Test requires PHP 8.0.');
566+
}
567+
568+
$this->reportMaybes = true;
569+
$this->reportStatic = true;
570+
$this->analyse([__DIR__ . '/data/bug-10488.php'], []);
571+
}
572+
573+
public function testBug12073(): void
574+
{
575+
if (PHP_VERSION_ID < 80000) {
576+
$this->markTestSkipped('Test requires PHP 8.0.');
577+
}
578+
579+
$this->reportMaybes = true;
580+
$this->reportStatic = true;
581+
$this->analyse([__DIR__ . '/data/bug-12073.php'], []);
582+
}
583+
551584
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php // lint >= 8.0
2+
3+
namespace Bug10240;
4+
5+
interface MyInterface
6+
{
7+
/**
8+
* @phpstan-param truthy-string $truthyStrParam
9+
*/
10+
public function doStuff(
11+
string $truthyStrParam,
12+
): void;
13+
}
14+
15+
trait MyTrait
16+
{
17+
/**
18+
* @phpstan-param truthy-string $truthyStrParam
19+
*/
20+
abstract public function doStuff(
21+
string $truthyStrParam,
22+
): void;
23+
}
24+
25+
class MyClass implements MyInterface
26+
{
27+
use MyTrait;
28+
29+
public function doStuff(
30+
string $truthyStrParam,
31+
): void
32+
{
33+
// ...
34+
}
35+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php // lint >= 8.0
2+
3+
namespace Bug10488;
4+
5+
trait Bar
6+
{
7+
/**
8+
* @param array<string,mixed> $data
9+
*/
10+
11+
abstract protected function test(array $data): void;
12+
}
13+
14+
abstract class Foo
15+
{
16+
use Bar;
17+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug12073;
4+
5+
trait HasFieldBuildersTrait
6+
{
7+
/**
8+
* @param array<string,mixed> $field
9+
*/
10+
abstract public function field(array $field): static;
11+
}
12+
13+
class GroupBuilder
14+
{
15+
use HasFieldBuildersTrait;
16+
17+
/** @var array<string,mixed> */
18+
private array $group = [];
19+
20+
private function __construct()
21+
{
22+
}
23+
24+
/**
25+
* @param array<string,mixed> $field
26+
*/
27+
public function field(array $field): static
28+
{
29+
if (! is_array($this->group['fields'] ?? null)) {
30+
$this->group['fields'] = [];
31+
}
32+
33+
$this->group['fields'][] = $field;
34+
35+
return $this;
36+
}
37+
}

0 commit comments

Comments
 (0)