1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Scan shape properties (#2359)

This prevents crashes when built-in classes are referenced by shape
properties.

Fixes vimeo/psalm#2331
This commit is contained in:
Bruce Weirdan 2019-11-19 02:01:12 +02:00 committed by Matthew Brown
parent 81f513bb4c
commit c50a17d415
2 changed files with 19 additions and 0 deletions

View File

@ -546,6 +546,16 @@ abstract class Atomic
);
}
}
if ($this instanceof ObjectLike) {
foreach ($this->properties as $property) {
$property->queueClassLikesForScanning(
$codebase,
$file_storage,
$phantom_classes
);
}
}
}
public function containsClassLike(string $fq_classlike_name) : bool

View File

@ -563,6 +563,15 @@ class AnnotationTest extends TestCase
*/
class A {}',
],
'builtInClassInAShape' => [
'<?php
/**
* @return array{d:Exception}
* @psalm-suppress InvalidReturnType
*/
function f() {}
'
],
'slashAfter?' => [
'<?php
namespace ns;