mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
Merge pull request #6672 from orklah/phpstorm-generics
prevent phpstorm generics from touching to signature types
This commit is contained in:
commit
b8a2ba251f
@ -981,6 +981,11 @@ class Populator
|
||||
|
||||
private function convertPhpStormGenericToPsalmGeneric(Type\Union $candidate, bool $is_property = false): void
|
||||
{
|
||||
if (!$candidate->from_docblock) {
|
||||
//never convert a type that comes from a signature
|
||||
return;
|
||||
}
|
||||
|
||||
$atomic_types = $candidate->getAtomicTypes();
|
||||
|
||||
if (isset($atomic_types['array']) && count($atomic_types) > 1 && !isset($atomic_types['null'])) {
|
||||
|
@ -41,6 +41,19 @@ class AnnotationTest extends TestCase
|
||||
$this->analyzeFile('somefile.php', new Context());
|
||||
}
|
||||
|
||||
public function testPhpStormGenericsWithTypeInSignature(): void
|
||||
{
|
||||
Config::getInstance()->allow_phpstorm_generics = true;
|
||||
|
||||
$this->addFile(
|
||||
'somefile.php',
|
||||
'<?php
|
||||
function a(array|\ArrayObject $_meta = []): void {}'
|
||||
);
|
||||
|
||||
$this->analyzeFile('somefile.php', new Context());
|
||||
}
|
||||
|
||||
public function testPhpStormGenericsWithValidTraversableArgument(): void
|
||||
{
|
||||
Config::getInstance()->allow_phpstorm_generics = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user