PHPStan level 6 for more files (#5264)

7 more files passing (see phpstan-next.txt)
This commit is contained in:
Alexandre Alapetite authored and GitHub committed 2023-04-05 23:26:38 +02:00
1 parent 4f078958b5
commit 2118448133
9 files changed
+63 -50

No files matched your search

+9 -4
View File
@@ -10,6 +10,7 @@
class Minz_ModelArray {
/**
* $filename est le nom du fichier
* @var string
*/
protected $filename;
@@ -22,7 +23,8 @@ class Minz_ModelArray {
$this->filename = $filename;
}
protected function loadArray() {
/** @return array<string,mixed> */
protected function loadArray(): array {
if (!file_exists($this->filename)) {
throw new Minz_FileNotExistException($this->filename, Minz_Exception::WARNING);
} elseif (($handle = $this->getLock()) === false) {
@@ -42,8 +44,9 @@ class Minz_ModelArray {
/**
* Sauve le tableau $array dans le fichier $filename
**/
protected function writeArray($array) {
* @param array<string,mixed> $array
*/
protected function writeArray(array $array): bool {
if (file_put_contents($this->filename, "<?php\n return " . var_export($array, true) . ';', LOCK_EX) === false) {
throw new Minz_PermissionDeniedException($this->filename);
}
@@ -53,6 +56,7 @@ class Minz_ModelArray {
return true;
}
/** @return resource|false */
private function getLock() {
$handle = fopen($this->filename, 'r');
if ($handle === false) {
@@ -73,7 +77,8 @@ class Minz_ModelArray {
}
}
private function releaseLock($handle) {
/** @param resource $handle */
private function releaseLock($handle): void {
flock($handle, LOCK_UN);
fclose($handle);
}