Skip to content

Commit

Permalink
fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
Warxcell committed Jul 4, 2021
1 parent 8660694 commit 25afde0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 18 additions & 8 deletions src/FileMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ final class FileMap
/** @var array<int, T> */
private array $pendingFiles = [];

/**
* @param array<int, S> $files
* @param array<int, T> $splFiles
*/
public function __construct(array $files = [], array $splFiles = [])
{
$this->map = $files;
$this->pendingFiles = $splFiles;
}

/**
* @return T|null
*/
Expand All @@ -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
Expand Down Expand Up @@ -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);
}
}
4 changes: 1 addition & 3 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,7 @@ public function getClass(): string

public function clear(): void
{
/** @var FileMap<T, \SplFileInfo> $map */
$map = new FileMap();
$this->fileMap = $map;
$this->fileMap = new FileMap();
}

private function hashFile(SplFileInfo $file): string
Expand Down

0 comments on commit 25afde0

Please sign in to comment.