1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Remove some redundant calls

This commit is contained in:
Brown 2020-08-28 12:48:33 -04:00
parent efe143a396
commit 98ce590e9d
7 changed files with 3 additions and 16 deletions

View File

@ -717,6 +717,9 @@ class FileAnalyzer extends SourceAnalyzer implements StatementsSource
return $this;
}
/**
* @psalm-mutation-free
*/
public function getProjectAnalyzer() : ProjectAnalyzer
{
return $this->project_analyzer;

View File

@ -504,8 +504,6 @@ class ForeachAnalyzer
);
if (!$context->pure) {
$statements_analyzer->getProjectAnalyzer();
if ($statements_analyzer->getSource()
instanceof \Psalm\Internal\Analyzer\FunctionLikeAnalyzer
&& $statements_analyzer->getSource()->track_mutations

View File

@ -210,8 +210,6 @@ class ConcatAnalyzer
$left_comparison_result = new \Psalm\Internal\Type\Comparator\TypeComparisonResult();
$right_comparison_result = new \Psalm\Internal\Type\Comparator\TypeComparisonResult();
$statements_analyzer->getProjectAnalyzer();
foreach ($left_type->getAtomicTypes() as $left_type_part) {
if ($left_type_part instanceof Type\Atomic\TTemplateParam) {
if (IssueBuffer::accepts(

View File

@ -1265,8 +1265,6 @@ class FunctionCallAnalyzer extends CallAnalyzer
&& !$function_storage->pure)
|| ($callmap_function_pure === false)
) {
$statements_analyzer->getProjectAnalyzer();
if ($context->mutation_free || $context->external_mutation_free) {
if (IssueBuffer::accepts(
new ImpureFunctionCall(

View File

@ -551,8 +551,6 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
if ($declaring_method_id) {
$method_storage = $codebase->methods->getStorage($declaring_method_id);
$statements_analyzer->getProjectAnalyzer();
if (!$method_storage->external_mutation_free && !$context->inside_throw) {
if ($context->pure) {
if (IssueBuffer::accepts(

View File

@ -1119,8 +1119,6 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
return true;
}
$statements_analyzer->getProjectAnalyzer();
if (!$context->inside_throw) {
if ($context->pure && !$method_storage->pure) {
if (IssueBuffer::accepts(

View File

@ -219,8 +219,6 @@ class InstancePropertyFetchAnalyzer
&& !($class_storage->external_mutation_free
&& $stmt_type->allow_mutations)
) {
$statements_analyzer->getProjectAnalyzer();
if ($context->pure) {
if (IssueBuffer::accepts(
new ImpurePropertyFetch(
@ -790,8 +788,6 @@ class InstancePropertyFetchAnalyzer
$property_id = $context->self . '::$' . $prop_name;
} else {
if ($context->inside_isset || $context->collect_initializations) {
$statements_analyzer->getProjectAnalyzer();
if ($context->pure) {
if (IssueBuffer::accepts(
new ImpurePropertyFetch(
@ -1023,8 +1019,6 @@ class InstancePropertyFetchAnalyzer
&& !($class_storage->external_mutation_free
&& $class_property_type->allow_mutations)
) {
$statements_analyzer->getProjectAnalyzer();
if ($context->pure) {
if (IssueBuffer::accepts(
new ImpurePropertyFetch(