mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-03 23:24:07 +01:00
chore: Refactor upgrade subsystem
Use attributes to detect and load upgrade handlers. Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* sysPass
|
||||
@@ -88,7 +89,7 @@ class FileSystem
|
||||
* @param string $file
|
||||
* @param class-string<T>|null $class
|
||||
*
|
||||
* @return null|T
|
||||
* @return mixed|T
|
||||
* @throws FileException
|
||||
* @throws InvalidClassException
|
||||
*/
|
||||
@@ -98,13 +99,13 @@ class FileSystem
|
||||
$out = require $file;
|
||||
|
||||
if ($class && class_exists($class) && !$out instanceof $class) {
|
||||
throw new InvalidClassException(__u('Invalid class for loaded file data'));
|
||||
throw InvalidClassException::error(__u('Invalid class for loaded file data'));
|
||||
}
|
||||
|
||||
return $out;
|
||||
} else {
|
||||
throw new FileException(sprintf(__('File not found: %s'), $file));
|
||||
}
|
||||
|
||||
throw FileException::error(sprintf(__('File not found: %s'), $file));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user