mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
don't disable checks when includes can't be resolved
Any unresolvable include (even suppressed ones) would lead to some subsequent tests being disabled as a side-effect. this fixes #2817
This commit is contained in:
parent
35c1670602
commit
f2277ebb6d
@ -160,9 +160,6 @@ class IncludeAnalyzer
|
|||||||
$global_context
|
$global_context
|
||||||
);
|
);
|
||||||
} catch (\Psalm\Exception\UnpreparedAnalysisException $e) {
|
} catch (\Psalm\Exception\UnpreparedAnalysisException $e) {
|
||||||
$context->check_classes = false;
|
|
||||||
$context->check_variables = false;
|
|
||||||
$context->check_functions = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($include_file_analyzer->getRequiredFilePaths() as $required_file_path) {
|
foreach ($include_file_analyzer->getRequiredFilePaths() as $required_file_path) {
|
||||||
@ -203,10 +200,6 @@ class IncludeAnalyzer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$context->check_classes = false;
|
|
||||||
$context->check_variables = false;
|
|
||||||
$context->check_functions = false;
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,6 +779,25 @@ class IncludeTest extends TestCase
|
|||||||
],
|
],
|
||||||
'error_message' => 'UndefinedConstant',
|
'error_message' => 'UndefinedConstant',
|
||||||
],
|
],
|
||||||
|
'undefinedMethodAfterInvalidRequire' => [
|
||||||
|
'files' => [
|
||||||
|
getcwd() . DIRECTORY_SEPARATOR . 'file2.php' => '<?php
|
||||||
|
/** @psalm-suppress MissingFile */
|
||||||
|
require("doesnotexist.php");
|
||||||
|
require("file1.php");
|
||||||
|
|
||||||
|
foo();
|
||||||
|
bar();
|
||||||
|
',
|
||||||
|
getcwd() . DIRECTORY_SEPARATOR . 'file1.php' => '<?php
|
||||||
|
function bar(): void {}
|
||||||
|
',
|
||||||
|
],
|
||||||
|
'files_to_check' => [
|
||||||
|
getcwd() . DIRECTORY_SEPARATOR . 'file2.php',
|
||||||
|
],
|
||||||
|
'error_message' => 'UndefinedFunction',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user