From 306761579c78a60c86b1725b4b515ced33fbc51f Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 31 Aug 2023 19:15:36 +0200 Subject: [PATCH] Minor improvements --- src/Psalm/Config.php | 4 +--- src/Psalm/Internal/Codebase/Scanner.php | 5 +---- src/Psalm/Internal/Codebase/TaintFlowGraph.php | 7 +------ src/Psalm/Report/CodeClimateReport.php | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 96aaf46d9f4..2f3048d4f42 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -2426,9 +2426,7 @@ public function visitComposerAutoloadFiles(ProjectAnalyzer $project_analyzer, ?P // as they might be autoloadable once we require the autoloader below $codebase->classlikes->forgetMissingClassLikes(); - $this->include_collector->runAndCollect( - [$this, 'requireAutoloader'], - ); + $this->include_collector->runAndCollect($this->requireAutoloader(...)); } $this->collectPredefinedConstants(); diff --git a/src/Psalm/Internal/Codebase/Scanner.php b/src/Psalm/Internal/Codebase/Scanner.php index fca2db80919..a53a5ab8c88 100644 --- a/src/Psalm/Internal/Codebase/Scanner.php +++ b/src/Psalm/Internal/Codebase/Scanner.php @@ -301,7 +301,7 @@ private function scanFilePaths(): bool { $files_to_scan = array_filter( $this->files_to_scan, - [$this, 'shouldScan'], + $this->shouldScan(...), ); $this->files_to_scan = []; @@ -316,9 +316,6 @@ private function scanFilePaths(): bool if ($pool_size > 1) { $this->progress->debug('Forking process for scanning' . PHP_EOL); - - // Run scanning one file at a time, splitting the set of - // files up among a given number of child processes. $forked_pool_data = ProjectAnalyzer::getInstance()->pool->run( $files_to_scan, new InitScannerTask(), diff --git a/src/Psalm/Internal/Codebase/TaintFlowGraph.php b/src/Psalm/Internal/Codebase/TaintFlowGraph.php index b18b82eb161..7c5ed519bfb 100644 --- a/src/Psalm/Internal/Codebase/TaintFlowGraph.php +++ b/src/Psalm/Internal/Codebase/TaintFlowGraph.php @@ -521,12 +521,7 @@ private function getSpecializedSources(DataFlowNode $source): array return array_filter( $generated_sources, - [$this, 'doesForwardEdgeExist'], + fn ($new_source) => isset($this->forward_edges[$new_source->id]) ); } - - private function doesForwardEdgeExist(DataFlowNode $new_source): bool - { - return isset($this->forward_edges[$new_source->id]); - } } diff --git a/src/Psalm/Report/CodeClimateReport.php b/src/Psalm/Report/CodeClimateReport.php index 3cc6fd8bc5b..6bc87c8d954 100644 --- a/src/Psalm/Report/CodeClimateReport.php +++ b/src/Psalm/Report/CodeClimateReport.php @@ -26,7 +26,7 @@ public function create(): string $options = $this->pretty ? Json::PRETTY : Json::DEFAULT; $issues_data = array_map( - [$this, 'mapToNewStructure'], + $this->mapToNewStructure(...), $this->issues_data, );