Merge branch '4.4'
* 4.4: some backports from master Add return types to internal|final|private methods [HttpFoundation] Precalculate session expiry timestamp
This commit is contained in:
commit
4036357150
@ -109,6 +109,9 @@ HttpFoundation
|
||||
|
||||
* `ApacheRequest` is deprecated, use `Request` class instead.
|
||||
* Passing a third argument to `HeaderBag::get()` is deprecated since Symfony 4.4, use method `all()` instead
|
||||
* `PdoSessionHandler` now precalculates the expiry timestamp in the lifetime column,
|
||||
make sure to run `CREATE INDEX EXPIRY ON sessions (sess_lifetime)` to update your database
|
||||
to speed up garbage collection of expired sessions.
|
||||
|
||||
HttpKernel
|
||||
----------
|
||||
|
@ -50,12 +50,11 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
*
|
||||
* For backwards compatibility, objects are cast to strings by default.
|
||||
*
|
||||
* @return string The string representation of the object
|
||||
*
|
||||
* @internal This method is public to be usable as callback. It should not
|
||||
* be used in user code.
|
||||
*/
|
||||
public static function createChoiceLabel(object $choice)
|
||||
public static function createChoiceLabel(object $choice): string
|
||||
{
|
||||
return (string) $choice;
|
||||
}
|
||||
@ -71,12 +70,10 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
* @param string $value The choice value. Corresponds to the object's
|
||||
* ID here.
|
||||
*
|
||||
* @return string The field name
|
||||
*
|
||||
* @internal This method is public to be usable as callback. It should not
|
||||
* be used in user code.
|
||||
*/
|
||||
public static function createChoiceName(object $choice, $key, string $value)
|
||||
public static function createChoiceName(object $choice, $key, string $value): string
|
||||
{
|
||||
return str_replace('-', '_', (string) $value);
|
||||
}
|
||||
@ -86,15 +83,15 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
* For instance in ORM two query builders with an equal SQL string and
|
||||
* equal parameters are considered to be equal.
|
||||
*
|
||||
* @return array|false Array with important QueryBuilder parts or false if
|
||||
* they can't be determined
|
||||
* @return array|null Array with important QueryBuilder parts or null if
|
||||
* they can't be determined
|
||||
*
|
||||
* @internal This method is public to be usable as callback. It should not
|
||||
* be used in user code.
|
||||
*/
|
||||
public function getQueryBuilderPartsForCachingHash(QueryBuilder $queryBuilder)
|
||||
public function getQueryBuilderPartsForCachingHash(QueryBuilder $queryBuilder): ?array
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
@ -123,7 +120,7 @@ abstract class DoctrineType extends AbstractType implements ResetInterface
|
||||
// If there is no QueryBuilder we can safely cache DoctrineChoiceLoader,
|
||||
// also if concrete Type can return important QueryBuilder parts to generate
|
||||
// hash key we go for it as well
|
||||
if (!$options['query_builder'] || false !== ($qbParts = $this->getQueryBuilderPartsForCachingHash($options['query_builder']))) {
|
||||
if (!$options['query_builder'] || null !== $qbParts = $this->getQueryBuilderPartsForCachingHash($options['query_builder'])) {
|
||||
$hash = CachingFactoryDecorator::generateHash([
|
||||
$options['em'],
|
||||
$options['class'],
|
||||
|
@ -65,12 +65,10 @@ class EntityType extends DoctrineType
|
||||
* We consider two query builders with an equal SQL string and
|
||||
* equal parameters to be equal.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @internal This method is public to be usable as callback. It should not
|
||||
* be used in user code.
|
||||
*/
|
||||
public function getQueryBuilderPartsForCachingHash(QueryBuilder $queryBuilder)
|
||||
public function getQueryBuilderPartsForCachingHash(QueryBuilder $queryBuilder): ?array
|
||||
{
|
||||
return [
|
||||
$queryBuilder->getQuery()->getSQL(),
|
||||
|
@ -29,10 +29,8 @@ class LazyLoadingValueHolderGenerator extends BaseGenerator
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function generate(\ReflectionClass $originalClass, ClassGenerator $classGenerator)
|
||||
public function generate(\ReflectionClass $originalClass, ClassGenerator $classGenerator): void
|
||||
{
|
||||
parent::generate($originalClass, $classGenerator);
|
||||
|
||||
|
@ -84,19 +84,11 @@ abstract class Descriptor implements DescriptorInterface
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the output.
|
||||
*
|
||||
* @return OutputInterface The output
|
||||
*/
|
||||
protected function getOutput()
|
||||
protected function getOutput(): OutputInterface
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes content to output.
|
||||
*/
|
||||
protected function write(string $content, bool $decorated = false)
|
||||
{
|
||||
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
|
||||
@ -179,10 +171,8 @@ abstract class Descriptor implements DescriptorInterface
|
||||
* Formats a value as string.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function formatValue($value)
|
||||
protected function formatValue($value): string
|
||||
{
|
||||
if (\is_object($value)) {
|
||||
return sprintf('object(%s)', \get_class($value));
|
||||
@ -199,10 +189,8 @@ abstract class Descriptor implements DescriptorInterface
|
||||
* Formats a parameter.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function formatParameter($value)
|
||||
protected function formatParameter($value): string
|
||||
{
|
||||
if (\is_bool($value) || \is_array($value) || (null === $value)) {
|
||||
$jsonString = json_encode($value);
|
||||
@ -239,10 +227,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
return $builder->get($serviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function findDefinitionsByTag(ContainerBuilder $builder, bool $showHidden)
|
||||
protected function findDefinitionsByTag(ContainerBuilder $builder, bool $showHidden): array
|
||||
{
|
||||
$definitions = [];
|
||||
$tags = $builder->findTags();
|
||||
|
@ -198,10 +198,7 @@ class JsonDescriptor extends Descriptor
|
||||
$this->write(json_encode($data, $flags | JSON_PRETTY_PRINT)."\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
protected function getRouteData(Route $route)
|
||||
protected function getRouteData(Route $route): array
|
||||
{
|
||||
$data = [
|
||||
'path' => $route->getPath(),
|
||||
|
@ -24,7 +24,7 @@ class RedirectableCompiledUrlMatcher extends CompiledUrlMatcher implements Redir
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function redirect(string $path, string $route, string $scheme = null)
|
||||
public function redirect(string $path, string $route, string $scheme = null): array
|
||||
{
|
||||
return [
|
||||
'_controller' => 'Symfony\\Bundle\\FrameworkBundle\\Controller\\RedirectController::urlRedirectAction',
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Bundle\FrameworkBundle\Test;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Container;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
/**
|
||||
@ -41,7 +42,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isCompiled()
|
||||
public function isCompiled(): bool
|
||||
{
|
||||
return $this->getPublicContainer()->isCompiled();
|
||||
}
|
||||
@ -49,7 +50,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParameterBag()
|
||||
public function getParameterBag(): ParameterBagInterface
|
||||
{
|
||||
return $this->getPublicContainer()->getParameterBag();
|
||||
}
|
||||
@ -65,7 +66,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasParameter(string $name)
|
||||
public function hasParameter(string $name): bool
|
||||
{
|
||||
return $this->getPublicContainer()->hasParameter($name);
|
||||
}
|
||||
@ -89,7 +90,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function has($id)
|
||||
public function has($id): bool
|
||||
{
|
||||
return $this->getPublicContainer()->has($id) || $this->getPrivateContainer()->has($id);
|
||||
}
|
||||
@ -105,7 +106,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function initialized(string $id)
|
||||
public function initialized(string $id): bool
|
||||
{
|
||||
return $this->getPublicContainer()->initialized($id);
|
||||
}
|
||||
@ -121,7 +122,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getServiceIds()
|
||||
public function getServiceIds(): array
|
||||
{
|
||||
return $this->getPublicContainer()->getServiceIds();
|
||||
}
|
||||
@ -129,7 +130,7 @@ class TestContainer extends Container
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRemovedIds()
|
||||
public function getRemovedIds(): array
|
||||
{
|
||||
return $this->getPublicContainer()->getRemovedIds();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class VoteListener implements EventSubscriberInterface
|
||||
$this->traceableAccessDecisionManager->addVoterVote($event->getVoter(), $event->getAttributes(), $event->getVote());
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return ['debug.security.authorization.vote' => 'onVoterVote'];
|
||||
}
|
||||
|
@ -38,10 +38,8 @@ class ContentSecurityPolicyHandler
|
||||
* - The request - In case HTML content is fetched via AJAX and inserted in DOM, it must use the same nonce as origin
|
||||
* - The response - A call to getNonces() has already been done previously. Same nonce are returned
|
||||
* - They are otherwise randomly generated
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getNonces(Request $request, Response $response)
|
||||
public function getNonces(Request $request, Response $response): array
|
||||
{
|
||||
if ($request->headers->has('X-SymfonyProfiler-Script-Nonce') && $request->headers->has('X-SymfonyProfiler-Style-Nonce')) {
|
||||
return [
|
||||
@ -83,7 +81,7 @@ class ContentSecurityPolicyHandler
|
||||
*
|
||||
* @return array Nonces used by the bundle in Content-Security-Policy header
|
||||
*/
|
||||
public function updateResponseHeaders(Request $request, Response $response)
|
||||
public function updateResponseHeaders(Request $request, Response $response): array
|
||||
{
|
||||
if ($this->cspDisabled) {
|
||||
$this->removeCspHeaders($response);
|
||||
|
@ -50,10 +50,7 @@ class ApplicationDescription
|
||||
$this->showHidden = $showHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNamespaces()
|
||||
public function getNamespaces(): array
|
||||
{
|
||||
if (null === $this->namespaces) {
|
||||
$this->inspectApplication();
|
||||
@ -65,7 +62,7 @@ class ApplicationDescription
|
||||
/**
|
||||
* @return Command[]
|
||||
*/
|
||||
public function getCommands()
|
||||
public function getCommands(): array
|
||||
{
|
||||
if (null === $this->commands) {
|
||||
$this->inspectApplication();
|
||||
@ -75,11 +72,9 @@ class ApplicationDescription
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Command
|
||||
*
|
||||
* @throws CommandNotFoundException
|
||||
*/
|
||||
public function getCommand(string $name)
|
||||
public function getCommand(string $name): Command
|
||||
{
|
||||
if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
|
||||
throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
|
||||
|
@ -26,10 +26,7 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
*/
|
||||
class XmlDescriptor extends Descriptor
|
||||
{
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getInputDefinitionDocument(InputDefinition $definition)
|
||||
public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($definitionXML = $dom->createElement('definition'));
|
||||
@ -47,10 +44,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getCommandDocument(Command $command)
|
||||
public function getCommandDocument(Command $command): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($commandXML = $dom->createElement('command'));
|
||||
@ -80,10 +74,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getApplicationDocument(Application $application, string $namespace = null)
|
||||
public function getApplicationDocument(Application $application, string $namespace = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($rootXml = $dom->createElement('symfony'));
|
||||
|
@ -40,11 +40,9 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
/**
|
||||
* Escapes trailing "\" in given text.
|
||||
*
|
||||
* @return string Escaped text
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function escapeTrailingBackslash(string $text)
|
||||
public static function escapeTrailingBackslash(string $text): string
|
||||
{
|
||||
if ('\\' === substr($text, -1)) {
|
||||
$len = \strlen($text);
|
||||
@ -161,7 +159,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
if (!$open && !$tag) {
|
||||
// </>
|
||||
$this->styleStack->pop();
|
||||
} elseif (false === $style = $this->createStyleFromString($tag)) {
|
||||
} elseif (null === $style = $this->createStyleFromString($tag)) {
|
||||
$output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
|
||||
} elseif ($open) {
|
||||
$this->styleStack->push($style);
|
||||
@ -189,17 +187,15 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
|
||||
/**
|
||||
* Tries to create new style instance from string.
|
||||
*
|
||||
* @return OutputFormatterStyle|false False if string is not format string
|
||||
*/
|
||||
private function createStyleFromString(string $string)
|
||||
private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
|
||||
{
|
||||
if (isset($this->styles[$string])) {
|
||||
return $this->styles[$string];
|
||||
}
|
||||
|
||||
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
$style = new OutputFormatterStyle();
|
||||
@ -220,7 +216,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
$style->setOption($option);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,13 +325,11 @@ class InputDefinition
|
||||
/**
|
||||
* Returns the InputOption name given a shortcut.
|
||||
*
|
||||
* @return string The InputOption name
|
||||
*
|
||||
* @throws InvalidArgumentException When option given does not exist
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function shortcutToName(string $shortcut)
|
||||
public function shortcutToName(string $shortcut): string
|
||||
{
|
||||
if (!isset($this->shortcuts[$shortcut])) {
|
||||
throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
|
@ -157,13 +157,9 @@ class OutputFormatterTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tag
|
||||
* @param string|null $expected
|
||||
* @param string|null $input
|
||||
*
|
||||
* @dataProvider provideInlineStyleOptionsCases
|
||||
*/
|
||||
public function testInlineStyleOptions($tag, $expected = null, $input = null)
|
||||
public function testInlineStyleOptions(string $tag, string $expected = null, string $input = null)
|
||||
{
|
||||
$styleString = substr($tag, 1, -1);
|
||||
$formatter = new OutputFormatter(true);
|
||||
@ -171,7 +167,7 @@ class OutputFormatterTest extends TestCase
|
||||
$method->setAccessible(true);
|
||||
$result = $method->invoke($formatter, $styleString);
|
||||
if (null === $expected) {
|
||||
$this->assertFalse($result);
|
||||
$this->assertNull($result);
|
||||
$expected = $tag.$input.'</'.$styleString.'>';
|
||||
$this->assertSame($expected, $formatter->format($expected));
|
||||
} else {
|
||||
|
@ -32,18 +32,12 @@ class ElementNode extends AbstractNode
|
||||
$this->element = $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getNamespace()
|
||||
public function getNamespace(): ?string
|
||||
{
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getElement()
|
||||
public function getElement(): ?string
|
||||
{
|
||||
return $this->element;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class FunctionNode extends AbstractNode
|
||||
/**
|
||||
* @return Token[]
|
||||
*/
|
||||
public function getArguments()
|
||||
public function getArguments(): array
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
|
@ -32,18 +32,12 @@ class NegationNode extends AbstractNode
|
||||
$this->subSelector = $subSelector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NodeInterface
|
||||
*/
|
||||
public function getSelector()
|
||||
public function getSelector(): NodeInterface
|
||||
{
|
||||
return $this->selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return NodeInterface
|
||||
*/
|
||||
public function getSubSelector()
|
||||
public function getSubSelector(): NodeInterface
|
||||
{
|
||||
return $this->subSelector;
|
||||
}
|
||||
|
@ -76,11 +76,9 @@ class TokenStream
|
||||
/**
|
||||
* Returns next token.
|
||||
*
|
||||
* @return Token
|
||||
*
|
||||
* @throws InternalErrorException If there is no more token
|
||||
*/
|
||||
public function getNext()
|
||||
public function getNext(): Token
|
||||
{
|
||||
if ($this->peeking) {
|
||||
$this->peeking = false;
|
||||
@ -98,10 +96,8 @@ class TokenStream
|
||||
|
||||
/**
|
||||
* Returns peeked token.
|
||||
*
|
||||
* @return Token
|
||||
*/
|
||||
public function getPeek()
|
||||
public function getPeek(): Token
|
||||
{
|
||||
if (!$this->peeking) {
|
||||
$this->peeked = $this->getNext();
|
||||
@ -116,7 +112,7 @@ class TokenStream
|
||||
*
|
||||
* @return Token[]
|
||||
*/
|
||||
public function getUsed()
|
||||
public function getUsed(): array
|
||||
{
|
||||
return $this->used;
|
||||
}
|
||||
@ -128,7 +124,7 @@ class TokenStream
|
||||
*
|
||||
* @throws SyntaxErrorException If next token is not an identifier
|
||||
*/
|
||||
public function getNextIdentifier()
|
||||
public function getNextIdentifier(): string
|
||||
{
|
||||
$next = $this->getNext();
|
||||
|
||||
@ -146,7 +142,7 @@ class TokenStream
|
||||
*
|
||||
* @throws SyntaxErrorException If next token is not an identifier or a star delimiter
|
||||
*/
|
||||
public function getNextIdentifierOrStar()
|
||||
public function getNextIdentifierOrStar(): ?string
|
||||
{
|
||||
$next = $this->getNext();
|
||||
|
||||
|
@ -50,10 +50,8 @@ class Tokenizer
|
||||
|
||||
/**
|
||||
* Tokenize selector source code.
|
||||
*
|
||||
* @return TokenStream
|
||||
*/
|
||||
public function tokenize(Reader $reader)
|
||||
public function tokenize(Reader $reader): TokenStream
|
||||
{
|
||||
$stream = new TokenStream();
|
||||
|
||||
|
@ -26,7 +26,7 @@ abstract class AbstractExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNodeTranslators()
|
||||
public function getNodeTranslators(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@ -34,7 +34,7 @@ abstract class AbstractExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCombinationTranslators()
|
||||
public function getCombinationTranslators(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@ -42,7 +42,7 @@ abstract class AbstractExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctionTranslators()
|
||||
public function getFunctionTranslators(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@ -50,7 +50,7 @@ abstract class AbstractExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPseudoClassTranslators()
|
||||
public function getPseudoClassTranslators(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@ -58,7 +58,7 @@ abstract class AbstractExtension implements ExtensionInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAttributeMatchingTranslators()
|
||||
public function getAttributeMatchingTranslators(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAttributeMatchingTranslators()
|
||||
public function getAttributeMatchingTranslators(): array
|
||||
{
|
||||
return [
|
||||
'exists' => [$this, 'translateExists'],
|
||||
@ -112,7 +112,7 @@ class AttributeMatchingExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'attribute-matching';
|
||||
}
|
||||
|
@ -43,18 +43,12 @@ class CombinationExtension extends AbstractExtension
|
||||
return $xpath->join('/descendant-or-self::*/', $combinedXpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateChild(XPathExpr $xpath, XPathExpr $combinedXpath)
|
||||
public function translateChild(XPathExpr $xpath, XPathExpr $combinedXpath): XPathExpr
|
||||
{
|
||||
return $xpath->join('/', $combinedXpath);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateDirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath)
|
||||
public function translateDirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->join('/following-sibling::', $combinedXpath)
|
||||
@ -62,10 +56,7 @@ class CombinationExtension extends AbstractExtension
|
||||
->addCondition('position() = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateIndirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath)
|
||||
public function translateIndirectAdjacent(XPathExpr $xpath, XPathExpr $combinedXpath): XPathExpr
|
||||
{
|
||||
return $xpath->join('/following-sibling::', $combinedXpath);
|
||||
}
|
||||
@ -73,7 +64,7 @@ class CombinationExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'combination';
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class FunctionExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctionTranslators()
|
||||
public function getFunctionTranslators(): array
|
||||
{
|
||||
return [
|
||||
'nth-child' => [$this, 'translateNthChild'],
|
||||
@ -164,7 +164,7 @@ class FunctionExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'function';
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class HtmlExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPseudoClassTranslators()
|
||||
public function getPseudoClassTranslators(): array
|
||||
{
|
||||
return [
|
||||
'checked' => [$this, 'translateChecked'],
|
||||
@ -56,17 +56,14 @@ class HtmlExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFunctionTranslators()
|
||||
public function getFunctionTranslators(): array
|
||||
{
|
||||
return [
|
||||
'lang' => [$this, 'translateLang'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateChecked(XPathExpr $xpath)
|
||||
public function translateChecked(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition(
|
||||
'(@checked '
|
||||
@ -75,18 +72,12 @@ class HtmlExtension extends AbstractExtension
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateLink(XPathExpr $xpath)
|
||||
public function translateLink(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition("@href and (name(.) = 'a' or name(.) = 'link' or name(.) = 'area')");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateDisabled(XPathExpr $xpath)
|
||||
public function translateDisabled(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition(
|
||||
'('
|
||||
@ -112,10 +103,7 @@ class HtmlExtension extends AbstractExtension
|
||||
// todo: in the second half, add "and is not a descendant of that fieldset element's first legend element child, if any."
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateEnabled(XPathExpr $xpath)
|
||||
public function translateEnabled(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition(
|
||||
'('
|
||||
@ -149,11 +137,9 @@ class HtmlExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateLang(XPathExpr $xpath, FunctionNode $function)
|
||||
public function translateLang(XPathExpr $xpath, FunctionNode $function): XPathExpr
|
||||
{
|
||||
$arguments = $function->getArguments();
|
||||
foreach ($arguments as $token) {
|
||||
@ -171,34 +157,22 @@ class HtmlExtension extends AbstractExtension
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateSelected(XPathExpr $xpath)
|
||||
public function translateSelected(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition("(@selected and name(.) = 'option')");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateInvalid(XPathExpr $xpath)
|
||||
public function translateInvalid(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('0');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateHover(XPathExpr $xpath)
|
||||
public function translateHover(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('0');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateVisited(XPathExpr $xpath)
|
||||
public function translateVisited(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('0');
|
||||
}
|
||||
@ -206,7 +180,7 @@ class HtmlExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'html';
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ class NodeExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNodeTranslators()
|
||||
public function getNodeTranslators(): array
|
||||
{
|
||||
return [
|
||||
'Selector' => [$this, 'translateSelector'],
|
||||
@ -185,7 +185,7 @@ class NodeExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'node';
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPseudoClassTranslators()
|
||||
public function getPseudoClassTranslators(): array
|
||||
{
|
||||
return [
|
||||
'root' => [$this, 'translateRoot'],
|
||||
@ -43,18 +43,12 @@ class PseudoClassExtension extends AbstractExtension
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateRoot(XPathExpr $xpath)
|
||||
public function translateRoot(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('not(parent::*)');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateFirstChild(XPathExpr $xpath)
|
||||
public function translateFirstChild(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->addStarPrefix()
|
||||
@ -62,10 +56,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
->addCondition('position() = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateLastChild(XPathExpr $xpath)
|
||||
public function translateLastChild(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->addStarPrefix()
|
||||
@ -74,11 +65,9 @@ class PseudoClassExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateFirstOfType(XPathExpr $xpath)
|
||||
public function translateFirstOfType(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
if ('*' === $xpath->getElement()) {
|
||||
throw new ExpressionErrorException('"*:first-of-type" is not implemented.');
|
||||
@ -90,11 +79,9 @@ class PseudoClassExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateLastOfType(XPathExpr $xpath)
|
||||
public function translateLastOfType(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
if ('*' === $xpath->getElement()) {
|
||||
throw new ExpressionErrorException('"*:last-of-type" is not implemented.');
|
||||
@ -105,10 +92,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
->addCondition('position() = last()');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateOnlyChild(XPathExpr $xpath)
|
||||
public function translateOnlyChild(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath
|
||||
->addStarPrefix()
|
||||
@ -117,11 +101,9 @@ class PseudoClassExtension extends AbstractExtension
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*
|
||||
* @throws ExpressionErrorException
|
||||
*/
|
||||
public function translateOnlyOfType(XPathExpr $xpath)
|
||||
public function translateOnlyOfType(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
if ('*' === $xpath->getElement()) {
|
||||
throw new ExpressionErrorException('"*:only-of-type" is not implemented.');
|
||||
@ -130,10 +112,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
return $xpath->addCondition('last() = 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return XPathExpr
|
||||
*/
|
||||
public function translateEmpty(XPathExpr $xpath)
|
||||
public function translateEmpty(XPathExpr $xpath): XPathExpr
|
||||
{
|
||||
return $xpath->addCondition('not(*) and not(string-length())');
|
||||
}
|
||||
@ -141,7 +120,7 @@ class PseudoClassExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'pseudo-class';
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ class Translator implements TranslatorInterface
|
||||
/**
|
||||
* @return SelectorNode[]
|
||||
*/
|
||||
private function parseSelectors(string $css)
|
||||
private function parseSelectors(string $css): array
|
||||
{
|
||||
foreach ($this->shortcutParsers as $shortcut) {
|
||||
$tokens = $shortcut->parse($css);
|
||||
|
@ -1435,11 +1435,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
/**
|
||||
* Gets removed binding ids.
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function getRemovedBindingIds()
|
||||
public function getRemovedBindingIds(): array
|
||||
{
|
||||
return $this->removedBindingIds;
|
||||
}
|
||||
@ -1464,11 +1462,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
*
|
||||
* @param mixed $value An array of conditionals to return
|
||||
*
|
||||
* @return array An array of Service conditionals
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function getServiceConditionals($value)
|
||||
public static function getServiceConditionals($value): array
|
||||
{
|
||||
$services = [];
|
||||
|
||||
@ -1488,11 +1484,9 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
*
|
||||
* @param mixed $value An array of conditionals to return
|
||||
*
|
||||
* @return array An array of uninitialized conditionals
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function getInitializedConditionals($value)
|
||||
public static function getInitializedConditionals($value): array
|
||||
{
|
||||
$services = [];
|
||||
|
||||
|
@ -21,7 +21,7 @@ class ProxyHelper
|
||||
/**
|
||||
* @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context
|
||||
*/
|
||||
public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false)
|
||||
public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false): ?string
|
||||
{
|
||||
if ($p instanceof \ReflectionParameter) {
|
||||
$type = $p->getType();
|
||||
|
@ -19,7 +19,7 @@ class CustomExpressionLanguageFunctionTest extends TestCase
|
||||
->setArguments([new Expression('custom_func("foobar")')]);
|
||||
|
||||
$container->addExpressionLanguageProvider(new class() implements ExpressionFunctionProviderInterface {
|
||||
public function getFunctions()
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
ExpressionFunction::fromPhp('strtolower', 'custom_func'),
|
||||
|
@ -196,7 +196,7 @@ class RegisterServiceSubscribersPassTest extends TestCase
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
$subscriber = new class() implements ServiceSubscriberInterface {
|
||||
public static function getSubscribedServices()
|
||||
public static function getSubscribedServices(): array
|
||||
{
|
||||
return [
|
||||
'some.service' => 'stdClass',
|
||||
|
@ -314,7 +314,7 @@ class ContainerTest extends TestCase
|
||||
$c->set('bar', $bar = new class() implements ResetInterface {
|
||||
public $resetCounter = 0;
|
||||
|
||||
public function reset()
|
||||
public function reset(): void
|
||||
{
|
||||
++$this->resetCounter;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ class FormFieldRegistry
|
||||
*
|
||||
* @return bool Whether the form has the given field
|
||||
*/
|
||||
public function has(string $name)
|
||||
public function has(string $name): bool
|
||||
{
|
||||
try {
|
||||
$this->get($name);
|
||||
@ -128,7 +128,7 @@ class FormFieldRegistry
|
||||
*
|
||||
* @return FormField[] The list of fields as [string] Fully qualified name => (mixed) value)
|
||||
*/
|
||||
public function all()
|
||||
public function all(): array
|
||||
{
|
||||
return $this->walk($this->fields, $this->base);
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class ExtractingEventDispatcher extends EventDispatcher implements EventSubscrib
|
||||
$this->listeners[] = [$eventName, $listener[1], $priority];
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
$events = [];
|
||||
|
||||
|
@ -82,10 +82,8 @@ class TokenStream
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExpression()
|
||||
public function getExpression(): string
|
||||
{
|
||||
return $this->expression;
|
||||
}
|
||||
|
@ -41,14 +41,13 @@ class CachingFactoryDecorator implements ChoiceListFactoryInterface, ResetInterf
|
||||
* Optionally, a namespace string can be passed. Calling this method will
|
||||
* the same values, but different namespaces, will return different hashes.
|
||||
*
|
||||
* @param mixed $value The value to hash
|
||||
* @param string $namespace Optional. The namespace
|
||||
* @param mixed $value The value to hash
|
||||
*
|
||||
* @return string The SHA-256 hash
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function generateHash($value, $namespace = '')
|
||||
public static function generateHash($value, string $namespace = ''): string
|
||||
{
|
||||
if (\is_object($value)) {
|
||||
$value = spl_object_hash($value);
|
||||
|
@ -79,7 +79,7 @@ class OptionsResolverWrapper extends OptionsResolver
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function resolve(array $options = [])
|
||||
public function resolve(array $options = []): array
|
||||
{
|
||||
throw new AccessException('Resolve options is not supported.');
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ class CurlHttpClientTest extends HttpClientTestCase
|
||||
$logger = new class() extends AbstractLogger {
|
||||
public $logs = [];
|
||||
|
||||
public function log($level, $message, array $context = [])
|
||||
public function log($level, $message, array $context = []): void
|
||||
{
|
||||
$this->logs[] = $message;
|
||||
}
|
||||
|
@ -17,7 +17,10 @@ CHANGELOG
|
||||
* passing arguments to `Request::isMethodSafe()` is deprecated.
|
||||
* `ApacheRequest` is deprecated, use the `Request` class instead.
|
||||
* passing a third argument to `HeaderBag::get()` is deprecated, use method `all()` instead
|
||||
|
||||
* `PdoSessionHandler` now precalculates the expiry timestamp in the lifetime column,
|
||||
make sure to run `CREATE INDEX EXPIRY ON sessions (sess_lifetime)` to update your database
|
||||
to speed up garbage collection of expired sessions.
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
||||
|
@ -147,11 +147,9 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function isEmpty()
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
if ($this->isStarted()) {
|
||||
++$this->usageIndex;
|
||||
|
@ -65,6 +65,8 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
const LOCK_TRANSACTIONAL = 2;
|
||||
|
||||
private const MAX_LIFETIME = 315576000;
|
||||
|
||||
/**
|
||||
* @var \PDO|null PDO instance or null when not connected yet
|
||||
*/
|
||||
@ -237,6 +239,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
|
||||
try {
|
||||
$this->pdo->exec($sql);
|
||||
$this->pdo->exec("CREATE INDEX EXPIRY ON $this->table ($this->lifetimeCol)");
|
||||
} catch (\PDOException $e) {
|
||||
$this->rollback();
|
||||
|
||||
@ -368,14 +371,14 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
*/
|
||||
public function updateTimestamp($sessionId, $data)
|
||||
{
|
||||
$maxlifetime = (int) ini_get('session.gc_maxlifetime');
|
||||
$expiry = time() + (int) ini_get('session.gc_maxlifetime');
|
||||
|
||||
try {
|
||||
$updateStmt = $this->pdo->prepare(
|
||||
"UPDATE $this->table SET $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id"
|
||||
"UPDATE $this->table SET $this->lifetimeCol = :expiry, $this->timeCol = :time WHERE $this->idCol = :id"
|
||||
);
|
||||
$updateStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
|
||||
$updateStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
|
||||
$updateStmt->bindParam(':expiry', $expiry, \PDO::PARAM_INT);
|
||||
$updateStmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
||||
$updateStmt->execute();
|
||||
} catch (\PDOException $e) {
|
||||
@ -402,14 +405,21 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
$this->gcCalled = false;
|
||||
|
||||
// delete the session records that have expired
|
||||
if ('mysql' === $this->driver) {
|
||||
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol + $this->timeCol < :time";
|
||||
} else {
|
||||
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time - $this->timeCol";
|
||||
}
|
||||
|
||||
$sql = "DELETE FROM $this->table WHERE $this->lifetimeCol < :time AND $this->lifetimeCol > :min";
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':min', self::MAX_LIFETIME, \PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
// to be removed in 6.0
|
||||
if ('mysql' === $this->driver) {
|
||||
$legacySql = "DELETE FROM $this->table WHERE $this->lifetimeCol <= :min AND $this->lifetimeCol + $this->timeCol < :time";
|
||||
} else {
|
||||
$legacySql = "DELETE FROM $this->table WHERE $this->lifetimeCol <= :min AND $this->lifetimeCol < :time - $this->timeCol";
|
||||
}
|
||||
|
||||
$stmt = $this->pdo->prepare($legacySql);
|
||||
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':min', self::MAX_LIFETIME, \PDO::PARAM_INT);
|
||||
$stmt->execute();
|
||||
}
|
||||
|
||||
@ -614,7 +624,12 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
$sessionRows = $selectStmt->fetchAll(\PDO::FETCH_NUM);
|
||||
|
||||
if ($sessionRows) {
|
||||
if ($sessionRows[0][1] + $sessionRows[0][2] < time()) {
|
||||
$expiry = (int) $sessionRows[0][1];
|
||||
if ($expiry <= self::MAX_LIFETIME) {
|
||||
$expiry += $sessionRows[0][2];
|
||||
}
|
||||
|
||||
if ($expiry < time()) {
|
||||
$this->sessionExpired = true;
|
||||
|
||||
return '';
|
||||
@ -745,6 +760,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
if (self::LOCK_TRANSACTIONAL === $this->lockMode) {
|
||||
$this->beginTransaction();
|
||||
|
||||
// selecting the time column should be removed in 6.0
|
||||
switch ($this->driver) {
|
||||
case 'mysql':
|
||||
case 'oci':
|
||||
@ -773,18 +789,18 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
$data = fopen('php://memory', 'r+');
|
||||
fwrite($data, $sessionData);
|
||||
rewind($data);
|
||||
$sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, EMPTY_BLOB(), :lifetime, :time) RETURNING $this->dataCol into :data";
|
||||
$sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, EMPTY_BLOB(), :expiry, :time) RETURNING $this->dataCol into :data";
|
||||
break;
|
||||
default:
|
||||
$data = $sessionData;
|
||||
$sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)";
|
||||
$sql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :expiry, :time)";
|
||||
break;
|
||||
}
|
||||
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
|
||||
$stmt->bindParam(':data', $data, \PDO::PARAM_LOB);
|
||||
$stmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':expiry', time() + $maxlifetime, \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
||||
|
||||
return $stmt;
|
||||
@ -800,18 +816,18 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
$data = fopen('php://memory', 'r+');
|
||||
fwrite($data, $sessionData);
|
||||
rewind($data);
|
||||
$sql = "UPDATE $this->table SET $this->dataCol = EMPTY_BLOB(), $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id RETURNING $this->dataCol into :data";
|
||||
$sql = "UPDATE $this->table SET $this->dataCol = EMPTY_BLOB(), $this->lifetimeCol = :expiry, $this->timeCol = :time WHERE $this->idCol = :id RETURNING $this->dataCol into :data";
|
||||
break;
|
||||
default:
|
||||
$data = $sessionData;
|
||||
$sql = "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :lifetime, $this->timeCol = :time WHERE $this->idCol = :id";
|
||||
$sql = "UPDATE $this->table SET $this->dataCol = :data, $this->lifetimeCol = :expiry, $this->timeCol = :time WHERE $this->idCol = :id";
|
||||
break;
|
||||
}
|
||||
|
||||
$stmt = $this->pdo->prepare($sql);
|
||||
$stmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
|
||||
$stmt->bindParam(':data', $data, \PDO::PARAM_LOB);
|
||||
$stmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':expiry', time() + $maxlifetime, \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
||||
|
||||
return $stmt;
|
||||
@ -824,7 +840,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
{
|
||||
switch (true) {
|
||||
case 'mysql' === $this->driver:
|
||||
$mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
|
||||
$mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :expiry, :time) ".
|
||||
"ON DUPLICATE KEY UPDATE $this->dataCol = VALUES($this->dataCol), $this->lifetimeCol = VALUES($this->lifetimeCol), $this->timeCol = VALUES($this->timeCol)";
|
||||
break;
|
||||
case 'sqlsrv' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '10', '>='):
|
||||
@ -835,10 +851,10 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
"WHEN MATCHED THEN UPDATE SET $this->dataCol = ?, $this->lifetimeCol = ?, $this->timeCol = ?;";
|
||||
break;
|
||||
case 'sqlite' === $this->driver:
|
||||
$mergeSql = "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time)";
|
||||
$mergeSql = "INSERT OR REPLACE INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :expiry, :time)";
|
||||
break;
|
||||
case 'pgsql' === $this->driver && version_compare($this->pdo->getAttribute(\PDO::ATTR_SERVER_VERSION), '9.5', '>='):
|
||||
$mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :lifetime, :time) ".
|
||||
$mergeSql = "INSERT INTO $this->table ($this->idCol, $this->dataCol, $this->lifetimeCol, $this->timeCol) VALUES (:id, :data, :expiry, :time) ".
|
||||
"ON CONFLICT ($this->idCol) DO UPDATE SET ($this->dataCol, $this->lifetimeCol, $this->timeCol) = (EXCLUDED.$this->dataCol, EXCLUDED.$this->lifetimeCol, EXCLUDED.$this->timeCol)";
|
||||
break;
|
||||
default:
|
||||
@ -852,15 +868,15 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
$mergeStmt->bindParam(1, $sessionId, \PDO::PARAM_STR);
|
||||
$mergeStmt->bindParam(2, $sessionId, \PDO::PARAM_STR);
|
||||
$mergeStmt->bindParam(3, $data, \PDO::PARAM_LOB);
|
||||
$mergeStmt->bindParam(4, $maxlifetime, \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(5, time(), \PDO::PARAM_INT);
|
||||
$mergeStmt->bindParam(6, $data, \PDO::PARAM_LOB);
|
||||
$mergeStmt->bindParam(7, $maxlifetime, \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(8, time(), \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(4, time() + $maxlifetime, \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(4, time(), \PDO::PARAM_INT);
|
||||
$mergeStmt->bindParam(5, $data, \PDO::PARAM_LOB);
|
||||
$mergeStmt->bindValue(6, time() + $maxlifetime, \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(6, time(), \PDO::PARAM_INT);
|
||||
} else {
|
||||
$mergeStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR);
|
||||
$mergeStmt->bindParam(':data', $data, \PDO::PARAM_LOB);
|
||||
$mergeStmt->bindParam(':lifetime', $maxlifetime, \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(':expiry', time() + $maxlifetime, \PDO::PARAM_INT);
|
||||
$mergeStmt->bindValue(':time', time(), \PDO::PARAM_INT);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
|
||||
|
||||
/**
|
||||
@ -32,7 +33,7 @@ class SessionListener extends AbstractSessionListener
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
protected function getSession()
|
||||
protected function getSession(): ?SessionInterface
|
||||
{
|
||||
if (!$this->container->has('session')) {
|
||||
return null;
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\HttpKernel\EventListener;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||
|
||||
/**
|
||||
* Sets the session in the request.
|
||||
@ -30,7 +31,7 @@ class TestSessionListener extends AbstractTestSessionListener
|
||||
parent::__construct($sessionOptions);
|
||||
}
|
||||
|
||||
protected function getSession()
|
||||
protected function getSession(): ?SessionInterface
|
||||
{
|
||||
if (!$this->container->has('session')) {
|
||||
return null;
|
||||
|
@ -56,7 +56,7 @@ final class HttpClientKernel implements HttpKernelInterface
|
||||
$response = new Response($response->getContent(!$catch), $response->getStatusCode(), $response->getHeaders(!$catch));
|
||||
|
||||
$response->headers = new class($response->headers->all()) extends ResponseHeaderBag {
|
||||
protected function computeCacheControlValue()
|
||||
protected function computeCacheControlValue(): string
|
||||
{
|
||||
return $this->getCacheControlHeader(); // preserve the original value
|
||||
}
|
||||
|
@ -109,14 +109,10 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
*
|
||||
* Exceptions are not caught.
|
||||
*
|
||||
* @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*
|
||||
* @throws \LogicException If one of the listener does not behave as expected
|
||||
* @throws NotFoundHttpException When controller cannot be found
|
||||
*/
|
||||
private function handleRaw(Request $request, int $type = self::MASTER_REQUEST)
|
||||
private function handleRaw(Request $request, int $type = self::MASTER_REQUEST): Response
|
||||
{
|
||||
$this->requestStack->push($request);
|
||||
|
||||
@ -173,8 +169,6 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
/**
|
||||
* Filters a response object.
|
||||
*
|
||||
* @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
|
||||
*
|
||||
* @throws \RuntimeException if the passed object is not a Response instance
|
||||
*/
|
||||
private function filterResponse(Response $response, Request $request, int $type): Response
|
||||
@ -204,8 +198,6 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface
|
||||
/**
|
||||
* Handles an exception by trying to convert it to a Response.
|
||||
*
|
||||
* @param int $type The type of the request (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function handleException(\Exception $e, Request $request, int $type): Response
|
||||
|
@ -93,24 +93,15 @@ abstract class AbstractDataGenerator
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
abstract protected function scanLocales(LocaleScanner $scanner, string $sourceDir);
|
||||
abstract protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array;
|
||||
|
||||
abstract protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir);
|
||||
|
||||
abstract protected function preGenerate();
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale);
|
||||
abstract protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array;
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir);
|
||||
abstract protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array;
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
abstract protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir);
|
||||
abstract protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
|
||||
{
|
||||
return $scanner->scanLocales($sourceDir.'/curr');
|
||||
}
|
||||
@ -76,7 +76,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
|
||||
{
|
||||
$localeBundle = $reader->read($tempDir, $displayLocale);
|
||||
|
||||
@ -97,7 +97,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
|
||||
@ -110,7 +110,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
$supplementalDataBundle = $reader->read($tempDir, 'supplementalData');
|
||||
|
@ -49,7 +49,7 @@ class GeneratorConfig
|
||||
*
|
||||
* @return BundleWriterInterface[]
|
||||
*/
|
||||
public function getBundleWriters()
|
||||
public function getBundleWriters(): array
|
||||
{
|
||||
return $this->bundleWriters;
|
||||
}
|
||||
@ -60,7 +60,7 @@ class GeneratorConfig
|
||||
*
|
||||
* @return string An absolute path to a directory
|
||||
*/
|
||||
public function getSourceDir()
|
||||
public function getSourceDir(): string
|
||||
{
|
||||
return $this->sourceDir;
|
||||
}
|
||||
@ -70,7 +70,7 @@ class GeneratorConfig
|
||||
*
|
||||
* @return string The ICU version string
|
||||
*/
|
||||
public function getIcuVersion()
|
||||
public function getIcuVersion(): string
|
||||
{
|
||||
return $this->icuVersion;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
|
||||
{
|
||||
return $scanner->scanLocales($sourceDir.'/lang');
|
||||
}
|
||||
@ -126,7 +126,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
|
||||
{
|
||||
$localeBundle = $reader->read($tempDir, $displayLocale);
|
||||
|
||||
@ -148,14 +148,14 @@ class LanguageDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
$metadataBundle = $reader->read($tempDir, 'metadata');
|
||||
|
@ -36,7 +36,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
|
||||
{
|
||||
$this->locales = $scanner->scanLocales($sourceDir.'/locales');
|
||||
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
|
||||
@ -74,7 +74,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
|
||||
{
|
||||
// Don't generate aliases, as they are resolved during runtime
|
||||
// Unless an alias is needed as fallback for de-duplication purposes
|
||||
@ -133,14 +133,14 @@ class LocaleDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
return [
|
||||
'Locales' => $this->locales,
|
||||
|
@ -84,7 +84,7 @@ class RegionDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
|
||||
{
|
||||
return $scanner->scanLocales($sourceDir.'/region');
|
||||
}
|
||||
@ -109,7 +109,7 @@ class RegionDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
|
||||
{
|
||||
$localeBundle = $reader->read($tempDir, $displayLocale);
|
||||
|
||||
@ -131,14 +131,14 @@ class RegionDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
$metadataBundle = $reader->read($tempDir, 'metadata');
|
||||
|
@ -38,7 +38,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
|
||||
{
|
||||
return $scanner->scanLocales($sourceDir.'/lang');
|
||||
}
|
||||
@ -62,7 +62,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
|
||||
{
|
||||
$localeBundle = $reader->read($tempDir, $displayLocale);
|
||||
|
||||
@ -84,14 +84,14 @@ class ScriptDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
|
||||
|
@ -42,7 +42,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir)
|
||||
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
|
||||
{
|
||||
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
|
||||
|
||||
@ -75,7 +75,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale)
|
||||
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
|
||||
{
|
||||
if (!$this->zoneToCountryMapping) {
|
||||
$this->zoneToCountryMapping = self::generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones'));
|
||||
@ -126,7 +126,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
|
||||
@ -139,7 +139,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir)
|
||||
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
|
||||
{
|
||||
$rootBundle = $reader->read($tempDir, 'root');
|
||||
|
||||
|
@ -33,14 +33,12 @@ class LocaleScanner
|
||||
/**
|
||||
* Returns all locales found in the given directory.
|
||||
*
|
||||
* @param string $sourceDir The directory with ICU files
|
||||
*
|
||||
* @return array An array of locales. The result also contains locales that
|
||||
* are in fact just aliases for other locales. Use
|
||||
* {@link scanAliases()} to determine which of the locales
|
||||
* are aliases
|
||||
*/
|
||||
public function scanLocales(string $sourceDir)
|
||||
public function scanLocales(string $sourceDir): array
|
||||
{
|
||||
$locales = glob($sourceDir.'/*.txt');
|
||||
|
||||
@ -60,12 +58,10 @@ class LocaleScanner
|
||||
/**
|
||||
* Returns all locale aliases found in the given directory.
|
||||
*
|
||||
* @param string $sourceDir The directory with ICU files
|
||||
*
|
||||
* @return array An array with the locale aliases as keys and the aliased
|
||||
* locales as values
|
||||
*/
|
||||
public function scanAliases(string $sourceDir)
|
||||
public function scanAliases(string $sourceDir): array
|
||||
{
|
||||
$locales = $this->scanLocales($sourceDir);
|
||||
$aliases = [];
|
||||
|
@ -74,7 +74,7 @@ class FullTransformer
|
||||
*
|
||||
* @return string The formatted value
|
||||
*/
|
||||
public function format(\DateTime $dateTime)
|
||||
public function format(\DateTime $dateTime): string
|
||||
{
|
||||
$formatted = preg_replace_callback($this->regExp, function ($matches) use ($dateTime) {
|
||||
return $this->formatReplace($matches[0], $dateTime);
|
||||
|
@ -97,7 +97,7 @@ class TimezoneTransformer extends Transformer
|
||||
* @throws NotImplementedException When the GMT time zone have minutes offset different than zero
|
||||
* @throws \InvalidArgumentException When the value can not be matched with pattern
|
||||
*/
|
||||
public static function getEtcTimeZoneId(string $formattedTimeZone)
|
||||
public static function getEtcTimeZoneId(string $formattedTimeZone): string
|
||||
{
|
||||
if (preg_match('/GMT(?P<signal>[+-])(?P<hours>\d{2}):?(?P<minutes>\d{2})/', $formattedTimeZone, $matches)) {
|
||||
$hours = (int) $matches['hours'];
|
||||
|
@ -58,10 +58,8 @@ abstract class IntlGlobals
|
||||
* Returns whether the error code indicates a failure.
|
||||
*
|
||||
* @param int $errorCode The error code returned by IntlGlobals::getErrorCode()
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFailure(int $errorCode)
|
||||
public static function isFailure(int $errorCode): bool
|
||||
{
|
||||
return isset(self::$errorCodes[$errorCode])
|
||||
&& $errorCode > self::U_ZERO_ERROR;
|
||||
@ -83,10 +81,8 @@ abstract class IntlGlobals
|
||||
* Returns the error message of the last operation.
|
||||
*
|
||||
* Returns "U_ZERO_ERROR" if no error occurred.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getErrorMessage()
|
||||
public static function getErrorMessage(): string
|
||||
{
|
||||
return self::$errorMessage;
|
||||
}
|
||||
@ -95,10 +91,8 @@ abstract class IntlGlobals
|
||||
* Returns the symbolic name for a given error code.
|
||||
*
|
||||
* @param int $code The error code returned by IntlGlobals::getErrorCode()
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getErrorName(int $code)
|
||||
public static function getErrorName(int $code): string
|
||||
{
|
||||
return self::$errorCodes[$code] ?? '[BOGUS UErrorCode]';
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class Query extends AbstractQuery
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function getResources()
|
||||
public function getResources(): array
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class LdapUser implements UserInterface, EquatableInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPassword()
|
||||
public function getPassword(): ?string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
@ -65,14 +65,14 @@ class LdapUser implements UserInterface, EquatableInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSalt()
|
||||
public function getSalt(): ?string
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getUsername()
|
||||
public function getUsername(): string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
@ -26,11 +26,9 @@ class SemaphoreStore implements BlockingStoreInterface
|
||||
/**
|
||||
* Returns whether or not the store is supported.
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function isSupported()
|
||||
public static function isSupported(): bool
|
||||
{
|
||||
return \extension_loaded('sysvsem');
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class MessageBus implements MessageBusInterface
|
||||
$this->middlewareHandlers = $middlewareHandlers;
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
if (null === $this->cachedIterator) {
|
||||
$this->cachedIterator = new \ArrayObject(iterator_to_array($this->middlewareHandlers, false));
|
||||
|
@ -54,10 +54,8 @@ abstract class AbstractPipes implements PipesInterface
|
||||
|
||||
/**
|
||||
* Returns true if a system call has been interrupted.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasSystemCallBeenInterrupted()
|
||||
protected function hasSystemCallBeenInterrupted(): bool
|
||||
{
|
||||
$lastError = $this->lastError;
|
||||
$this->lastError = null;
|
||||
@ -92,7 +90,7 @@ abstract class AbstractPipes implements PipesInterface
|
||||
*
|
||||
* @throws InvalidArgumentException When an input iterator yields a non supported value
|
||||
*/
|
||||
protected function write()
|
||||
protected function write(): ?array
|
||||
{
|
||||
if (!isset($this->pipes[0])) {
|
||||
return null;
|
||||
|
@ -24,17 +24,15 @@ interface PipesInterface
|
||||
|
||||
/**
|
||||
* Returns an array of descriptors for the use of proc_open.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDescriptors();
|
||||
public function getDescriptors(): array;
|
||||
|
||||
/**
|
||||
* Returns an array of filenames indexed by their related stream in case these pipes use temporary files.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getFiles();
|
||||
public function getFiles(): array;
|
||||
|
||||
/**
|
||||
* Reads data in file handles and pipes.
|
||||
@ -44,21 +42,17 @@ interface PipesInterface
|
||||
*
|
||||
* @return string[] An array of read data indexed by their fd
|
||||
*/
|
||||
public function readAndWrite(bool $blocking, bool $close = false);
|
||||
public function readAndWrite(bool $blocking, bool $close = false): array;
|
||||
|
||||
/**
|
||||
* Returns if the current state has open file handles or pipes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function areOpen();
|
||||
public function areOpen(): bool;
|
||||
|
||||
/**
|
||||
* Returns if pipes are able to read output.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function haveReadSupport();
|
||||
public function haveReadSupport(): bool;
|
||||
|
||||
/**
|
||||
* Closes file handles and pipes.
|
||||
|
@ -43,7 +43,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescriptors()
|
||||
public function getDescriptors(): array
|
||||
{
|
||||
if (!$this->haveReadSupport) {
|
||||
$nullstream = fopen('/dev/null', 'c');
|
||||
@ -81,7 +81,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFiles()
|
||||
public function getFiles(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@ -89,7 +89,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readAndWrite(bool $blocking, bool $close = false)
|
||||
public function readAndWrite(bool $blocking, bool $close = false): array
|
||||
{
|
||||
$this->unblock();
|
||||
$w = $this->write();
|
||||
@ -138,7 +138,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function haveReadSupport()
|
||||
public function haveReadSupport(): bool
|
||||
{
|
||||
return $this->haveReadSupport;
|
||||
}
|
||||
@ -146,7 +146,7 @@ class UnixPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function areOpen()
|
||||
public function areOpen(): bool
|
||||
{
|
||||
return (bool) $this->pipes;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescriptors()
|
||||
public function getDescriptors(): array
|
||||
{
|
||||
if (!$this->haveReadSupport) {
|
||||
$nullstream = fopen('NUL', 'c');
|
||||
@ -118,7 +118,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFiles()
|
||||
public function getFiles(): array
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
@ -126,7 +126,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function readAndWrite(bool $blocking, bool $close = false)
|
||||
public function readAndWrite(bool $blocking, bool $close = false): array
|
||||
{
|
||||
$this->unblock();
|
||||
$w = $this->write();
|
||||
@ -161,7 +161,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function haveReadSupport()
|
||||
public function haveReadSupport(): bool
|
||||
{
|
||||
return $this->haveReadSupport;
|
||||
}
|
||||
@ -169,7 +169,7 @@ class WindowsPipes extends AbstractPipes
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function areOpen()
|
||||
public function areOpen(): bool
|
||||
{
|
||||
return $this->pipes && $this->fileHandles;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getShortDescription(string $class, string $property, array $context = [])
|
||||
public function getShortDescription(string $class, string $property, array $context = []): ?string
|
||||
{
|
||||
/** @var $docBlock DocBlock */
|
||||
list($docBlock) = $this->getDocBlock($class, $property);
|
||||
@ -101,7 +101,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLongDescription(string $class, string $property, array $context = [])
|
||||
public function getLongDescription(string $class, string $property, array $context = []): ?string
|
||||
{
|
||||
/** @var $docBlock DocBlock */
|
||||
list($docBlock) = $this->getDocBlock($class, $property);
|
||||
@ -117,7 +117,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypes(string $class, string $property, array $context = [])
|
||||
public function getTypes(string $class, string $property, array $context = []): ?array
|
||||
{
|
||||
/** @var $docBlock DocBlock */
|
||||
list($docBlock, $source, $prefix) = $this->getDocBlock($class, $property);
|
||||
|
@ -75,7 +75,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProperties(string $class, array $context = [])
|
||||
public function getProperties(string $class, array $context = []): ?array
|
||||
{
|
||||
try {
|
||||
$reflectionClass = new \ReflectionClass($class);
|
||||
@ -131,7 +131,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypes(string $class, $property, array $context = [])
|
||||
public function getTypes(string $class, $property, array $context = []): ?array
|
||||
{
|
||||
if ($fromMutator = $this->extractFromMutator($class, $property)) {
|
||||
return $fromMutator;
|
||||
@ -158,7 +158,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable(string $class, $property, array $context = []): bool
|
||||
public function isReadable(string $class, $property, array $context = []): ?bool
|
||||
{
|
||||
if ($this->isAllowedProperty($class, $property)) {
|
||||
return true;
|
||||
@ -172,7 +172,7 @@ class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTyp
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable(string $class, $property, array $context = []): bool
|
||||
public function isWritable(string $class, $property, array $context = []): ?bool
|
||||
{
|
||||
if ($this->isAllowedProperty($class, $property)) {
|
||||
return true;
|
||||
|
@ -33,7 +33,7 @@ class SerializerExtractor implements PropertyListExtractorInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProperties(string $class, array $context = [])
|
||||
public function getProperties(string $class, array $context = []): ?array
|
||||
{
|
||||
if (!isset($context['serializer_groups']) || !\is_array($context['serializer_groups'])) {
|
||||
return null;
|
||||
|
@ -35,7 +35,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable(string $class, string $property, array $context = [])
|
||||
public function isReadable(string $class, string $property, array $context = []): ?bool
|
||||
{
|
||||
return $this->extract('isReadable', [$class, $property, $context]);
|
||||
}
|
||||
@ -43,7 +43,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable(string $class, string $property, array $context = [])
|
||||
public function isWritable(string $class, string $property, array $context = []): ?bool
|
||||
{
|
||||
return $this->extract('isWritable', [$class, $property, $context]);
|
||||
}
|
||||
@ -51,7 +51,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getShortDescription(string $class, string $property, array $context = [])
|
||||
public function getShortDescription(string $class, string $property, array $context = []): ?string
|
||||
{
|
||||
return $this->extract('getShortDescription', [$class, $property, $context]);
|
||||
}
|
||||
@ -59,7 +59,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLongDescription(string $class, string $property, array $context = [])
|
||||
public function getLongDescription(string $class, string $property, array $context = []): ?string
|
||||
{
|
||||
return $this->extract('getLongDescription', [$class, $property, $context]);
|
||||
}
|
||||
@ -67,7 +67,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProperties(string $class, array $context = [])
|
||||
public function getProperties(string $class, array $context = []): ?array
|
||||
{
|
||||
return $this->extract('getProperties', [$class, $context]);
|
||||
}
|
||||
@ -75,7 +75,7 @@ class PropertyInfoCacheExtractor implements PropertyInfoExtractorInterface, Prop
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypes(string $class, string $property, array $context = [])
|
||||
public function getTypes(string $class, string $property, array $context = []): ?array
|
||||
{
|
||||
return $this->extract('getTypes', [$class, $property, $context]);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyI
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProperties(string $class, array $context = [])
|
||||
public function getProperties(string $class, array $context = []): ?array
|
||||
{
|
||||
return $this->extract($this->listExtractors, 'getProperties', [$class, $context]);
|
||||
}
|
||||
@ -53,7 +53,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyI
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getShortDescription(string $class, string $property, array $context = [])
|
||||
public function getShortDescription(string $class, string $property, array $context = []): ?string
|
||||
{
|
||||
return $this->extract($this->descriptionExtractors, 'getShortDescription', [$class, $property, $context]);
|
||||
}
|
||||
@ -61,7 +61,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyI
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLongDescription(string $class, string $property, array $context = [])
|
||||
public function getLongDescription(string $class, string $property, array $context = []): ?string
|
||||
{
|
||||
return $this->extract($this->descriptionExtractors, 'getLongDescription', [$class, $property, $context]);
|
||||
}
|
||||
@ -69,7 +69,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyI
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTypes(string $class, string $property, array $context = [])
|
||||
public function getTypes(string $class, string $property, array $context = []): ?array
|
||||
{
|
||||
return $this->extract($this->typeExtractors, 'getTypes', [$class, $property, $context]);
|
||||
}
|
||||
@ -77,7 +77,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyI
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isReadable(string $class, string $property, array $context = [])
|
||||
public function isReadable(string $class, string $property, array $context = []): ?bool
|
||||
{
|
||||
return $this->extract($this->accessExtractors, 'isReadable', [$class, $property, $context]);
|
||||
}
|
||||
@ -85,7 +85,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface, PropertyI
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isWritable(string $class, string $property, array $context = [])
|
||||
public function isWritable(string $class, string $property, array $context = []): ?bool
|
||||
{
|
||||
return $this->extract($this->accessExtractors, 'isWritable', [$class, $property, $context]);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
||||
{
|
||||
$reader = new AnnotationReader();
|
||||
$this->loader = new class($reader) extends AnnotationClassLoader {
|
||||
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
|
||||
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot): void
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -237,7 +237,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
||||
->willReturn([])
|
||||
;
|
||||
$loader = new class($reader) extends AnnotationClassLoader {
|
||||
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
|
||||
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot): void
|
||||
{
|
||||
}
|
||||
};
|
||||
@ -319,7 +319,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
||||
;
|
||||
|
||||
$loader = new class($reader) extends AnnotationClassLoader {
|
||||
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot)
|
||||
protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot): void
|
||||
{
|
||||
}
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ class TraceableAccessDecisionManager implements AccessDecisionManagerInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function decide(TokenInterface $token, array $attributes, $object = null)
|
||||
public function decide(TokenInterface $token, array $attributes, $object = null): bool
|
||||
{
|
||||
$currentDecisionLog = [
|
||||
'attributes' => $attributes,
|
||||
@ -86,7 +86,7 @@ class TraceableAccessDecisionManager implements AccessDecisionManagerInterface
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getStrategy()
|
||||
public function getStrategy(): string
|
||||
{
|
||||
// The $strategy property is misleading because it stores the name of its
|
||||
// method (e.g. 'decideAffirmative') instead of the original strategy name
|
||||
@ -97,7 +97,7 @@ class TraceableAccessDecisionManager implements AccessDecisionManagerInterface
|
||||
/**
|
||||
* @return iterable|VoterInterface[]
|
||||
*/
|
||||
public function getVoters()
|
||||
public function getVoters(): iterable
|
||||
{
|
||||
return $this->voters;
|
||||
}
|
||||
@ -105,7 +105,7 @@ class TraceableAccessDecisionManager implements AccessDecisionManagerInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDecisionLog()
|
||||
public function getDecisionLog(): array
|
||||
{
|
||||
return $this->decisionLog;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class MissingUserProvider implements UserProviderInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function loadUserByUsername(string $username)
|
||||
public function loadUserByUsername(string $username): UserInterface
|
||||
{
|
||||
throw new \BadMethodCallException();
|
||||
}
|
||||
@ -40,7 +40,7 @@ class MissingUserProvider implements UserProviderInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function refreshUser(UserInterface $user)
|
||||
public function refreshUser(UserInterface $user): UserInterface
|
||||
{
|
||||
throw new \BadMethodCallException();
|
||||
}
|
||||
@ -48,7 +48,7 @@ class MissingUserProvider implements UserProviderInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsClass(string $class)
|
||||
public function supportsClass(string $class): bool
|
||||
{
|
||||
throw new \BadMethodCallException();
|
||||
}
|
||||
|
@ -134,10 +134,7 @@ class UsernamePasswordJsonAuthenticationListener
|
||||
$event->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Response|null
|
||||
*/
|
||||
private function onSuccess(Request $request, TokenInterface $token)
|
||||
private function onSuccess(Request $request, TokenInterface $token): ?Response
|
||||
{
|
||||
if (null !== $this->logger) {
|
||||
$this->logger->info('User has been authenticated successfully.', ['username' => $token->getUsername()]);
|
||||
|
@ -66,7 +66,7 @@ class ArrayDenormalizer implements ContextAwareDenormalizerInterface, Serializer
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supportsDenormalization($data, string $type, string $format = null, array $context = [])
|
||||
public function supportsDenormalization($data, string $type, string $format = null, array $context = []): bool
|
||||
{
|
||||
return '[]' === substr($type, -2)
|
||||
&& $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context);
|
||||
|
@ -109,7 +109,7 @@ class Serializer implements SerializerInterface, ContextAwareNormalizerInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
final public function serialize($data, string $format, array $context = [])
|
||||
final public function serialize($data, string $format, array $context = []): string
|
||||
{
|
||||
if (!$this->supportsEncoding($format, $context)) {
|
||||
throw new NotEncodableValueException(sprintf('Serialization for the format %s is not supported', $format));
|
||||
|
@ -223,10 +223,7 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
private function getStdin()
|
||||
private function getStdin(): ?string
|
||||
{
|
||||
if (0 !== ftell(STDIN)) {
|
||||
return null;
|
||||
|
@ -286,11 +286,9 @@ abstract class Constraint
|
||||
/**
|
||||
* Optimizes the serialized value to minimize storage space.
|
||||
*
|
||||
* @return array The properties to serialize
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep()
|
||||
public function __sleep(): array
|
||||
{
|
||||
// Initialize "groups" option if it is not set
|
||||
$this->groups;
|
||||
|
@ -26,15 +26,9 @@ class DateValidator extends ConstraintValidator
|
||||
/**
|
||||
* Checks whether a date is valid.
|
||||
*
|
||||
* @param int $year The year
|
||||
* @param int $month The month
|
||||
* @param int $day The day
|
||||
*
|
||||
* @return bool Whether the date is valid
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function checkDate($year, $month, $day)
|
||||
public static function checkDate(int $year, int $month, int $day): bool
|
||||
{
|
||||
return checkdate($month, $day, $year);
|
||||
}
|
||||
|
@ -26,15 +26,9 @@ class TimeValidator extends ConstraintValidator
|
||||
/**
|
||||
* Checks whether a time is valid.
|
||||
*
|
||||
* @param int $hour The hour
|
||||
* @param int $minute The minute
|
||||
* @param int $second The second
|
||||
*
|
||||
* @return bool Whether the time is valid
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function checkTime($hour, $minute, $second)
|
||||
public static function checkTime(int $hour, int $minute, float $second): bool
|
||||
{
|
||||
return $hour >= 0 && $hour < 24 && $minute >= 0 && $minute < 60 && $second >= 0 && $second < 60;
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class RegexValidatorTest extends ConstraintValidatorTestCase
|
||||
['090909'],
|
||||
[90909],
|
||||
[new class() {
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return '090909';
|
||||
}
|
||||
@ -116,7 +116,7 @@ class RegexValidatorTest extends ConstraintValidatorTestCase
|
||||
['abcd'],
|
||||
['090foo'],
|
||||
[new class() {
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'abcd';
|
||||
}
|
||||
|
@ -199,10 +199,7 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
private function getStdin()
|
||||
private function getStdin(): ?string
|
||||
{
|
||||
if (0 !== ftell(STDIN)) {
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user