feature #31996 [5.0] Add return types in final classes (dFayet)
This PR was merged into the 5.0-dev branch.
Discussion
----------
[5.0] Add return types in final classes
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no
| Tests pass? | no
| Fixed tickets | #31981
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
This is the first step for the issue #31981
I have some questions:
- ~I have not added type for methods with `@inheritdoc` annotation, should I?~
- ~Don't we want to type also functions without `@return` annotation? (still in `final` classes)~
- ~If yes is the answer of the previous one, do we also want the `void` return type?~
- ~I have also added the return type in the `DependencyInjection` PhpDumper, but is it also wanted? (if yes, I will clean a bit the code changed)~
- ~Should we update the documentation's code samples when they display `final` classes?~
Todo:
- [x] Adjust the PR, following the answers of the questions
- [x] Add return type also when there is no `@return`, or with `@inheritdoc`
- [x] [src/Symfony/Component/Debug/ErrorHandler.php#L383](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Debug/ErrorHandler.php#L383) `@return` annotation is not correct according to the return, investigate and adjust if needed
- [x] [src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php#L50](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/ControllerMetadata/ArgumentMetadataFactory.php#L50) `@return` annotation is not correct according to the return, investigate and adjust if needed
- [x] Do a PR on documentation to add return type on code snippets with final classes => unneeded as they were already typed
Commits
-------
ca5ae1989e
Replace @return annotation by return type in final classes
This commit is contained in:
commit
18793b7ca7
@ -29,7 +29,7 @@ final class TestRepositoryFactory implements RepositoryFactory
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getRepository(EntityManagerInterface $entityManager, $entityName)
|
||||
public function getRepository(EntityManagerInterface $entityManager, $entityName): ObjectRepository
|
||||
{
|
||||
$repositoryHash = $this->getRepositoryHash($entityManager, $entityName);
|
||||
|
||||
@ -47,10 +47,7 @@ final class TestRepositoryFactory implements RepositoryFactory
|
||||
$this->repositoryList[$repositoryHash] = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectRepository
|
||||
*/
|
||||
private function createRepository(EntityManagerInterface $entityManager, $entityName)
|
||||
private function createRepository(EntityManagerInterface $entityManager, $entityName): ObjectRepository
|
||||
{
|
||||
/* @var $metadata ClassMetadata */
|
||||
$metadata = $entityManager->getClassMetadata($entityName);
|
||||
@ -59,7 +56,7 @@ final class TestRepositoryFactory implements RepositoryFactory
|
||||
return new $repositoryClassName($entityManager, $metadata);
|
||||
}
|
||||
|
||||
private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName)
|
||||
private function getRepositoryHash(EntityManagerInterface $entityManager, $entityName): string
|
||||
{
|
||||
return $entityManager->getClassMetadata($entityName)->getName().spl_object_hash($entityManager);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class ChromePhpHandler extends BaseChromePhpHandler
|
||||
/**
|
||||
* Override default behavior since we check it in onKernelResponse.
|
||||
*/
|
||||
protected function headersAccepted()
|
||||
protected function headersAccepted(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class FirePHPHandler extends BaseFirePHPHandler
|
||||
/**
|
||||
* Override default behavior since we check the user agent in onKernelResponse.
|
||||
*/
|
||||
protected function headersAccepted()
|
||||
protected function headersAccepted(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class RouteProcessor implements EventSubscriberInterface, ResetInterface
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
public function __invoke(array $records)
|
||||
public function __invoke(array $records): array
|
||||
{
|
||||
if ($this->routeData && !isset($records['extra']['requests'])) {
|
||||
$records['extra']['requests'] = array_values($this->routeData);
|
||||
@ -78,7 +78,7 @@ class RouteProcessor implements EventSubscriberInterface, ResetInterface
|
||||
unset($this->routeData[$requestId]);
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => ['addRouteData', 1],
|
||||
|
@ -39,7 +39,7 @@ class WebProcessor extends BaseWebProcessor implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => ['onKernelRequest', 4096],
|
||||
|
@ -40,7 +40,7 @@ class ProxyDumper implements DumperInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isProxyCandidate(Definition $definition)
|
||||
public function isProxyCandidate(Definition $definition): bool
|
||||
{
|
||||
return ($definition->isLazy() || $definition->hasTag('proxy')) && $this->proxyGenerator->getProxifiedClass($definition);
|
||||
}
|
||||
@ -48,7 +48,7 @@ class ProxyDumper implements DumperInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null)
|
||||
public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null): string
|
||||
{
|
||||
$instantiation = 'return';
|
||||
|
||||
@ -82,7 +82,7 @@ EOF;
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProxyCode(Definition $definition)
|
||||
public function getProxyCode(Definition $definition): string
|
||||
{
|
||||
$code = $this->classGenerator->generate($this->generateProxyClass($definition));
|
||||
|
||||
|
@ -93,7 +93,7 @@ class RoutingExtension extends AbstractExtension
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function isUrlGenerationSafe(Node $argsNode)
|
||||
public function isUrlGenerationSafe(Node $argsNode): array
|
||||
{
|
||||
// support named arguments
|
||||
$paramsNode = $argsNode->hasNode('parameters') ? $argsNode->getNode('parameters') : (
|
||||
|
@ -58,7 +58,7 @@ class TranslationExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFilters()
|
||||
public function getFilters(): array
|
||||
{
|
||||
return [
|
||||
new TwigFilter('trans', [$this, 'trans']),
|
||||
@ -70,7 +70,7 @@ class TranslationExtension extends AbstractExtension
|
||||
*
|
||||
* @return AbstractTokenParser[]
|
||||
*/
|
||||
public function getTokenParsers()
|
||||
public function getTokenParsers(): array
|
||||
{
|
||||
return [
|
||||
// {% trans %}Symfony is great!{% endtrans %}
|
||||
@ -84,17 +84,17 @@ class TranslationExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getNodeVisitors()
|
||||
public function getNodeVisitors(): array
|
||||
{
|
||||
return [$this->getTranslationNodeVisitor(), new TranslationDefaultDomainNodeVisitor()];
|
||||
}
|
||||
|
||||
public function getTranslationNodeVisitor()
|
||||
public function getTranslationNodeVisitor(): TranslationNodeVisitor
|
||||
{
|
||||
return $this->translationNodeVisitor ?: $this->translationNodeVisitor = new TranslationNodeVisitor();
|
||||
}
|
||||
|
||||
public function trans($message, array $arguments = [], $domain = null, $locale = null, $count = null)
|
||||
public function trans($message, array $arguments = [], $domain = null, $locale = null, $count = null): string
|
||||
{
|
||||
if (null !== $count) {
|
||||
$arguments['%count%'] = $count;
|
||||
@ -106,7 +106,7 @@ class TranslationExtension extends AbstractExtension
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'translator';
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setSubject(string $subject)
|
||||
public function setSubject(string $subject): object
|
||||
{
|
||||
$this->message->subject($subject);
|
||||
|
||||
@ -80,7 +80,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturnPath(string $address)
|
||||
public function setReturnPath(string $address): object
|
||||
{
|
||||
$this->message->returnPath($address);
|
||||
|
||||
@ -95,7 +95,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addFrom(string $address, string $name = null)
|
||||
public function addFrom(string $address, string $name = null): object
|
||||
{
|
||||
$this->message->addFrom($name ? new NamedAddress($address, $name) : new Address($address));
|
||||
|
||||
@ -113,7 +113,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addReplyTo(string $address)
|
||||
public function addReplyTo(string $address): object
|
||||
{
|
||||
$this->message->addReplyTo($address);
|
||||
|
||||
@ -131,7 +131,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addTo(string $address, string $name = null)
|
||||
public function addTo(string $address, string $name = null): object
|
||||
{
|
||||
$this->message->addTo($name ? new NamedAddress($address, $name) : new Address($address));
|
||||
|
||||
@ -149,7 +149,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addCc(string $address, string $name = null)
|
||||
public function addCc(string $address, string $name = null): object
|
||||
{
|
||||
$this->message->addCc($name ? new NamedAddress($address, $name) : new Address($address));
|
||||
|
||||
@ -167,7 +167,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addBcc(string $address, string $name = null)
|
||||
public function addBcc(string $address, string $name = null): object
|
||||
{
|
||||
$this->message->addBcc($name ? new NamedAddress($address, $name) : new Address($address));
|
||||
|
||||
@ -185,7 +185,7 @@ final class WrappedTemplatedEmail
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setPriority(int $priority)
|
||||
public function setPriority(int $priority): object
|
||||
{
|
||||
$this->message->setPriority($priority);
|
||||
|
||||
|
@ -57,7 +57,7 @@ class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterf
|
||||
*
|
||||
* @return bool always true
|
||||
*/
|
||||
public function isOptional()
|
||||
public function isOptional(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -65,7 +65,7 @@ class RouterCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedServices()
|
||||
public static function getSubscribedServices(): array
|
||||
{
|
||||
return [
|
||||
'router' => RouterInterface::class,
|
||||
|
@ -258,7 +258,7 @@ EOT
|
||||
return self::METHOD_COPY;
|
||||
}
|
||||
|
||||
private function getPublicDirectory(ContainerInterface $container)
|
||||
private function getPublicDirectory(ContainerInterface $container): string
|
||||
{
|
||||
$defaultPublicDir = 'public';
|
||||
|
||||
|
@ -208,11 +208,9 @@ EOF
|
||||
/**
|
||||
* Loads the ContainerBuilder from the cache.
|
||||
*
|
||||
* @return ContainerBuilder
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
protected function getContainerBuilder()
|
||||
protected function getContainerBuilder(): ContainerBuilder
|
||||
{
|
||||
if ($this->containerBuilder) {
|
||||
return $this->containerBuilder;
|
||||
|
@ -24,12 +24,12 @@ class ControllerResolver extends ContainerControllerResolver
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function instantiateController($class)
|
||||
protected function instantiateController($class): object
|
||||
{
|
||||
return $this->configureController(parent::instantiateController($class), $class);
|
||||
}
|
||||
|
||||
private function configureController($controller, string $class)
|
||||
private function configureController($controller, string $class): object
|
||||
{
|
||||
if ($controller instanceof ContainerAwareInterface) {
|
||||
$controller->setContainer($this->container);
|
||||
|
@ -180,7 +180,7 @@ EOF
|
||||
})->setHidden(true)->setMaxAttempts(20);
|
||||
}
|
||||
|
||||
private function generateSalt()
|
||||
private function generateSalt(): string
|
||||
{
|
||||
return base64_encode(random_bytes(30));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ final class WrappedListener
|
||||
return $this->listener->{$method}(...$arguments);
|
||||
}
|
||||
|
||||
public function getWrappedListener()
|
||||
public function getWrappedListener(): callable
|
||||
{
|
||||
return $this->listener;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|
||||
$this->cspHandler = $cspHandler;
|
||||
}
|
||||
|
||||
public function isEnabled()
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return self::DISABLED !== $this->mode;
|
||||
}
|
||||
@ -136,7 +136,7 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::RESPONSE => ['onKernelResponse', -128],
|
||||
|
@ -41,7 +41,7 @@ class HttpBrowser extends AbstractBrowser
|
||||
parent::__construct([], $history, $cookieJar);
|
||||
}
|
||||
|
||||
protected function doRequest($request)
|
||||
protected function doRequest($request): Response
|
||||
{
|
||||
$headers = $this->getHeaders($request);
|
||||
[$body, $extraHeaders] = $this->getBodyAndExtraHeaders($request);
|
||||
|
@ -40,7 +40,7 @@ final class Response
|
||||
*
|
||||
* @return string The response with headers and content
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
$headers = '';
|
||||
foreach ($this->headers as $name => $value) {
|
||||
@ -61,7 +61,7 @@ final class Response
|
||||
*
|
||||
* @return string The response content
|
||||
*/
|
||||
public function getContent()
|
||||
public function getContent(): string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
@ -76,7 +76,7 @@ final class Response
|
||||
*
|
||||
* @return array The response headers
|
||||
*/
|
||||
public function getHeaders()
|
||||
public function getHeaders(): array
|
||||
{
|
||||
return $this->headers;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class TestHttpClient extends HttpBrowser
|
||||
return $response;
|
||||
}
|
||||
|
||||
protected function doRequest($request)
|
||||
protected function doRequest($request): Response
|
||||
{
|
||||
$response = parent::doRequest($request);
|
||||
|
||||
|
@ -37,7 +37,7 @@ final class CacheItem implements ItemInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getKey()
|
||||
public function getKey(): string
|
||||
{
|
||||
return $this->key;
|
||||
}
|
||||
@ -53,7 +53,7 @@ final class CacheItem implements ItemInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isHit()
|
||||
public function isHit(): bool
|
||||
{
|
||||
return $this->isHit;
|
||||
}
|
||||
@ -145,11 +145,9 @@ final class CacheItem implements ItemInterface
|
||||
*
|
||||
* @param string $key The key to validate
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws InvalidArgumentException When $key is not valid
|
||||
*/
|
||||
public static function validateKey($key)
|
||||
public static function validateKey($key): string
|
||||
{
|
||||
if (!\is_string($key)) {
|
||||
throw new InvalidArgumentException(sprintf('Cache key must be string, "%s" given', \is_object($key) ? \get_class($key) : \gettype($key)));
|
||||
|
@ -28,7 +28,7 @@ class Processor
|
||||
*
|
||||
* @return array The processed configuration
|
||||
*/
|
||||
public function process(NodeInterface $configTree, array $configs)
|
||||
public function process(NodeInterface $configTree, array $configs): array
|
||||
{
|
||||
$currentConfig = [];
|
||||
foreach ($configs as $config) {
|
||||
@ -47,7 +47,7 @@ class Processor
|
||||
*
|
||||
* @return array The processed configuration
|
||||
*/
|
||||
public function processConfiguration(ConfigurationInterface $configuration, array $configs)
|
||||
public function processConfiguration(ConfigurationInterface $configuration, array $configs): array
|
||||
{
|
||||
return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs);
|
||||
}
|
||||
@ -75,7 +75,7 @@ class Processor
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function normalizeConfig(array $config, string $key, string $plural = null)
|
||||
public static function normalizeConfig(array $config, string $key, string $plural = null): array
|
||||
{
|
||||
if (null === $plural) {
|
||||
$plural = $key.'s';
|
||||
|
@ -43,7 +43,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@ -51,7 +51,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* @return string The file path to the resource
|
||||
*/
|
||||
public function getResource()
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@ -61,7 +61,7 @@ class ClassExistenceResource implements SelfCheckingResourceInterface
|
||||
*
|
||||
* @throws \ReflectionException when a parent class/interface/trait is not found
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
$loaded = class_exists($this->resource, false) || interface_exists($this->resource, false) || trait_exists($this->resource, false);
|
||||
|
||||
|
@ -30,7 +30,7 @@ class ComposerResource implements SelfCheckingResourceInterface
|
||||
$this->vendors = self::$runtimeVendors;
|
||||
}
|
||||
|
||||
public function getVendors()
|
||||
public function getVendors(): array
|
||||
{
|
||||
return array_keys($this->vendors);
|
||||
}
|
||||
@ -38,7 +38,7 @@ class ComposerResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return __CLASS__;
|
||||
}
|
||||
@ -46,7 +46,7 @@ class ComposerResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
self::refresh();
|
||||
|
||||
|
@ -42,7 +42,7 @@ class DirectoryResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return md5(serialize([$this->resource, $this->pattern]));
|
||||
}
|
||||
@ -50,17 +50,15 @@ class DirectoryResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* @return string The file path to the resource
|
||||
*/
|
||||
public function getResource()
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pattern to restrict monitored files.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPattern()
|
||||
public function getPattern(): ?string
|
||||
{
|
||||
return $this->pattern;
|
||||
}
|
||||
@ -68,7 +66,7 @@ class DirectoryResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
if (!is_dir($this->resource)) {
|
||||
return false;
|
||||
|
@ -39,7 +39,7 @@ class FileExistenceResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@ -47,7 +47,7 @@ class FileExistenceResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* @return string The file path to the resource
|
||||
*/
|
||||
public function getResource()
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@ -55,7 +55,7 @@ class FileExistenceResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
return file_exists($this->resource) === $this->exists;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class FileResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@ -52,7 +52,7 @@ class FileResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* @return string The canonicalized, absolute path to the resource
|
||||
*/
|
||||
public function getResource()
|
||||
public function getResource(): string
|
||||
{
|
||||
return $this->resource;
|
||||
}
|
||||
@ -60,7 +60,7 @@ class FileResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
return false !== ($filemtime = @filemtime($this->resource)) && $filemtime <= $timestamp;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
||||
}
|
||||
}
|
||||
|
||||
public function getPrefix()
|
||||
public function getPrefix(): string
|
||||
{
|
||||
return $this->prefix;
|
||||
}
|
||||
@ -60,7 +60,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'glob.'.$this->prefix.$this->pattern.(int) $this->recursive;
|
||||
}
|
||||
@ -68,7 +68,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
$hash = $this->computeHash();
|
||||
|
||||
@ -91,7 +91,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
||||
return ['prefix', 'pattern', 'recursive', 'hash', 'forExclusion', 'excludedPrefixes'];
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
if (!file_exists($this->prefix) || (!$this->recursive && '' === $this->pattern)) {
|
||||
return;
|
||||
@ -171,7 +171,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function computeHash()
|
||||
private function computeHash(): string
|
||||
{
|
||||
$hash = hash_init('md5');
|
||||
|
||||
|
@ -38,7 +38,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isFresh(int $timestamp)
|
||||
public function isFresh(int $timestamp): bool
|
||||
{
|
||||
if (null === $this->hash) {
|
||||
$this->hash = $this->computeHash();
|
||||
@ -58,7 +58,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'reflection.'.$this->className;
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ EOPHP;
|
||||
}
|
||||
}
|
||||
|
||||
public function provideHashedSignature()
|
||||
public function provideHashedSignature(): iterable
|
||||
{
|
||||
yield [0, 0, "// line change\n\n"];
|
||||
yield [1, 0, '/** class docblock */'];
|
||||
|
@ -37,7 +37,7 @@ class ProcessHelper extends Helper
|
||||
*
|
||||
* @return Process The process that ran
|
||||
*/
|
||||
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
|
||||
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE): Process
|
||||
{
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
@ -103,7 +103,7 @@ class ProcessHelper extends Helper
|
||||
*
|
||||
* @see run()
|
||||
*/
|
||||
public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null)
|
||||
public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null): Process
|
||||
{
|
||||
$process = $this->run($output, $cmd, $error, $callback);
|
||||
|
||||
@ -120,10 +120,8 @@ class ProcessHelper extends Helper
|
||||
* @param OutputInterface $output An OutputInterface interface
|
||||
* @param Process $process The Process
|
||||
* @param callable|null $callback A PHP callable
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null)
|
||||
public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null): callable
|
||||
{
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
@ -148,7 +146,7 @@ class ProcessHelper extends Helper
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'process';
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return self The registered error handler
|
||||
*/
|
||||
public static function register(self $handler = null, $replace = true)
|
||||
public static function register(self $handler = null, $replace = true): self
|
||||
{
|
||||
if (null === self::$reservedMemory) {
|
||||
self::$reservedMemory = str_repeat('x', 10240);
|
||||
@ -210,7 +210,7 @@ class ErrorHandler
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setLoggers(array $loggers)
|
||||
public function setLoggers(array $loggers): array
|
||||
{
|
||||
$prevLogged = $this->loggedErrors;
|
||||
$prev = $this->loggers;
|
||||
@ -261,7 +261,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return callable|null The previous exception handler
|
||||
*/
|
||||
public function setExceptionHandler(callable $handler = null)
|
||||
public function setExceptionHandler(callable $handler = null): ?callable
|
||||
{
|
||||
$prev = $this->exceptionHandler;
|
||||
$this->exceptionHandler = $handler;
|
||||
@ -277,7 +277,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return int The previous value
|
||||
*/
|
||||
public function throwAt($levels, $replace = false)
|
||||
public function throwAt($levels, $replace = false): int
|
||||
{
|
||||
$prev = $this->thrownErrors;
|
||||
$this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
|
||||
@ -297,7 +297,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return int The previous value
|
||||
*/
|
||||
public function scopeAt($levels, $replace = false)
|
||||
public function scopeAt($levels, $replace = false): int
|
||||
{
|
||||
$prev = $this->scopedErrors;
|
||||
$this->scopedErrors = (int) $levels;
|
||||
@ -316,7 +316,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return int The previous value
|
||||
*/
|
||||
public function traceAt($levels, $replace = false)
|
||||
public function traceAt($levels, $replace = false): int
|
||||
{
|
||||
$prev = $this->tracedErrors;
|
||||
$this->tracedErrors = (int) $levels;
|
||||
@ -335,7 +335,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return int The previous value
|
||||
*/
|
||||
public function screamAt($levels, $replace = false)
|
||||
public function screamAt($levels, $replace = false): int
|
||||
{
|
||||
$prev = $this->screamedErrors;
|
||||
$this->screamedErrors = (int) $levels;
|
||||
@ -374,7 +374,7 @@ class ErrorHandler
|
||||
* @param string $file
|
||||
* @param int $line
|
||||
*
|
||||
* @return bool Returns false when no handling happens so that the PHP engine can handle the error itself
|
||||
* @return bool|void Returns false when no handling happens so that the PHP engine can handle the error itself
|
||||
*
|
||||
* @throws \ErrorException When $this->thrownErrors requests so
|
||||
*
|
||||
@ -670,7 +670,7 @@ class ErrorHandler
|
||||
*
|
||||
* @return FatalErrorHandlerInterface[] An array of FatalErrorHandlerInterface
|
||||
*/
|
||||
protected function getFatalErrorHandlers()
|
||||
protected function getFatalErrorHandlers(): array
|
||||
{
|
||||
return [
|
||||
new UndefinedFunctionFatalErrorHandler(),
|
||||
@ -682,7 +682,7 @@ class ErrorHandler
|
||||
/**
|
||||
* Cleans the trace by removing function arguments and the frames added by the error handler and DebugClassLoader.
|
||||
*/
|
||||
private function cleanTrace($backtrace, $type, $file, $line, $throw)
|
||||
private function cleanTrace($backtrace, $type, $file, $line, $throw): array
|
||||
{
|
||||
$lightTrace = $backtrace;
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -43,7 +43,7 @@ final class BoundArgument implements ArgumentInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getValues()
|
||||
public function getValues(): array
|
||||
{
|
||||
return [$this->value, $this->identifier, $this->used, $this->type, $this->file];
|
||||
}
|
||||
|
@ -90,10 +90,8 @@ final class ServiceLocatorTagPass extends AbstractRecursivePass
|
||||
* @param ContainerBuilder $container
|
||||
* @param Reference[] $refMap
|
||||
* @param string|null $callerId
|
||||
*
|
||||
* @return Reference
|
||||
*/
|
||||
public static function register(ContainerBuilder $container, array $refMap, $callerId = null)
|
||||
public static function register(ContainerBuilder $container, array $refMap, $callerId = null): Reference
|
||||
{
|
||||
foreach ($refMap as $id => $ref) {
|
||||
if (!$ref instanceof Reference) {
|
||||
|
@ -35,7 +35,7 @@ class ContainerParametersResource implements ResourceInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return 'container_parameters_'.md5(serialize($this->parameters));
|
||||
}
|
||||
@ -43,7 +43,7 @@ class ContainerParametersResource implements ResourceInterface
|
||||
/**
|
||||
* @return array Tracked parameters
|
||||
*/
|
||||
public function getParameters()
|
||||
public function getParameters(): array
|
||||
{
|
||||
return $this->parameters;
|
||||
}
|
||||
|
@ -384,8 +384,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
||||
* @param bool|string $trackContents Whether to track contents of the given resource. If a string is passed,
|
||||
* it will be used as pattern for tracking contents of the requested directory
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function fileExists(string $path, $trackContents = true): bool
|
||||
|
@ -25,7 +25,7 @@ class NullDumper implements DumperInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function isProxyCandidate(Definition $definition)
|
||||
public function isProxyCandidate(Definition $definition): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -33,7 +33,7 @@ class NullDumper implements DumperInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null)
|
||||
public function getProxyFactoryCode(Definition $definition, $id, $factoryCode = null): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
@ -41,7 +41,7 @@ class NullDumper implements DumperInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProxyCode(Definition $definition)
|
||||
public function getProxyCode(Definition $definition): string
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class DefaultsConfigurator extends AbstractServiceConfigurator
|
||||
*
|
||||
* @throws InvalidArgumentException when an invalid tag name or attribute is provided
|
||||
*/
|
||||
final public function tag(string $name, array $attributes = [])
|
||||
final public function tag(string $name, array $attributes = []): object
|
||||
{
|
||||
if ('' === $name) {
|
||||
throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.');
|
||||
@ -61,10 +61,8 @@ class DefaultsConfigurator extends AbstractServiceConfigurator
|
||||
|
||||
/**
|
||||
* Defines an instanceof-conditional to be applied to following service definitions.
|
||||
*
|
||||
* @return InstanceofConfigurator
|
||||
*/
|
||||
final public function instanceof(string $fqcn)
|
||||
final public function instanceof(string $fqcn): InstanceofConfigurator
|
||||
{
|
||||
return $this->parent->instanceof($fqcn);
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class ParametersConfigurator extends AbstractConfigurator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function set(string $name, $value)
|
||||
final public function set(string $name, $value): object
|
||||
{
|
||||
$this->container->setParameter($name, static::processValue($value, true));
|
||||
|
||||
@ -44,7 +44,7 @@ class ParametersConfigurator extends AbstractConfigurator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function __invoke(string $name, $value)
|
||||
final public function __invoke(string $name, $value): object
|
||||
{
|
||||
return $this->set($name, $value);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class PrototypeConfigurator extends AbstractServiceConfigurator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function exclude($excludes)
|
||||
final public function exclude($excludes): object
|
||||
{
|
||||
$this->excludes = (array) $excludes;
|
||||
|
||||
|
@ -32,7 +32,7 @@ class ReferenceConfigurator extends AbstractConfigurator
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function ignoreOnInvalid()
|
||||
final public function ignoreOnInvalid(): object
|
||||
{
|
||||
$this->invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;
|
||||
|
||||
@ -42,7 +42,7 @@ class ReferenceConfigurator extends AbstractConfigurator
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function nullOnInvalid()
|
||||
final public function nullOnInvalid(): object
|
||||
{
|
||||
$this->invalidBehavior = ContainerInterface::NULL_ON_INVALID_REFERENCE;
|
||||
|
||||
@ -52,14 +52,14 @@ class ReferenceConfigurator extends AbstractConfigurator
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function ignoreOnUninitialized()
|
||||
final public function ignoreOnUninitialized(): object
|
||||
{
|
||||
$this->invalidBehavior = ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ trait AbstractTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function abstract(bool $abstract = true)
|
||||
final public function abstract(bool $abstract = true): object
|
||||
{
|
||||
$this->definition->setAbstract($abstract);
|
||||
|
||||
|
@ -20,7 +20,7 @@ trait ArgumentTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function args(array $arguments)
|
||||
final public function args(array $arguments): object
|
||||
{
|
||||
$this->definition->setArguments(static::processValue($arguments, true));
|
||||
|
||||
@ -35,7 +35,7 @@ trait ArgumentTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function arg($key, $value)
|
||||
final public function arg($key, $value): object
|
||||
{
|
||||
$this->definition->setArgument($key, static::processValue($value, true));
|
||||
|
||||
|
@ -23,7 +23,7 @@ trait AutoconfigureTrait
|
||||
*
|
||||
* @throws InvalidArgumentException when a parent is already set
|
||||
*/
|
||||
final public function autoconfigure(bool $autoconfigured = true)
|
||||
final public function autoconfigure(bool $autoconfigured = true): object
|
||||
{
|
||||
if ($autoconfigured && $this->definition instanceof ChildDefinition) {
|
||||
throw new InvalidArgumentException(sprintf('The service "%s" cannot have a "parent" and also have "autoconfigure". Try disabling autoconfiguration for the service.', $this->id));
|
||||
|
@ -18,7 +18,7 @@ trait AutowireTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function autowire(bool $autowired = true)
|
||||
final public function autowire(bool $autowired = true): object
|
||||
{
|
||||
$this->definition->setAutowired($autowired);
|
||||
|
||||
|
@ -31,7 +31,7 @@ trait BindTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function bind($nameOrFqcn, $valueOrRef)
|
||||
final public function bind($nameOrFqcn, $valueOrRef): object
|
||||
{
|
||||
$valueOrRef = static::processValue($valueOrRef, true);
|
||||
if (!preg_match('/^(?:(?:array|bool|float|int|string)[ \t]*+)?\$/', $nameOrFqcn) && !$valueOrRef instanceof Reference) {
|
||||
|
@ -25,7 +25,7 @@ trait CallTrait
|
||||
*
|
||||
* @throws InvalidArgumentException on empty $method param
|
||||
*/
|
||||
final public function call($method, array $arguments = [])
|
||||
final public function call($method, array $arguments = []): object
|
||||
{
|
||||
$this->definition->addMethodCall($method, static::processValue($arguments, true));
|
||||
|
||||
|
@ -18,7 +18,7 @@ trait ClassTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function class($class)
|
||||
final public function class($class): object
|
||||
{
|
||||
$this->definition->setClass($class);
|
||||
|
||||
|
@ -20,7 +20,7 @@ trait ConfiguratorTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function configurator($configurator)
|
||||
final public function configurator($configurator): object
|
||||
{
|
||||
$this->definition->setConfigurator(static::processValue($configurator, true));
|
||||
|
||||
|
@ -26,7 +26,7 @@ trait DecorateTrait
|
||||
*
|
||||
* @throws InvalidArgumentException in case the decorated service id and the new decorated service id are equals
|
||||
*/
|
||||
final public function decorate($id, $renamedId = null, $priority = 0)
|
||||
final public function decorate($id, $renamedId = null, $priority = 0): object
|
||||
{
|
||||
$this->definition->setDecoratedService($id, $renamedId, $priority);
|
||||
|
||||
|
@ -24,7 +24,7 @@ trait DeprecateTrait
|
||||
*
|
||||
* @throws InvalidArgumentException when the message template is invalid
|
||||
*/
|
||||
final public function deprecate($template = null)
|
||||
final public function deprecate($template = null): object
|
||||
{
|
||||
$this->definition->setDeprecated(true, $template);
|
||||
|
||||
|
@ -22,7 +22,7 @@ trait FactoryTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function factory($factory)
|
||||
final public function factory($factory): object
|
||||
{
|
||||
if (\is_string($factory) && 1 === substr_count($factory, ':')) {
|
||||
$factoryParts = explode(':', $factory);
|
||||
|
@ -20,7 +20,7 @@ trait FileTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function file($file)
|
||||
final public function file($file): object
|
||||
{
|
||||
$this->definition->setFile($file);
|
||||
|
||||
|
@ -20,7 +20,7 @@ trait LazyTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function lazy($lazy = true)
|
||||
final public function lazy($lazy = true): object
|
||||
{
|
||||
$this->definition->setLazy((bool) $lazy);
|
||||
if (\is_string($lazy)) {
|
||||
|
@ -23,7 +23,7 @@ trait ParentTrait
|
||||
*
|
||||
* @throws InvalidArgumentException when parent cannot be set
|
||||
*/
|
||||
final public function parent(string $parent)
|
||||
final public function parent(string $parent): object
|
||||
{
|
||||
if (!$this->allowParent) {
|
||||
throw new InvalidArgumentException(sprintf('A parent cannot be defined when either "_instanceof" or "_defaults" are also defined for service prototype "%s".', $this->id));
|
||||
|
@ -18,7 +18,7 @@ trait PropertyTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function property(string $name, $value)
|
||||
final public function property(string $name, $value): object
|
||||
{
|
||||
$this->definition->setProperty($name, static::processValue($value, true));
|
||||
|
||||
|
@ -16,7 +16,7 @@ trait PublicTrait
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function public()
|
||||
final public function public(): object
|
||||
{
|
||||
$this->definition->setPublic(true);
|
||||
|
||||
@ -26,7 +26,7 @@ trait PublicTrait
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
final public function private()
|
||||
final public function private(): object
|
||||
{
|
||||
$this->definition->setPublic(false);
|
||||
|
||||
|
@ -20,7 +20,7 @@ trait ShareTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function share($shared = true)
|
||||
final public function share($shared = true): object
|
||||
{
|
||||
$this->definition->setShared($shared);
|
||||
|
||||
|
@ -19,7 +19,7 @@ trait SyntheticTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function synthetic(bool $synthetic = true)
|
||||
final public function synthetic(bool $synthetic = true): object
|
||||
{
|
||||
$this->definition->setSynthetic($synthetic);
|
||||
|
||||
|
@ -23,7 +23,7 @@ trait TagTrait
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
final public function tag($name, array $attributes = [])
|
||||
final public function tag($name, array $attributes = []): object
|
||||
{
|
||||
if (!\is_string($name) || '' === $name) {
|
||||
throw new InvalidArgumentException(sprintf('The tag name for service "%s" must be a non-empty string.', $this->id));
|
||||
|
@ -61,11 +61,9 @@ final class ReverseContainer
|
||||
}
|
||||
|
||||
/**
|
||||
* @return object
|
||||
*
|
||||
* @throws ServiceNotFoundException When the service is not reversible
|
||||
*/
|
||||
public function getService(string $id)
|
||||
public function getService(string $id): object
|
||||
{
|
||||
if ($this->serviceContainer->has($id)) {
|
||||
return $this->serviceContainer->get($id);
|
||||
|
@ -211,7 +211,7 @@ final class Dotenv
|
||||
}
|
||||
}
|
||||
|
||||
private function lexVarname()
|
||||
private function lexVarname(): string
|
||||
{
|
||||
// var name + optional export
|
||||
if (!preg_match('/(export[ \t]++)?('.self::VARNAME_REGEX.')/A', $this->data, $matches, 0, $this->cursor)) {
|
||||
@ -239,7 +239,7 @@ final class Dotenv
|
||||
return $matches[2];
|
||||
}
|
||||
|
||||
private function lexValue()
|
||||
private function lexValue(): string
|
||||
{
|
||||
if (preg_match('/[ \t]*+(?:#.*)?$/Am', $this->data, $matches, 0, $this->cursor)) {
|
||||
$this->moveCursor($matches[0]);
|
||||
@ -334,7 +334,7 @@ final class Dotenv
|
||||
return $v;
|
||||
}
|
||||
|
||||
private function lexNestedExpression()
|
||||
private function lexNestedExpression(): string
|
||||
{
|
||||
++$this->cursor;
|
||||
$value = '';
|
||||
@ -467,7 +467,7 @@ final class Dotenv
|
||||
$this->lineno += substr_count($text, "\n");
|
||||
}
|
||||
|
||||
private function createFormatException($message)
|
||||
private function createFormatException($message): FormatException
|
||||
{
|
||||
return new FormatException($message, new FormatExceptionContext($this->data, $this->path, $this->lineno, $this->cursor));
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ final class FormatException extends \LogicException implements ExceptionInterfac
|
||||
parent::__construct(sprintf("%s in \"%s\" at line %d.\n%s", $message, $context->getPath(), $context->getLineno(), $context->getDetails()), $code, $previous);
|
||||
}
|
||||
|
||||
public function getContext()
|
||||
public function getContext(): FormatExceptionContext
|
||||
{
|
||||
return $this->context;
|
||||
}
|
||||
|
@ -29,17 +29,17 @@ final class FormatExceptionContext
|
||||
$this->cursor = $cursor;
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
public function getPath(): string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
|
||||
public function getLineno()
|
||||
public function getLineno(): int
|
||||
{
|
||||
return $this->lineno;
|
||||
}
|
||||
|
||||
public function getDetails()
|
||||
public function getDetails(): string
|
||||
{
|
||||
$before = str_replace("\n", '\n', substr($this->data, max(0, $this->cursor - 20), min(20, $this->cursor)));
|
||||
$after = str_replace("\n", '\n', substr($this->data, $this->cursor, 20));
|
||||
|
@ -26,11 +26,9 @@ final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInt
|
||||
*
|
||||
* @param \DateTimeImmutable|null $value A DateTimeImmutable object
|
||||
*
|
||||
* @return \DateTime|null A \DateTime object
|
||||
*
|
||||
* @throws TransformationFailedException If the given value is not a \DateTimeImmutable
|
||||
*/
|
||||
public function transform($value)
|
||||
public function transform($value): ?\DateTime
|
||||
{
|
||||
if (null === $value) {
|
||||
return null;
|
||||
@ -48,11 +46,9 @@ final class DateTimeImmutableToDateTimeTransformer implements DataTransformerInt
|
||||
*
|
||||
* @param \DateTime|null $value A DateTime object
|
||||
*
|
||||
* @return \DateTimeImmutable|null A DateTimeImmutable object
|
||||
*
|
||||
* @throws TransformationFailedException If the given value is not a \DateTime
|
||||
*/
|
||||
public function reverseTransform($value)
|
||||
public function reverseTransform($value): ?\DateTimeImmutable
|
||||
{
|
||||
if (null === $value) {
|
||||
return null;
|
||||
|
@ -218,7 +218,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'form';
|
||||
}
|
||||
@ -226,7 +226,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData()
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
@ -250,7 +250,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getCasters()
|
||||
protected function getCasters(): array
|
||||
{
|
||||
return parent::getCasters() + [
|
||||
\Exception::class => function (\Exception $e, array $a, Stub $s) {
|
||||
|
@ -402,7 +402,7 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
|
||||
};
|
||||
}
|
||||
|
||||
private static function configureHeadersAndProxy($context, string $host, array $requestHeaders, ?array $proxy, array $noProxy)
|
||||
private static function configureHeadersAndProxy($context, string $host, array $requestHeaders, ?array $proxy, array $noProxy): bool
|
||||
{
|
||||
if (null === $proxy) {
|
||||
return stream_context_set_option($context, 'http', 'header', $requestHeaders);
|
||||
|
@ -418,7 +418,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setProtocolVersion(string $version)
|
||||
public function setProtocolVersion(string $version): object
|
||||
{
|
||||
$this->version = $version;
|
||||
|
||||
@ -447,7 +447,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setStatusCode(int $code, $text = null)
|
||||
public function setStatusCode(int $code, $text = null): object
|
||||
{
|
||||
$this->statusCode = $code;
|
||||
if ($this->isInvalid()) {
|
||||
@ -488,7 +488,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setCharset(string $charset)
|
||||
public function setCharset(string $charset): object
|
||||
{
|
||||
$this->charset = $charset;
|
||||
|
||||
@ -569,7 +569,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setPrivate()
|
||||
public function setPrivate(): object
|
||||
{
|
||||
$this->headers->removeCacheControlDirective('public');
|
||||
$this->headers->addCacheControlDirective('private');
|
||||
@ -586,7 +586,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setPublic()
|
||||
public function setPublic(): object
|
||||
{
|
||||
$this->headers->addCacheControlDirective('public');
|
||||
$this->headers->removeCacheControlDirective('private');
|
||||
@ -601,7 +601,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setImmutable(bool $immutable = true)
|
||||
public function setImmutable(bool $immutable = true): object
|
||||
{
|
||||
if ($immutable) {
|
||||
$this->headers->addCacheControlDirective('immutable');
|
||||
@ -656,7 +656,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setDate(\DateTimeInterface $date)
|
||||
public function setDate(\DateTimeInterface $date): object
|
||||
{
|
||||
if ($date instanceof \DateTime) {
|
||||
$date = \DateTimeImmutable::createFromMutable($date);
|
||||
@ -721,7 +721,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setExpires(\DateTimeInterface $date = null)
|
||||
public function setExpires(\DateTimeInterface $date = null): object
|
||||
{
|
||||
if (null === $date) {
|
||||
$this->headers->remove('Expires');
|
||||
@ -774,7 +774,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setMaxAge(int $value)
|
||||
public function setMaxAge(int $value): object
|
||||
{
|
||||
$this->headers->addCacheControlDirective('max-age', $value);
|
||||
|
||||
@ -790,7 +790,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setSharedMaxAge(int $value)
|
||||
public function setSharedMaxAge(int $value): object
|
||||
{
|
||||
$this->setPublic();
|
||||
$this->headers->addCacheControlDirective('s-maxage', $value);
|
||||
@ -824,7 +824,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setTtl(int $seconds)
|
||||
public function setTtl(int $seconds): object
|
||||
{
|
||||
$this->setSharedMaxAge($this->getAge() + $seconds);
|
||||
|
||||
@ -840,7 +840,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setClientTtl(int $seconds)
|
||||
public function setClientTtl(int $seconds): object
|
||||
{
|
||||
$this->setMaxAge($this->getAge() + $seconds);
|
||||
|
||||
@ -868,7 +868,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setLastModified(\DateTimeInterface $date = null)
|
||||
public function setLastModified(\DateTimeInterface $date = null): object
|
||||
{
|
||||
if (null === $date) {
|
||||
$this->headers->remove('Last-Modified');
|
||||
@ -906,7 +906,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setEtag(string $etag = null, bool $weak = false)
|
||||
public function setEtag(string $etag = null, bool $weak = false): object
|
||||
{
|
||||
if (null === $etag) {
|
||||
$this->headers->remove('Etag');
|
||||
@ -932,7 +932,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setCache(array $options)
|
||||
public function setCache(array $options): object
|
||||
{
|
||||
if ($diff = array_diff(array_keys($options), ['etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'])) {
|
||||
throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff)));
|
||||
@ -989,7 +989,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setNotModified()
|
||||
public function setNotModified(): object
|
||||
{
|
||||
$this->setStatusCode(304);
|
||||
$this->setContent(null);
|
||||
@ -1041,7 +1041,7 @@ class Response
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
public function setVary($headers, bool $replace = true)
|
||||
public function setVary($headers, bool $replace = true): object
|
||||
{
|
||||
$this->headers->set('Vary', $headers, $replace);
|
||||
|
||||
|
@ -29,20 +29,14 @@ final class SessionBagProxy implements SessionBagInterface
|
||||
$this->usageIndex = &$usageIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SessionBagInterface
|
||||
*/
|
||||
public function getBag()
|
||||
public function getBag(): SessionBagInterface
|
||||
{
|
||||
++$this->usageIndex;
|
||||
|
||||
return $this->bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isEmpty()
|
||||
public function isEmpty(): bool
|
||||
{
|
||||
if (!isset($this->data[$this->bag->getStorageKey()])) {
|
||||
return true;
|
||||
@ -55,7 +49,7 @@ final class SessionBagProxy implements SessionBagInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->bag->getName();
|
||||
}
|
||||
@ -74,7 +68,7 @@ final class SessionBagProxy implements SessionBagInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getStorageKey()
|
||||
public function getStorageKey(): string
|
||||
{
|
||||
return $this->bag->getStorageKey();
|
||||
}
|
||||
|
@ -119,10 +119,8 @@ abstract class Bundle implements BundleInterface
|
||||
|
||||
/**
|
||||
* Returns the bundle name (the class short name).
|
||||
*
|
||||
* @return string The Bundle name
|
||||
*/
|
||||
final public function getName()
|
||||
final public function getName(): string
|
||||
{
|
||||
if (null === $this->name) {
|
||||
$this->parseClassName();
|
||||
|
@ -114,7 +114,7 @@ class CacheWarmerAggregate implements CacheWarmerInterface
|
||||
*
|
||||
* @return bool always false
|
||||
*/
|
||||
public function isOptional()
|
||||
public function isOptional(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getArguments(Request $request, $controller)
|
||||
public function getArguments(Request $request, $controller): array
|
||||
{
|
||||
$arguments = [];
|
||||
|
||||
|
@ -25,7 +25,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic());
|
||||
}
|
||||
@ -33,7 +33,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(Request $request, ArgumentMetadata $argument)
|
||||
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||
{
|
||||
yield $argument->hasDefaultValue() ? $argument->getDefaultValue() : null;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ final class NotTaggedControllerValueResolver implements ArgumentValueResolverInt
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
$controller = $request->attributes->get('_controller');
|
||||
|
||||
|
@ -25,7 +25,7 @@ final class RequestAttributeValueResolver implements ArgumentValueResolverInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
return !$argument->isVariadic() && $request->attributes->has($argument->getName());
|
||||
}
|
||||
@ -33,7 +33,7 @@ final class RequestAttributeValueResolver implements ArgumentValueResolverInterf
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(Request $request, ArgumentMetadata $argument)
|
||||
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||
{
|
||||
yield $request->attributes->get($argument->getName());
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ final class RequestValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
return Request::class === $argument->getType() || is_subclass_of($argument->getType(), Request::class);
|
||||
}
|
||||
@ -33,7 +33,7 @@ final class RequestValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(Request $request, ArgumentMetadata $argument)
|
||||
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||
{
|
||||
yield $request;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
$controller = $request->attributes->get('_controller');
|
||||
|
||||
@ -58,7 +58,7 @@ final class ServiceValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(Request $request, ArgumentMetadata $argument)
|
||||
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||
{
|
||||
if (\is_array($controller = $request->attributes->get('_controller'))) {
|
||||
$controller = $controller[0].'::'.$controller[1];
|
||||
|
@ -26,7 +26,7 @@ final class SessionValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
if (!$request->hasSession()) {
|
||||
return false;
|
||||
@ -43,7 +43,7 @@ final class SessionValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(Request $request, ArgumentMetadata $argument)
|
||||
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||
{
|
||||
yield $request->getSession();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(Request $request, ArgumentMetadata $argument)
|
||||
public function supports(Request $request, ArgumentMetadata $argument): bool
|
||||
{
|
||||
return $argument->isVariadic() && $request->attributes->has($argument->getName());
|
||||
}
|
||||
@ -33,7 +33,7 @@ final class VariadicValueResolver implements ArgumentValueResolverInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function resolve(Request $request, ArgumentMetadata $argument)
|
||||
public function resolve(Request $request, ArgumentMetadata $argument): iterable
|
||||
{
|
||||
$values = $request->attributes->get($argument->getName());
|
||||
|
||||
|
@ -21,7 +21,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createArgumentMetadata($controller)
|
||||
public function createArgumentMetadata($controller): array
|
||||
{
|
||||
$arguments = [];
|
||||
|
||||
@ -45,7 +45,7 @@ final class ArgumentMetadataFactory implements ArgumentMetadataFactoryInterface
|
||||
*
|
||||
* @param \ReflectionParameter $parameter
|
||||
*
|
||||
* @return string|null
|
||||
* @return string|null|void
|
||||
*/
|
||||
private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function __sleep()
|
||||
public function __sleep(): array
|
||||
{
|
||||
if (!$this->dataCount) {
|
||||
$this->data = [];
|
||||
@ -180,12 +180,12 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
self::__construct($this->stopwatch, $fileLinkFormat, $charset);
|
||||
}
|
||||
|
||||
public function getDumpsCount()
|
||||
public function getDumpsCount(): int
|
||||
{
|
||||
return $this->dataCount;
|
||||
}
|
||||
|
||||
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1)
|
||||
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1): array
|
||||
{
|
||||
$data = fopen('php://memory', 'r+b');
|
||||
|
||||
@ -212,7 +212,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
return $dumps;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
public function getName(): string
|
||||
{
|
||||
return 'dump';
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class FileLinkFormatter
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString)
|
||||
public static function generateUrlFormat(UrlGeneratorInterface $router, $routeName, $queryString): ?string
|
||||
{
|
||||
try {
|
||||
return $router->generate($routeName).$queryString;
|
||||
|
@ -45,7 +45,7 @@ class AddRequestFormatsListener implements EventSubscriberInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [KernelEvents::REQUEST => ['onKernelRequest', 100]];
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
(new ExceptionListener($controller, $this->logger, $debug))->onKernelException($event);
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
$events = [KernelEvents::REQUEST => ['configure', 2048]];
|
||||
|
||||
|
@ -94,7 +94,7 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::EXCEPTION => [
|
||||
@ -126,10 +126,8 @@ class ExceptionListener implements EventSubscriberInterface
|
||||
*
|
||||
* @param \Exception $exception The thrown exception
|
||||
* @param Request $request The original request
|
||||
*
|
||||
* @return Request The cloned request
|
||||
*/
|
||||
protected function duplicateRequest(\Exception $exception, Request $request)
|
||||
protected function duplicateRequest(\Exception $exception, Request $request): Request
|
||||
{
|
||||
$attributes = [
|
||||
'_controller' => $this->controller,
|
||||
|
@ -92,7 +92,7 @@ class FragmentListener implements EventSubscriberInterface
|
||||
throw new AccessDeniedHttpException();
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => [['onKernelRequest', 48]],
|
||||
|
@ -79,7 +79,7 @@ class LocaleListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => [
|
||||
|
@ -119,7 +119,7 @@ class ProfilerListener implements EventSubscriberInterface
|
||||
$this->parents = new \SplObjectStorage();
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::RESPONSE => ['onKernelResponse', -100],
|
||||
|
@ -49,7 +49,7 @@ class ResponseListener implements EventSubscriberInterface
|
||||
$response->prepare($event->getRequest());
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::RESPONSE => 'onKernelResponse',
|
||||
|
@ -157,7 +157,7 @@ class RouterListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => [['onKernelRequest', 32]],
|
||||
@ -166,7 +166,7 @@ class RouterListener implements EventSubscriberInterface
|
||||
];
|
||||
}
|
||||
|
||||
private function createWelcomeResponse()
|
||||
private function createWelcomeResponse(): Response
|
||||
{
|
||||
$version = Kernel::VERSION;
|
||||
$baseDir = realpath($this->projectDir).\DIRECTORY_SEPARATOR;
|
||||
|
@ -42,7 +42,7 @@ class StreamedResponseListener implements EventSubscriberInterface
|
||||
}
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::RESPONSE => ['onKernelResponse', -1024],
|
||||
|
@ -58,7 +58,7 @@ class SurrogateListener implements EventSubscriberInterface
|
||||
$surrogate->addSurrogateControl($event->getResponse());
|
||||
}
|
||||
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::RESPONSE => 'onKernelResponse',
|
||||
|
@ -44,7 +44,7 @@ class ValidateRequestListener implements EventSubscriberInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function getSubscribedEvents()
|
||||
public static function getSubscribedEvents(): array
|
||||
{
|
||||
return [
|
||||
KernelEvents::REQUEST => [
|
||||
|
@ -60,7 +60,7 @@ final class Countries extends ResourceBundle
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getNames($displayLocale = null)
|
||||
public static function getNames($displayLocale = null): array
|
||||
{
|
||||
return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ final class Intl
|
||||
*
|
||||
* @return bool Returns true if the intl extension is installed, false otherwise
|
||||
*/
|
||||
public static function isExtensionLoaded()
|
||||
public static function isExtensionLoaded(): bool
|
||||
{
|
||||
return class_exists('\ResourceBundle');
|
||||
}
|
||||
@ -79,7 +79,7 @@ final class Intl
|
||||
*
|
||||
* @return string|null The ICU version or NULL if it could not be determined
|
||||
*/
|
||||
public static function getIcuVersion()
|
||||
public static function getIcuVersion(): ?string
|
||||
{
|
||||
if (false === self::$icuVersion) {
|
||||
if (!self::isExtensionLoaded()) {
|
||||
@ -109,7 +109,7 @@ final class Intl
|
||||
*
|
||||
* @return string The version of the installed ICU data
|
||||
*/
|
||||
public static function getIcuDataVersion()
|
||||
public static function getIcuDataVersion(): string
|
||||
{
|
||||
if (false === self::$icuDataVersion) {
|
||||
self::$icuDataVersion = trim(file_get_contents(self::getDataDirectory().'/version.txt'));
|
||||
@ -123,7 +123,7 @@ final class Intl
|
||||
*
|
||||
* @return string The ICU version of the stub classes
|
||||
*/
|
||||
public static function getIcuStubVersion()
|
||||
public static function getIcuStubVersion(): string
|
||||
{
|
||||
return '64.2';
|
||||
}
|
||||
@ -133,7 +133,7 @@ final class Intl
|
||||
*
|
||||
* @return string The absolute path to the data directory
|
||||
*/
|
||||
public static function getDataDirectory()
|
||||
public static function getDataDirectory(): string
|
||||
{
|
||||
return __DIR__.'/Resources/data';
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ final class Locales extends ResourceBundle
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getNames($displayLocale = null)
|
||||
public static function getNames($displayLocale = null): array
|
||||
{
|
||||
return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ final class Scripts extends ResourceBundle
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public static function getNames($displayLocale = null)
|
||||
public static function getNames($displayLocale = null): array
|
||||
{
|
||||
return self::asort(self::readEntry(['Names'], $displayLocale), $displayLocale);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ final class GitRepository
|
||||
return new self(realpath($targetDir));
|
||||
}
|
||||
|
||||
public function getPath()
|
||||
public function getPath(): string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
@ -64,7 +64,7 @@ final class GitRepository
|
||||
return $this->getLastLine($this->execInPath('git log -1 --format="%an"'));
|
||||
}
|
||||
|
||||
public function getLastAuthoredDate()
|
||||
public function getLastAuthoredDate(): \DateTime
|
||||
{
|
||||
return new \DateTime($this->getLastLine($this->execInPath('git log -1 --format="%ai"')));
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ final class ConnectionOptions
|
||||
const X_SASL_AUTHCID = 0x6102;
|
||||
const X_SASL_AUTHZID = 0x6103;
|
||||
|
||||
public static function getOptionName($name)
|
||||
public static function getOptionName($name): string
|
||||
{
|
||||
return sprintf('%s::%s', self::class, strtoupper($name));
|
||||
}
|
||||
@ -56,11 +56,9 @@ final class ConnectionOptions
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @throws LdapException
|
||||
*/
|
||||
public static function getOption($name)
|
||||
public static function getOption($name): int
|
||||
{
|
||||
// Convert
|
||||
$constantName = self::getOptionName($name);
|
||||
@ -72,7 +70,7 @@ final class ConnectionOptions
|
||||
return \constant($constantName);
|
||||
}
|
||||
|
||||
public static function isOption($name)
|
||||
public static function isOption($name): bool
|
||||
{
|
||||
return \defined(self::getOptionName($name));
|
||||
}
|
||||
|
@ -12,6 +12,8 @@
|
||||
namespace Symfony\Component\Ldap;
|
||||
|
||||
use Symfony\Component\Ldap\Adapter\AdapterInterface;
|
||||
use Symfony\Component\Ldap\Adapter\EntryManagerInterface;
|
||||
use Symfony\Component\Ldap\Adapter\QueryInterface;
|
||||
use Symfony\Component\Ldap\Exception\DriverNotFoundException;
|
||||
|
||||
/**
|
||||
@ -41,7 +43,7 @@ final class Ldap implements LdapInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query($dn, $query, array $options = [])
|
||||
public function query($dn, $query, array $options = []): ?QueryInterface
|
||||
{
|
||||
return $this->adapter->createQuery($dn, $query, $options);
|
||||
}
|
||||
@ -49,7 +51,7 @@ final class Ldap implements LdapInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEntryManager()
|
||||
public function getEntryManager(): ?EntryManagerInterface
|
||||
{
|
||||
return $this->adapter->getEntryManager();
|
||||
}
|
||||
@ -57,7 +59,7 @@ final class Ldap implements LdapInterface
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function escape($subject, $ignore = '', $flags = 0)
|
||||
public function escape($subject, $ignore = '', $flags = 0): ?string
|
||||
{
|
||||
return $this->adapter->escape($subject, $ignore, $flags);
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user