migration symfony 5 4 (#300)

* symfony 5.4 (diff dev)

* symfony 5.4 (working)

* symfony 5.4 (update autoload)

* symfony 5.4 (remove swiftmailer mailer implementation)

* symfony 5.4 (php doc and split Global accessor class)


### Impacted packages:

composer require php:">=7.2.5 <8.0.0" symfony/console:5.4.* symfony/dotenv:5.4.* symfony/framework-bundle:5.4.* symfony/twig-bundle:5.4.* symfony/yaml:5.4.* --update-with-dependencies

composer require symfony/stopwatch:5.4.* symfony/web-profiler-bundle:5.4.* --dev --update-with-dependencies
This commit is contained in:
bdalsass
2022-06-16 09:13:24 +02:00
committed by GitHub
parent abb13b70b9
commit 79da71ecf8
2178 changed files with 87439 additions and 59451 deletions

View File

@@ -18,8 +18,10 @@ namespace Symfony\Component\Config\Resource;
* The resource must be a fully-qualified class name.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @final
*/
class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializable
class ClassExistenceResource implements SelfCheckingResourceInterface
{
private $resource;
private $exists;
@@ -32,26 +34,20 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
* @param string $resource The fully-qualified class name
* @param bool|null $exists Boolean when the existency check has already been done
*/
public function __construct($resource, $exists = null)
public function __construct(string $resource, bool $exists = null)
{
$this->resource = $resource;
if (null !== $exists) {
$this->exists = [(bool) $exists, null];
$this->exists = [$exists, null];
}
}
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
return $this->resource;
}
/**
* @return string The file path to the resource
*/
public function getResource()
public function getResource(): string
{
return $this->resource;
}
@@ -61,7 +57,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
*
* @throws \ReflectionException when a parent class/interface/trait is not found
*/
public function isFresh($timestamp)
public function isFresh(int $timestamp): bool
{
$loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
@@ -112,22 +108,20 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
/**
* @internal
*/
public function serialize()
public function __sleep(): array
{
if (null === $this->exists) {
$this->isFresh(0);
}
return serialize([$this->resource, $this->exists]);
return ['resource', 'exists'];
}
/**
* @internal
*/
public function unserialize($serialized)
public function __wakeup()
{
list($this->resource, $this->exists) = unserialize($serialized);
if (\is_bool($this->exists)) {
$this->exists = [$this->exists, null];
}
@@ -149,7 +143,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
*
* @internal
*/
public static function throwOnRequiredClass($class, \Exception $previous = null)
public static function throwOnRequiredClass(string $class, \Exception $previous = null)
{
// If the passed class is the resource being checked, we shouldn't throw.
if (null === $previous && self::$autoloadedClass === $class) {
@@ -219,14 +213,14 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
}
$props = [
'file' => isset($callerFrame['file']) ? $callerFrame['file'] : null,
'line' => isset($callerFrame['line']) ? $callerFrame['line'] : null,
'file' => $callerFrame['file'] ?? null,
'line' => $callerFrame['line'] ?? null,
'trace' => \array_slice($trace, 1 + $i),
];
foreach ($props as $p => $v) {
if (null !== $v) {
$r = new \ReflectionProperty('Exception', $p);
$r = new \ReflectionProperty(\Exception::class, $p);
$r->setAccessible(true);
$r->setValue($e, $v);
}