Skip to content
Permalink
Browse files

Fix some templating issues in CoreGenericClasses

  • Loading branch information
muglug committed Nov 30, 2019
1 parent 9027bc6 commit c65540a3231b1d0188b98498d6945525e8438a86
@@ -352,7 +352,7 @@ public function ksort() { }
/**
* 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 @@ public function uasort($cmp_function) { }
/**
* 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
@@ -1197,7 +1197,11 @@ private function registerClassLike(PhpParser\Node\Stmt\ClassLike $node)
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;
@@ -437,7 +437,7 @@ public function queueClassLikesForScanning(
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,14 +479,16 @@ public function queueClassLikesForScanning(
}
if ($this instanceof TClassString && $this->as !== 'object') {
$codebase->scanner->queueClassLikeForScanning(
$this->as,
$file_storage ? $file_storage->file_path : null,
false,
!$this->from_docblock
);
if ($file_storage) {
$file_storage->referenced_classlikes[strtolower($this->as)] = $this->as;
if (!isset($phantom_classes[$this->as]) && !isset($phantom_classes[strtolower($this->as)])) {
$codebase->scanner->queueClassLikeForScanning(
$this->as,
$file_storage ? $file_storage->file_path : null,
false,
!$this->from_docblock
);
if ($file_storage) {
$file_storage->referenced_classlikes[strtolower($this->as)] = $this->as;
}
}
}
@@ -10,6 +10,6 @@ class SuicidalAutoloaderTest extends TestCase
public function testSucceedsWithEmptyFile(): void
{
$this->runPsalm([], __DIR__ . '/' . '../fixtures/SuicidalAutoloader/');
$this->runPsalm(['--no-cache'], __DIR__ . '/' . '../fixtures/SuicidalAutoloader/');
}
}

0 comments on commit c65540a

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