🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

Commit 57ea87c

Browse files
committed
Give reason for unresolvable PHPDoc types
1 parent a0d9720 commit 57ea87c

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

tests/PHPStan/Rules/PhpDoc/IncompatiblePhpDocTypeRuleTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,15 @@ public function testBug11463b(): void
497497
$this->analyse([__DIR__ . '/data/bug-11463b.php'], []);
498498
}
499499

500+
public function testExplainUnresolvable(): void
501+
{
502+
$this->analyse([__DIR__ . '/data/explain-unresolvable-method-parameter.php'], [
503+
[
504+
'PHPDoc tag @param for parameter $a contains unresolvable type.',
505+
11,
506+
'Sealed array shapes array{foo: int} and array{bar: string} cannot be intersected. Unseal at least one of them with ... syntax. Learn more: https://phpstan.org/blog/phpstan-2-2-unsealed-array-shapes-safer-array-keys',
507+
],
508+
]);
509+
}
510+
500511
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
namespace ExplainUnresolvableMethodParameter;
4+
5+
class Foo
6+
{
7+
8+
/**
9+
* @param array{foo: int}&array{bar: string} $a
10+
*/
11+
public function doFoo(array $a): void
12+
{
13+
14+
}
15+
16+
}

0 commit comments

Comments
 (0)