mirror of
https://github.com/danog/psalm.git
synced 2024-12-02 09:37:59 +01:00
Fix issue where extension_loaded stopped constructor being recognised
This commit is contained in:
parent
d7f5fa29df
commit
c4551bd0df
@ -288,7 +288,6 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
|
|||||||
$stmt->inferredType = new Type\Union([new TNamedObject($fq_class_name)]);
|
$stmt->inferredType = new Type\Union([new TNamedObject($fq_class_name)]);
|
||||||
|
|
||||||
if (strtolower($fq_class_name) !== 'stdclass' &&
|
if (strtolower($fq_class_name) !== 'stdclass' &&
|
||||||
$context->check_classes &&
|
|
||||||
$codebase->classlikes->classExists($fq_class_name)
|
$codebase->classlikes->classExists($fq_class_name)
|
||||||
) {
|
) {
|
||||||
$storage = $codebase->classlike_storage_provider->get($fq_class_name);
|
$storage = $codebase->classlike_storage_provider->get($fq_class_name);
|
||||||
|
@ -387,6 +387,16 @@ class UnusedCodeTest extends TestCase
|
|||||||
|
|
||||||
(new D)->bar();'
|
(new D)->bar();'
|
||||||
],
|
],
|
||||||
|
'usedClassAfterExtensionLoaded' => [
|
||||||
|
'<?php
|
||||||
|
class A {
|
||||||
|
public function __construct() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extension_loaded("fdsfdsfd")) {
|
||||||
|
new A();
|
||||||
|
}',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user