mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 17:48:43 +02:00
N°6934 - Symfony 6.4 - upgrade Symfony bundles to 6.4 (#580)
* Update Symfony lib to version ~6.4.0 * Update code missing return type * Add an iTop general configuration entry to store application secret (Symfony mandatory parameter) * Use dependency injection in ExceptionListener & UserProvider classes
This commit is contained in:
@@ -23,15 +23,12 @@ use Symfony\Component\Filesystem\Filesystem;
|
||||
*/
|
||||
class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $file;
|
||||
private string $file;
|
||||
|
||||
/**
|
||||
* @var iterable<mixed, ResourceCheckerInterface>
|
||||
*/
|
||||
private $resourceCheckers;
|
||||
private iterable $resourceCheckers;
|
||||
|
||||
/**
|
||||
* @param string $file The absolute cache path
|
||||
@@ -43,10 +40,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
$this->resourceCheckers = $resourceCheckers;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPath()
|
||||
public function getPath(): string
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
@@ -59,10 +53,8 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
*
|
||||
* The first ResourceChecker that supports a given resource is considered authoritative.
|
||||
* Resources with no matching ResourceChecker will silently be ignored and considered fresh.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isFresh()
|
||||
public function isFresh(): bool
|
||||
{
|
||||
if (!is_file($this->file)) {
|
||||
return false;
|
||||
@@ -113,6 +105,8 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
* @param string $content The content to write in the cache
|
||||
* @param ResourceInterface[] $metadata An array of metadata
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \RuntimeException When cache file can't be written
|
||||
*/
|
||||
public function write(string $content, array $metadata = null)
|
||||
@@ -123,7 +117,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
$filesystem->dumpFile($this->file, $content);
|
||||
try {
|
||||
$filesystem->chmod($this->file, $mode, $umask);
|
||||
} catch (IOException $e) {
|
||||
} catch (IOException) {
|
||||
// discard chmod failure (some filesystem may not support it)
|
||||
}
|
||||
|
||||
@@ -131,12 +125,12 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
$filesystem->dumpFile($this->getMetaFile(), serialize($metadata));
|
||||
try {
|
||||
$filesystem->chmod($this->getMetaFile(), $mode, $umask);
|
||||
} catch (IOException $e) {
|
||||
} catch (IOException) {
|
||||
// discard chmod failure (some filesystem may not support it)
|
||||
}
|
||||
}
|
||||
|
||||
if (\function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOLEAN)) {
|
||||
if (\function_exists('opcache_invalidate') && filter_var(\ini_get('opcache.enable'), \FILTER_VALIDATE_BOOL)) {
|
||||
@opcache_invalidate($this->file, true);
|
||||
}
|
||||
}
|
||||
@@ -149,7 +143,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
return $this->file.'.meta';
|
||||
}
|
||||
|
||||
private function safelyUnserialize(string $file)
|
||||
private function safelyUnserialize(string $file): mixed
|
||||
{
|
||||
$meta = false;
|
||||
$content = file_get_contents($file);
|
||||
@@ -180,7 +174,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function handleUnserializeCallback(string $class)
|
||||
public static function handleUnserializeCallback(string $class): void
|
||||
{
|
||||
trigger_error('Class not found: '.$class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user