Upgrade framework

This commit is contained in:
2023-11-14 16:54:35 +01:00
parent 1648a5cd42
commit 4fcf6fffcc
10548 changed files with 693138 additions and 466698 deletions

View File

@@ -18,18 +18,16 @@ namespace Symfony\Component\Routing;
*/
class CompiledRoute implements \Serializable
{
private $variables;
private $tokens;
private $staticPrefix;
private $regex;
private $pathVariables;
private $hostVariables;
private $hostRegex;
private $hostTokens;
private array $variables;
private array $tokens;
private string $staticPrefix;
private string $regex;
private array $pathVariables;
private array $hostVariables;
private ?string $hostRegex;
private array $hostTokens;
/**
* Constructor.
*
* @param string $staticPrefix The static prefix of the compiled route
* @param string $regex The regular expression to use to match this route
* @param array $tokens An array of tokens to use to generate URL for this route
@@ -39,9 +37,9 @@ class CompiledRoute implements \Serializable
* @param array $hostVariables An array of host variables
* @param array $variables An array of variables (variables defined in the path and in the host patterns)
*/
public function __construct($staticPrefix, $regex, array $tokens, array $pathVariables, $hostRegex = null, array $hostTokens = array(), array $hostVariables = array(), array $variables = array())
public function __construct(string $staticPrefix, string $regex, array $tokens, array $pathVariables, string $hostRegex = null, array $hostTokens = [], array $hostVariables = [], array $variables = [])
{
$this->staticPrefix = (string) $staticPrefix;
$this->staticPrefix = $staticPrefix;
$this->regex = $regex;
$this->tokens = $tokens;
$this->pathVariables = $pathVariables;
@@ -51,12 +49,9 @@ class CompiledRoute implements \Serializable
$this->variables = $variables;
}
/**
* {@inheritdoc}
*/
public function serialize()
public function __serialize(): array
{
return serialize(array(
return [
'vars' => $this->variables,
'path_prefix' => $this->staticPrefix,
'path_regex' => $this->regex,
@@ -65,20 +60,19 @@ class CompiledRoute implements \Serializable
'host_regex' => $this->hostRegex,
'host_tokens' => $this->hostTokens,
'host_vars' => $this->hostVariables,
));
];
}
/**
* {@inheritdoc}
* @internal
*/
public function unserialize($serialized)
final public function serialize(): string
{
if (\PHP_VERSION_ID >= 70000) {
$data = unserialize($serialized, array('allowed_classes' => false));
} else {
$data = unserialize($serialized);
}
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
}
public function __unserialize(array $data): void
{
$this->variables = $data['vars'];
$this->staticPrefix = $data['path_prefix'];
$this->regex = $data['path_regex'];
@@ -90,81 +84,73 @@ class CompiledRoute implements \Serializable
}
/**
* Returns the static prefix.
*
* @return string The static prefix
* @internal
*/
public function getStaticPrefix()
final public function unserialize(string $serialized)
{
$this->__unserialize(unserialize($serialized, ['allowed_classes' => false]));
}
/**
* Returns the static prefix.
*/
public function getStaticPrefix(): string
{
return $this->staticPrefix;
}
/**
* Returns the regex.
*
* @return string The regex
*/
public function getRegex()
public function getRegex(): string
{
return $this->regex;
}
/**
* Returns the host regex.
*
* @return string|null The host regex or null
*/
public function getHostRegex()
public function getHostRegex(): ?string
{
return $this->hostRegex;
}
/**
* Returns the tokens.
*
* @return array The tokens
*/
public function getTokens()
public function getTokens(): array
{
return $this->tokens;
}
/**
* Returns the host tokens.
*
* @return array The tokens
*/
public function getHostTokens()
public function getHostTokens(): array
{
return $this->hostTokens;
}
/**
* Returns the variables.
*
* @return array The variables
*/
public function getVariables()
public function getVariables(): array
{
return $this->variables;
}
/**
* Returns the path variables.
*
* @return array The variables
*/
public function getPathVariables()
public function getPathVariables(): array
{
return $this->pathVariables;
}
/**
* Returns the host variables.
*
* @return array The variables
*/
public function getHostVariables()
public function getHostVariables(): array
{
return $this->hostVariables;
}