mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix #1300 - add functions mentioned in class file where class is used
This commit is contained in:
parent
f4518d59e0
commit
c68209b8f3
@ -764,6 +764,29 @@ class Populator
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($storage->referenced_classlikes as $fq_class_name) {
|
||||
try {
|
||||
$classlike_storage = $this->classlike_storage_provider->get($fq_class_name);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$classlike_storage->location) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$included_file_storage = $this->file_storage_provider->get($classlike_storage->location->file_path);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$storage->declaring_function_ids = array_merge(
|
||||
$included_file_storage->declaring_function_ids,
|
||||
$storage->declaring_function_ids
|
||||
);
|
||||
}
|
||||
|
||||
$storage->required_file_paths = $all_required_file_paths;
|
||||
|
||||
foreach ($all_required_file_paths as $required_file_path) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
namespace Vimeo\Test\DummyProject;
|
||||
|
||||
class Bar
|
||||
{
|
||||
@ -12,3 +12,8 @@ class Bar
|
||||
$this->x = "hello";
|
||||
}
|
||||
}
|
||||
|
||||
function someFunction() : void
|
||||
{
|
||||
echo "here";
|
||||
}
|
||||
|
@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Foo;
|
||||
namespace Vimeo\Test\DummyProject;
|
||||
|
||||
class Bat
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$a = new Bar();
|
||||
|
||||
someFunction();
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class ProjectAnalyzerTest extends TestCase
|
||||
|
||||
$bat_replacement_contents = '<?php
|
||||
|
||||
namespace Foo;
|
||||
namespace Vimeo\Test\DummyProject;
|
||||
|
||||
class Bat
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user