Skip to content
Permalink
Browse files

Scan shape properties (#2359)

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

Fixes #2331
  • Loading branch information
weirdan authored and muglug committed Nov 19, 2019
1 parent 81f513b commit c50a17d4150aa284b74a4061d572f538cf6fc471
Showing with 19 additions and 0 deletions.
  1. +10 −0 src/Psalm/Type/Atomic.php
  2. +9 −0 tests/AnnotationTest.php
@@ -546,6 +546,16 @@ public function queueClassLikesForScanning(
);
}
}
if ($this instanceof ObjectLike) {
foreach ($this->properties as $property) {
$property->queueClassLikesForScanning(
$codebase,
$file_storage,
$phantom_classes
);
}
}
}
public function containsClassLike(string $fq_classlike_name) : bool
@@ -563,6 +563,15 @@ function example(string $x) : void {}',
*/
class A {}',
],
'builtInClassInAShape' => [
'<?php
/**
* @return array{d:Exception}
* @psalm-suppress InvalidReturnType
*/
function f() {}
'
],
'slashAfter?' => [
'<?php
namespace ns;

0 comments on commit c50a17d

Please sign in to comment.
You can’t perform that action at this time.