Skip to content

Commit

Permalink
Fix errors reported by PHPStan on PHP 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Nov 22, 2020
1 parent 40c4d8e commit c3007e6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions phpstan.neon.dist
Expand Up @@ -6,6 +6,7 @@ includes:
- vendor/spaze/phpstan-disallowed-calls/extension.neon
- vendor/spaze/phpstan-disallowed-calls/disallowed-dangerous-calls.neon
- tests/PHPStan/disallowedCalls.neon
- tests/PHPStan/conditional.config.php

parameters:
level: max
Expand Down
2 changes: 1 addition & 1 deletion src/FileUploadControl/Storage/FileSystemStorageManager.php
Expand Up @@ -95,7 +95,7 @@ private function collectGarbage(): void
$currentTimestamp = $this->dateTimeProvider->getNow()->getTimestamp();
/** @var \SplFileInfo $directory */
foreach ($this->finder->findDirectoriesInDirectory($this->directory, '*' . self::NAMESPACE_DIRECTORY_SUFFIX) as $directory) {
$age = $currentTimestamp - $directory->getMTime();
$age = $currentTimestamp - (int) $directory->getMTime();
if ($age < $this->namespaceTtl) {
continue;
}
Expand Down
15 changes: 15 additions & 0 deletions tests/PHPStan/conditional.config.php
@@ -0,0 +1,15 @@
<?php
declare(strict_types = 1);

$config = [];

if (PHP_VERSION_ID < 8_00_00) {
// Change of signature in PHP 8.0
$config['parameters']['ignoreErrors'][] = [
'message' => '~Casting to int something that\'s already int~',
'path' => '../../src/FileUploadControl/Storage/FileSystemStorageManager.php',
'count' => 1,
];
}

return $config;

0 comments on commit c3007e6

Please sign in to comment.