1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix some templating issues in CoreGenericClasses

This commit is contained in:
Matthew Brown 2019-11-30 00:27:07 -05:00
parent 9027bc6190
commit c65540a323
4 changed files with 20 additions and 14 deletions

View File

@ -352,7 +352,7 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count
/**
* Sort the entries with a user-defined comparison function and maintain key association
* @link http://php.net/manual/en/arrayobject.uasort.php
* @param callback $cmp_function <p>
* @param callable $cmp_function <p>
* Function <i>cmp_function</i> should accept two
* parameters which will be filled by pairs of entries.
* The comparison function must return an integer less than, equal
@ -367,8 +367,8 @@ class ArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Count
/**
* Sort the entries by keys using a user-defined comparison function
* @link http://php.net/manual/en/arrayobject.uksort.php
* @param callback $cmp_function <p>
* The callback comparison function.
* @param callable $cmp_function <p>
* The callable comparison function.
* </p>
* <p>
* Function <i>cmp_function</i> should accept two

View File

@ -1197,7 +1197,11 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
try {
$pseudo_property_type = Type::parseTokens($pseudo_property_type_tokens);
$pseudo_property_type->setFromDocblock();
$pseudo_property_type->queueClassLikesForScanning($this->codebase, $this->file_storage);
$pseudo_property_type->queueClassLikesForScanning(
$this->codebase,
$this->file_storage,
$storage->template_types ?: []
);
if ($property['tag'] !== 'property-read') {
$storage->pseudo_property_set_types[$property['name']] = $pseudo_property_type;

View File

@ -437,7 +437,7 @@ abstract class Atomic
array $phantom_classes = []
) {
if ($this instanceof TNamedObject) {
if (!isset($phantom_classes[strtolower($this->value)])) {
if (!isset($phantom_classes[$this->value]) && !isset($phantom_classes[strtolower($this->value)])) {
$codebase->scanner->queueClassLikeForScanning(
$this->value,
$file_storage ? $file_storage->file_path : null,
@ -479,6 +479,7 @@ abstract class Atomic
}
if ($this instanceof TClassString && $this->as !== 'object') {
if (!isset($phantom_classes[$this->as]) && !isset($phantom_classes[strtolower($this->as)])) {
$codebase->scanner->queueClassLikeForScanning(
$this->as,
$file_storage ? $file_storage->file_path : null,
@ -489,6 +490,7 @@ abstract class Atomic
$file_storage->referenced_classlikes[strtolower($this->as)] = $this->as;
}
}
}
if ($this instanceof TTemplateParam) {
$this->as->queueClassLikesForScanning(

View File

@ -10,6 +10,6 @@ class SuicidalAutoloaderTest extends TestCase
public function testSucceedsWithEmptyFile(): void
{
$this->runPsalm([], __DIR__ . '/' . '../fixtures/SuicidalAutoloader/');
$this->runPsalm(['--no-cache'], __DIR__ . '/' . '../fixtures/SuicidalAutoloader/');
}
}