From 25afde073a101f57e443ffc14f5e366439d9564f Mon Sep 17 00:00:00 2001 From: Bozhidar Hristov Date: Sun, 4 Jul 2021 10:14:24 +0300 Subject: [PATCH] fix psalm --- src/FileMap.php | 26 ++++++++++++++++++-------- src/Manager.php | 4 +--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/FileMap.php b/src/FileMap.php index c079f55..ae72a38 100644 --- a/src/FileMap.php +++ b/src/FileMap.php @@ -21,6 +21,16 @@ final class FileMap /** @var array */ private array $pendingFiles = []; + /** + * @param array $files + * @param array $splFiles + */ + public function __construct(array $files = [], array $splFiles = []) + { + $this->map = $files; + $this->pendingFiles = $splFiles; + } + /** * @return T|null */ @@ -46,14 +56,6 @@ public function put(File $file, SplFileInfo $fileInfo): void $this->pendingFiles[$id] = $file; } - /** - * @param T $file - */ - private function getObjectId(File $file): int - { - return spl_object_id($file); - } - /** * @param T $file * @return S @@ -84,4 +86,12 @@ public function remove(File $file): void unset($this->map[$id]); unset($this->pendingFiles[$id]); } + + /** + * @param T $file + */ + private function getObjectId(File $file): int + { + return spl_object_id($file); + } } diff --git a/src/Manager.php b/src/Manager.php index a19f473..031dcdc 100644 --- a/src/Manager.php +++ b/src/Manager.php @@ -324,9 +324,7 @@ public function getClass(): string public function clear(): void { - /** @var FileMap $map */ - $map = new FileMap(); - $this->fileMap = $map; + $this->fileMap = new FileMap(); } private function hashFile(SplFileInfo $file): string