diff --git a/src/Psalm/Codebase.php b/src/Psalm/Codebase.php index abd96cc75..dd7fec41c 100644 --- a/src/Psalm/Codebase.php +++ b/src/Psalm/Codebase.php @@ -496,7 +496,7 @@ class Codebase /** * @param string $file_path * - * @return array + * @return list */ public function getStatementsForFile($file_path) { diff --git a/src/Psalm/Internal/Provider/ParserCacheProvider.php b/src/Psalm/Internal/Provider/ParserCacheProvider.php index 26b657fca..ed86ecab0 100644 --- a/src/Psalm/Internal/Provider/ParserCacheProvider.php +++ b/src/Psalm/Internal/Provider/ParserCacheProvider.php @@ -68,7 +68,7 @@ class ParserCacheProvider * @param string $file_content_hash * @param string $file_path * - * @return array|null + * @return list|null * * @psalm-suppress UndefinedFunction */ @@ -96,10 +96,10 @@ class ParserCacheProvider && filemtime($cache_location) > $file_modified_time ) { if ($this->use_igbinary) { - /** @var array */ + /** @var list<\PhpParser\Node\Stmt> */ $stmts = igbinary_unserialize((string)file_get_contents($cache_location)); } else { - /** @var array */ + /** @var list<\PhpParser\Node\Stmt> */ $stmts = unserialize((string)file_get_contents($cache_location)); } @@ -110,7 +110,7 @@ class ParserCacheProvider /** * @param string $file_path * - * @return array|null + * @return list|null * * @psalm-suppress UndefinedFunction */ @@ -132,11 +132,11 @@ class ParserCacheProvider if (is_readable($cache_location)) { if ($this->use_igbinary) { - /** @var array */ + /** @var list<\PhpParser\Node\Stmt> */ return igbinary_unserialize((string)file_get_contents($cache_location)) ?: null; } - /** @var array */ + /** @var list<\PhpParser\Node\Stmt> */ return unserialize((string)file_get_contents($cache_location)) ?: null; } } @@ -211,7 +211,7 @@ class ParserCacheProvider /** * @param string $file_path * @param string $file_content_hash - * @param array $stmts + * @param list $stmts * @param bool $touch_only * * @return void diff --git a/src/Psalm/Internal/Provider/StatementsProvider.php b/src/Psalm/Internal/Provider/StatementsProvider.php index cb1276ac7..13d82178f 100644 --- a/src/Psalm/Internal/Provider/StatementsProvider.php +++ b/src/Psalm/Internal/Provider/StatementsProvider.php @@ -84,7 +84,7 @@ class StatementsProvider /** * @param string $file_path * - * @return array + * @return list<\PhpParser\Node\Stmt> */ public function getStatementsForFile($file_path, Progress $progress = null) { @@ -153,7 +153,7 @@ class StatementsProvider $traverser = new PhpParser\NodeTraverser; $traverser->addVisitor(new \Psalm\Internal\Visitor\CloningVisitor); // performs a deep clone - /** @var array */ + /** @var list */ $existing_statements_copy = $traverser->traverse($existing_statements); } else { $file_changes = null; @@ -355,10 +355,10 @@ class StatementsProvider /** * @param string $file_contents * @param string $file_path - * @param array $existing_statements + * @param list<\PhpParser\Node\Stmt> $existing_statements * @param array $file_changes * - * @return array + * @return list<\PhpParser\Node\Stmt> */ public static function parseStatements( $file_contents, @@ -400,7 +400,7 @@ class StatementsProvider $stmts = $existing_statements; } else { try { - /** @var array */ + /** @var list<\PhpParser\Node\Stmt> */ $stmts = self::$parser->parse($file_contents, $error_handler) ?: []; } catch (\Throwable $t) { $stmts = []; @@ -410,7 +410,7 @@ class StatementsProvider } } else { try { - /** @var array */ + /** @var list<\PhpParser\Node\Stmt> */ $stmts = self::$parser->parse($file_contents, $error_handler) ?: []; } catch (\Throwable $t) { $stmts = []; diff --git a/tests/FileDiffTest.php b/tests/FileDiffTest.php index 46bb64323..4b4f1451e 100644 --- a/tests/FileDiffTest.php +++ b/tests/FileDiffTest.php @@ -99,7 +99,7 @@ class FileDiffTest extends TestCase $traverser = new PhpParser\NodeTraverser; $traverser->addVisitor(new \Psalm\Internal\Visitor\CloningVisitor); // performs a deep clone - /** @var array */ + /** @var list */ $a_stmts_copy = $traverser->traverse($a_stmts); $this->assertTreesEqual($a_stmts, $a_stmts_copy); diff --git a/tests/Internal/Provider/ParserInstanceCacheProvider.php b/tests/Internal/Provider/ParserInstanceCacheProvider.php index 7a9f7bd2a..5bff37bbd 100644 --- a/tests/Internal/Provider/ParserInstanceCacheProvider.php +++ b/tests/Internal/Provider/ParserInstanceCacheProvider.php @@ -17,7 +17,7 @@ class ParserInstanceCacheProvider extends \Psalm\Internal\Provider\ParserCachePr private $file_content_hash = []; /** - * @var array> + * @var array> */ private $statements_cache = []; @@ -52,7 +52,7 @@ class ParserInstanceCacheProvider extends \Psalm\Internal\Provider\ParserCachePr * @param string $file_path * @param mixed $file_modified_time * - * @return array|null + * @return list|null */ public function loadExistingStatementsFromCache($file_path) { @@ -66,7 +66,7 @@ class ParserInstanceCacheProvider extends \Psalm\Internal\Provider\ParserCachePr /** * @param string $file_path * @param string $file_content_hash - * @param array $stmts + * @param list $stmts * @param bool $touch_only * * @return void