1
0
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:
Brown 2019-02-08 17:41:03 -05:00
parent f4518d59e0
commit c68209b8f3
4 changed files with 33 additions and 3 deletions

View File

@ -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) {

View File

@ -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";
}

View File

@ -1,11 +1,13 @@
<?php
namespace Foo;
namespace Vimeo\Test\DummyProject;
class Bat
{
public function __construct()
{
$a = new Bar();
someFunction();
}
}

View File

@ -192,7 +192,7 @@ class ProjectAnalyzerTest extends TestCase
$bat_replacement_contents = '<?php
namespace Foo;
namespace Vimeo\Test\DummyProject;
class Bat
{