Replace more docblocks by type-hints
This commit is contained in:
parent
d7547f2e95
commit
aaf2265203
@ -165,12 +165,8 @@ class DoctrineDataCollector extends DataCollector
|
||||
* The return value is an array with the sanitized value and a boolean
|
||||
* indicating if the original value was kept (allowing to use the sanitized
|
||||
* value to explain the query).
|
||||
*
|
||||
* @param mixed $var
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function sanitizeParam($var)
|
||||
private function sanitizeParam($var): array
|
||||
{
|
||||
if (is_object($var)) {
|
||||
$className = get_class($var);
|
||||
|
@ -23,10 +23,7 @@ class DoctrineValidationPass implements CompilerPassInterface
|
||||
{
|
||||
private $managerType;
|
||||
|
||||
/**
|
||||
* @param string $managerType
|
||||
*/
|
||||
public function __construct($managerType)
|
||||
public function __construct(string $managerType)
|
||||
{
|
||||
$this->managerType = $managerType;
|
||||
}
|
||||
@ -43,12 +40,8 @@ class DoctrineValidationPass implements CompilerPassInterface
|
||||
/**
|
||||
* Gets the validation mapping files for the format and extends them with
|
||||
* files matching a doctrine search pattern (Resources/config/validation.orm.xml).
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
* @param string $mapping
|
||||
* @param string $extension
|
||||
*/
|
||||
private function updateValidatorMappingFiles(ContainerBuilder $container, $mapping, $extension)
|
||||
private function updateValidatorMappingFiles(ContainerBuilder $container, string $mapping, string $extension)
|
||||
{
|
||||
if (!$container->hasParameter('validator.mapping.loader.'.$mapping.'_files_loader.mapping_files')) {
|
||||
return;
|
||||
|
@ -37,7 +37,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
||||
* manager's service ID for a connection name
|
||||
* @param string $tagPrefix Tag prefix for listeners and subscribers
|
||||
*/
|
||||
public function __construct($connections, $managerTemplate, $tagPrefix)
|
||||
public function __construct(string $connections, string $managerTemplate, string $tagPrefix)
|
||||
{
|
||||
$this->connections = $connections;
|
||||
$this->managerTemplate = $managerTemplate;
|
||||
|
@ -117,7 +117,7 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
|
||||
* register alias
|
||||
* @param string[] $aliasMap Map of alias to namespace
|
||||
*/
|
||||
public function __construct($driver, array $namespaces, array $managerParameters, $driverPattern, $enabledParameter = false, $configurationPattern = '', $registerAliasMethodName = '', array $aliasMap = array())
|
||||
public function __construct($driver, array $namespaces, array $managerParameters, string $driverPattern, $enabledParameter = false, string $configurationPattern = '', string $registerAliasMethodName = '', array $aliasMap = array())
|
||||
{
|
||||
$this->driver = $driver;
|
||||
$this->namespaces = $namespaces;
|
||||
|
@ -27,7 +27,7 @@ class EntityFactory implements UserProviderFactoryInterface
|
||||
private $key;
|
||||
private $providerId;
|
||||
|
||||
public function __construct($key, $providerId)
|
||||
public function __construct(string $key, string $providerId)
|
||||
{
|
||||
$this->key = $key;
|
||||
$this->providerId = $providerId;
|
||||
|
@ -14,7 +14,6 @@ namespace Symfony\Bridge\Doctrine\Form\ChoiceList;
|
||||
use Doctrine\Common\Persistence\ObjectManager;
|
||||
use Symfony\Component\Form\ChoiceList\ArrayChoiceList;
|
||||
use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
|
||||
use Symfony\Component\Form\ChoiceList\Factory\ChoiceListFactoryInterface;
|
||||
use Symfony\Component\Form\ChoiceList\Loader\ChoiceLoaderInterface;
|
||||
|
||||
/**
|
||||
@ -45,9 +44,8 @@ class DoctrineChoiceLoader implements ChoiceLoaderInterface
|
||||
* @param string $class The class name of the loaded objects
|
||||
* @param IdReader $idReader The reader for the object IDs
|
||||
* @param null|EntityLoaderInterface $objectLoader The objects loader
|
||||
* @param ChoiceListFactoryInterface $factory The factory for creating the loaded choice list
|
||||
*/
|
||||
public function __construct(ObjectManager $manager, $class, $idReader = null, $objectLoader = null, $factory = null)
|
||||
public function __construct(ObjectManager $manager, string $class, IdReader $idReader = null, EntityLoaderInterface $objectLoader = null)
|
||||
{
|
||||
$classMetadata = $manager->getClassMetadata($class);
|
||||
|
||||
|
@ -157,13 +157,9 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
||||
/**
|
||||
* Determines whether an association is nullable.
|
||||
*
|
||||
* @param array $associationMapping
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @see https://github.com/doctrine/doctrine2/blob/v2.5.4/lib/Doctrine/ORM/Tools/EntityGenerator.php#L1221-L1246
|
||||
*/
|
||||
private function isAssociationNullable(array $associationMapping)
|
||||
private function isAssociationNullable(array $associationMapping): bool
|
||||
{
|
||||
if (isset($associationMapping['id']) && $associationMapping['id']) {
|
||||
return false;
|
||||
@ -185,12 +181,8 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
||||
|
||||
/**
|
||||
* Gets the corresponding built-in PHP type.
|
||||
*
|
||||
* @param string $doctrineType
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function getPhpType($doctrineType)
|
||||
private function getPhpType(string $doctrineType): ?string
|
||||
{
|
||||
switch ($doctrineType) {
|
||||
case DBALType::SMALLINT:
|
||||
@ -217,5 +209,7 @@ class DoctrineExtractor implements PropertyListExtractorInterface, PropertyTypeE
|
||||
case DBALType::OBJECT:
|
||||
return Type::BUILTIN_TYPE_OBJECT;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class EntityUserProvider implements UserProviderInterface
|
||||
private $class;
|
||||
private $property;
|
||||
|
||||
public function __construct(ManagerRegistry $registry, $classOrAlias, $property = null, $managerName = null)
|
||||
public function __construct(ManagerRegistry $registry, string $classOrAlias, string $property = null, string $managerName = null)
|
||||
{
|
||||
$this->registry = $registry;
|
||||
$this->managerName = $managerName;
|
||||
|
@ -187,12 +187,9 @@ class DoctrineExtensionTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
* @param array $config
|
||||
*
|
||||
* @dataProvider providerBasicDrivers
|
||||
*/
|
||||
public function testLoadBasicCacheDriver($class, array $config, array $expectedCalls = array())
|
||||
public function testLoadBasicCacheDriver(string $class, array $config, array $expectedCalls = array())
|
||||
{
|
||||
$container = $this->createContainer();
|
||||
$cacheName = 'metadata_cache';
|
||||
|
@ -15,10 +15,7 @@ class StringWrapper
|
||||
{
|
||||
private $string;
|
||||
|
||||
/**
|
||||
* @param string $string
|
||||
*/
|
||||
public function __construct($string = null)
|
||||
public function __construct(string $string = null)
|
||||
{
|
||||
$this->string = $string;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
|
||||
* @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging
|
||||
* level (leave empty to use the default mapping)
|
||||
*/
|
||||
public function __construct(OutputInterface $output = null, $bubble = true, array $verbosityLevelMap = array())
|
||||
public function __construct(OutputInterface $output = null, bool $bubble = true, array $verbosityLevelMap = array())
|
||||
{
|
||||
parent::__construct(Logger::DEBUG, $bubble);
|
||||
$this->output = $output;
|
||||
|
@ -24,7 +24,7 @@ class ServerLogHandler extends AbstractHandler
|
||||
private $context;
|
||||
private $socket;
|
||||
|
||||
public function __construct($host, $level = Logger::DEBUG, $bubble = true, $context = array())
|
||||
public function __construct(string $host, int $level = Logger::DEBUG, bool $bubble = true, array $context = array())
|
||||
{
|
||||
parent::__construct($level, $bubble);
|
||||
|
||||
|
@ -68,10 +68,7 @@ class WebProcessorTest extends TestCase
|
||||
$this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function createRequestEvent($additionalServerParameters = array())
|
||||
private function createRequestEvent($additionalServerParameters = array()): array
|
||||
{
|
||||
$server = array_merge(
|
||||
array(
|
||||
@ -101,13 +98,7 @@ class WebProcessorTest extends TestCase
|
||||
return array($event, $server);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $level
|
||||
* @param string $message
|
||||
*
|
||||
* @return array Record
|
||||
*/
|
||||
private function getRecord($level = Logger::WARNING, $message = 'test')
|
||||
private function getRecord(int $level = Logger::WARNING, string $message = 'test'): array
|
||||
{
|
||||
return array(
|
||||
'message' => $message,
|
||||
|
@ -30,10 +30,7 @@ class ProxyDumper implements DumperInterface
|
||||
private $proxyGenerator;
|
||||
private $classGenerator;
|
||||
|
||||
/**
|
||||
* @param string $salt
|
||||
*/
|
||||
public function __construct($salt = '')
|
||||
public function __construct(string $salt = '')
|
||||
{
|
||||
$this->salt = $salt;
|
||||
$this->proxyGenerator = new LazyLoadingValueHolderGenerator();
|
||||
|
@ -37,11 +37,8 @@ class ProxyDumperTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider getProxyCandidates
|
||||
*
|
||||
* @param Definition $definition
|
||||
* @param bool $expected
|
||||
*/
|
||||
public function testIsProxyCandidate(Definition $definition, $expected)
|
||||
public function testIsProxyCandidate(Definition $definition, bool $expected)
|
||||
{
|
||||
$this->assertSame($expected, $this->dumper->isProxyCandidate($definition));
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ class DebugCommand extends Command
|
||||
private $twig;
|
||||
private $projectDir;
|
||||
|
||||
public function __construct(Environment $twig, $projectDir = null)
|
||||
public function __construct(Environment $twig, string $projectDir = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
@ -31,7 +31,7 @@ class CodeExtension extends AbstractExtension
|
||||
* @param string $rootDir The project root directory
|
||||
* @param string $charset The charset
|
||||
*/
|
||||
public function __construct($fileLinkFormat, $rootDir, $charset)
|
||||
public function __construct($fileLinkFormat, string $rootDir, string $charset)
|
||||
{
|
||||
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, dirname($rootDir)).DIRECTORY_SEPARATOR;
|
||||
|
@ -25,7 +25,7 @@ class StopwatchExtension extends AbstractExtension
|
||||
private $stopwatch;
|
||||
private $enabled;
|
||||
|
||||
public function __construct(Stopwatch $stopwatch = null, $enabled = true)
|
||||
public function __construct(Stopwatch $stopwatch = null, bool $enabled = true)
|
||||
{
|
||||
$this->stopwatch = $stopwatch;
|
||||
$this->enabled = $enabled;
|
||||
|
@ -21,7 +21,7 @@ class DumpNode extends Node
|
||||
{
|
||||
private $varPrefix;
|
||||
|
||||
public function __construct($varPrefix, Node $values = null, $lineno, $tag = null)
|
||||
public function __construct($varPrefix, Node $values = null, int $lineno, string $tag = null)
|
||||
{
|
||||
$nodes = array();
|
||||
if (null !== $values) {
|
||||
|
@ -20,9 +20,9 @@ use Twig\Node\Node;
|
||||
*/
|
||||
class FormThemeNode extends Node
|
||||
{
|
||||
public function __construct(Node $form, Node $resources, $lineno, $tag = null, $only = false)
|
||||
public function __construct(Node $form, Node $resources, int $lineno, string $tag = null, bool $only = false)
|
||||
{
|
||||
parent::__construct(array('form' => $form, 'resources' => $resources), array('only' => (bool) $only), $lineno, $tag);
|
||||
parent::__construct(array('form' => $form, 'resources' => $resources), array('only' => $only), $lineno, $tag);
|
||||
}
|
||||
|
||||
public function compile(Compiler $compiler)
|
||||
|
@ -22,7 +22,7 @@ use Twig\Node\Node;
|
||||
*/
|
||||
class StopwatchNode extends Node
|
||||
{
|
||||
public function __construct(Node $name, Node $body, AssignNameExpression $var, $lineno = 0, $tag = null)
|
||||
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, string $tag = null)
|
||||
{
|
||||
parent::__construct(array('body' => $body, 'name' => $name, 'var' => $var), array(), $lineno, $tag);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ use Twig\Node\Node;
|
||||
*/
|
||||
class TransDefaultDomainNode extends Node
|
||||
{
|
||||
public function __construct(AbstractExpression $expr, $lineno = 0, $tag = null)
|
||||
public function __construct(AbstractExpression $expr, int $lineno = 0, string $tag = null)
|
||||
{
|
||||
parent::__construct(array('expr' => $expr), array(), $lineno, $tag);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class_exists('Twig\Node\Expression\ArrayExpression');
|
||||
*/
|
||||
class TransNode extends Node
|
||||
{
|
||||
public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, $lineno = 0, $tag = null)
|
||||
public function __construct(Node $body, Node $domain = null, AbstractExpression $count = null, AbstractExpression $vars = null, AbstractExpression $locale = null, int $lineno = 0, string $tag = null)
|
||||
{
|
||||
$nodes = array('body' => $body);
|
||||
if (null !== $domain) {
|
||||
|
@ -103,29 +103,20 @@ class TranslationNodeVisitor extends AbstractNodeVisitor
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node $arguments
|
||||
* @param int $index
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private function getReadDomainFromArguments(Node $arguments, $index)
|
||||
private function getReadDomainFromArguments(Node $arguments, int $index): ?string
|
||||
{
|
||||
if ($arguments->hasNode('domain')) {
|
||||
$argument = $arguments->getNode('domain');
|
||||
} elseif ($arguments->hasNode($index)) {
|
||||
$argument = $arguments->getNode($index);
|
||||
} else {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->getReadDomainFromNode($argument);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
private function getReadDomainFromNode(Node $node)
|
||||
private function getReadDomainFromNode(Node $node): ?string
|
||||
{
|
||||
if ($node instanceof ConstantExpression) {
|
||||
return $node->getAttribute('value');
|
||||
|
@ -25,7 +25,7 @@ class StopwatchTokenParser extends AbstractTokenParser
|
||||
{
|
||||
protected $stopwatchIsAvailable;
|
||||
|
||||
public function __construct($stopwatchIsAvailable)
|
||||
public function __construct(bool $stopwatchIsAvailable)
|
||||
{
|
||||
$this->stopwatchIsAvailable = $stopwatchIsAvailable;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
||||
*/
|
||||
public function __construct($phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
public function __construct(string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
{
|
||||
$this->phpArrayFile = $phpArrayFile;
|
||||
if (!$fallbackPool instanceof AdapterInterface) {
|
||||
|
@ -33,7 +33,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered annotations are cached
|
||||
*/
|
||||
public function __construct(Reader $annotationReader, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
public function __construct(Reader $annotationReader, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
{
|
||||
parent::__construct($phpArrayFile, $fallbackPool);
|
||||
$this->annotationReader = $annotationReader;
|
||||
|
@ -35,7 +35,7 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
||||
*/
|
||||
public function __construct(array $loaders, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
public function __construct(array $loaders, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
{
|
||||
parent::__construct($phpArrayFile, $fallbackPool);
|
||||
$this->loaders = $loaders;
|
||||
|
@ -34,7 +34,7 @@ class TemplateFinder implements TemplateFinderInterface
|
||||
* @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
|
||||
* @param string $rootDir The directory where global templates can be stored
|
||||
*/
|
||||
public function __construct(KernelInterface $kernel, TemplateNameParserInterface $parser, $rootDir)
|
||||
public function __construct(KernelInterface $kernel, TemplateNameParserInterface $parser, string $rootDir)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->parser = $parser;
|
||||
|
@ -37,7 +37,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
||||
*/
|
||||
public function __construct(ValidatorBuilderInterface $validatorBuilder, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
public function __construct(ValidatorBuilderInterface $validatorBuilder, string $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
{
|
||||
parent::__construct($phpArrayFile, $fallbackPool);
|
||||
$this->validatorBuilder = $validatorBuilder;
|
||||
|
@ -37,10 +37,6 @@ class CacheClearCommand extends Command
|
||||
private $cacheClearer;
|
||||
private $filesystem;
|
||||
|
||||
/**
|
||||
* @param CacheClearerInterface $cacheClearer
|
||||
* @param Filesystem|null $filesystem
|
||||
*/
|
||||
public function __construct(CacheClearerInterface $cacheClearer, Filesystem $filesystem = null)
|
||||
{
|
||||
parent::__construct();
|
||||
@ -79,7 +75,7 @@ EOF
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$kernel = $this->getApplication()->getKernel();
|
||||
$realCacheDir = isset($realCacheDir) ? $realCacheDir : $kernel->getContainer()->getParameter('kernel.cache_dir');
|
||||
$realCacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
|
||||
// the old cache dir name must not be longer than the real one to avoid exceeding
|
||||
// the maximum length of a directory or file path within it (esp. Windows MAX_PATH)
|
||||
$oldCacheDir = substr($realCacheDir, 0, -1).('~' === substr($realCacheDir, -1) ? '+' : '~');
|
||||
|
@ -31,7 +31,7 @@ final class CachePoolPruneCommand extends Command
|
||||
/**
|
||||
* @param iterable|PruneableInterface[] $pools
|
||||
*/
|
||||
public function __construct($pools)
|
||||
public function __construct(iterable $pools)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
|
@ -207,13 +207,7 @@ class JsonDescriptor extends Descriptor
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $definition
|
||||
* @param bool $omitTags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getContainerDefinitionData(Definition $definition, $omitTags = false, $showArguments = false)
|
||||
private function getContainerDefinitionData(Definition $definition, bool $omitTags = false, bool $showArguments = false): array
|
||||
{
|
||||
$data = array(
|
||||
'class' => (string) $definition->getClass(),
|
||||
@ -267,10 +261,7 @@ class JsonDescriptor extends Descriptor
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getContainerAliasData(Alias $alias)
|
||||
private function getContainerAliasData(Alias $alias): array
|
||||
{
|
||||
return array(
|
||||
'service' => (string) $alias,
|
||||
@ -278,13 +269,7 @@ class JsonDescriptor extends Descriptor
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param string|null $event
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getEventDispatcherListenersData(EventDispatcherInterface $eventDispatcher, $event = null)
|
||||
private function getEventDispatcherListenersData(EventDispatcherInterface $eventDispatcher, string $event = null): array
|
||||
{
|
||||
$data = array();
|
||||
|
||||
@ -310,13 +295,7 @@ class JsonDescriptor extends Descriptor
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callable
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getCallableData($callable, array $options = array())
|
||||
private function getCallableData($callable, array $options = array()): array
|
||||
{
|
||||
$data = array();
|
||||
|
||||
|
@ -426,12 +426,7 @@ class TextDescriptor extends Descriptor
|
||||
$io->table($tableHeaders, $tableRows);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function formatRouterConfig(array $config)
|
||||
private function formatRouterConfig(array $config): string
|
||||
{
|
||||
if (empty($config)) {
|
||||
return 'NONE';
|
||||
@ -447,12 +442,7 @@ class TextDescriptor extends Descriptor
|
||||
return trim($configAsString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function formatCallable($callable)
|
||||
private function formatCallable($callable): string
|
||||
{
|
||||
if (is_array($callable)) {
|
||||
if (is_object($callable[0])) {
|
||||
@ -477,11 +467,7 @@ class TextDescriptor extends Descriptor
|
||||
throw new \InvalidArgumentException('Callable is not describable.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
* @param array $options
|
||||
*/
|
||||
private function writeText($content, array $options = array())
|
||||
private function writeText(string $content, array $options = array())
|
||||
{
|
||||
$this->write(
|
||||
isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
|
||||
|
@ -141,10 +141,7 @@ class XmlDescriptor extends Descriptor
|
||||
$this->write($dom->saveXML());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getRouteCollectionDocument(RouteCollection $routes)
|
||||
private function getRouteCollectionDocument(RouteCollection $routes): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($routesXML = $dom->createElement('routes'));
|
||||
@ -157,13 +154,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Route $route
|
||||
* @param string|null $name
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getRouteDocument(Route $route, $name = null)
|
||||
private function getRouteDocument(Route $route, string $name = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($routeXML = $dom->createElement('route'));
|
||||
@ -226,10 +217,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerParametersDocument(ParameterBag $parameters)
|
||||
private function getContainerParametersDocument(ParameterBag $parameters): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($parametersXML = $dom->createElement('parameters'));
|
||||
@ -243,13 +231,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param bool $showPrivate
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerTagsDocument(ContainerBuilder $builder, $showPrivate = false)
|
||||
private function getContainerTagsDocument(ContainerBuilder $builder, bool $showPrivate = false): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($containerXML = $dom->createElement('container'));
|
||||
@ -267,15 +249,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $service
|
||||
* @param string $id
|
||||
* @param ContainerBuilder|null $builder
|
||||
* @param bool $showArguments
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerServiceDocument($service, $id, ContainerBuilder $builder = null, $showArguments = false)
|
||||
private function getContainerServiceDocument($service, string $id, ContainerBuilder $builder = null, bool $showArguments = false): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
@ -295,16 +269,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param string|null $tag
|
||||
* @param bool $showPrivate
|
||||
* @param bool $showArguments
|
||||
* @param callable $filter
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerServicesDocument(ContainerBuilder $builder, $tag = null, $showPrivate = false, $showArguments = false, $filter = null)
|
||||
private function getContainerServicesDocument(ContainerBuilder $builder, string $tag = null, bool $showPrivate = false, bool $showArguments = false, callable $filter = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($containerXML = $dom->createElement('container'));
|
||||
@ -329,14 +294,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $definition
|
||||
* @param string|null $id
|
||||
* @param bool $omitTags
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerDefinitionDocument(Definition $definition, $id = null, $omitTags = false, $showArguments = false)
|
||||
private function getContainerDefinitionDocument(Definition $definition, string $id = null, bool $omitTags = false, bool $showArguments = false): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($serviceXML = $dom->createElement('definition'));
|
||||
@ -453,13 +411,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Alias $alias
|
||||
* @param string|null $id
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerAliasDocument(Alias $alias, $id = null)
|
||||
private function getContainerAliasDocument(Alias $alias, string $id = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($aliasXML = $dom->createElement('alias'));
|
||||
@ -474,10 +426,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getContainerParameterDocument($parameter, $options = array())
|
||||
private function getContainerParameterDocument($parameter, $options = array()): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($parameterXML = $dom->createElement('parameter'));
|
||||
@ -491,13 +440,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param string|null $event
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getEventDispatcherListenersDocument(EventDispatcherInterface $eventDispatcher, $event = null)
|
||||
private function getEventDispatcherListenersDocument(EventDispatcherInterface $eventDispatcher, string $event = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($eventDispatcherXML = $dom->createElement('event-dispatcher'));
|
||||
@ -529,12 +472,7 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param callable $callable
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getCallableDocument($callable)
|
||||
private function getCallableDocument($callable): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($callableXML = $dom->createElement('callable'));
|
||||
|
@ -29,13 +29,11 @@ abstract class Controller implements ContainerAwareInterface
|
||||
/**
|
||||
* Gets a container configuration parameter by its name.
|
||||
*
|
||||
* @param string $name The parameter name
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function getParameter($name)
|
||||
protected function getParameter(string $name)
|
||||
{
|
||||
return $this->container->getParameter($name);
|
||||
}
|
||||
|
@ -106,12 +106,8 @@ class ControllerNameParser
|
||||
|
||||
/**
|
||||
* Attempts to find a bundle that is *similar* to the given bundle name.
|
||||
*
|
||||
* @param string $nonExistentBundleName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function findAlternative($nonExistentBundleName)
|
||||
private function findAlternative(string $nonExistentBundleName): ?string
|
||||
{
|
||||
$bundleNames = array_map(function ($b) {
|
||||
return $b->getName();
|
||||
|
@ -42,13 +42,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Returns true if the service id is defined.
|
||||
*
|
||||
* @param string $id The service id
|
||||
*
|
||||
* @return bool true if the service id is defined, false otherwise
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function has($id)
|
||||
protected function has(string $id): bool
|
||||
{
|
||||
return $this->container->has($id);
|
||||
}
|
||||
@ -56,13 +52,11 @@ trait ControllerTrait
|
||||
/**
|
||||
* Gets a container service by its id.
|
||||
*
|
||||
* @param string $id The service id
|
||||
*
|
||||
* @return object The service
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function get($id)
|
||||
protected function get(string $id)
|
||||
{
|
||||
return $this->container->get($id);
|
||||
}
|
||||
@ -70,17 +64,11 @@ trait ControllerTrait
|
||||
/**
|
||||
* Generates a URL from the given parameters.
|
||||
*
|
||||
* @param string $route The name of the route
|
||||
* @param array $parameters An array of parameters
|
||||
* @param int $referenceType The type of reference (one of the constants in UrlGeneratorInterface)
|
||||
*
|
||||
* @return string The generated URL
|
||||
*
|
||||
* @see UrlGeneratorInterface
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function generateUrl($route, $parameters = array(), $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
|
||||
protected function generateUrl(string $route, array $parameters = array(), int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): string
|
||||
{
|
||||
return $this->container->get('router')->generate($route, $parameters, $referenceType);
|
||||
}
|
||||
@ -89,14 +77,10 @@ trait ControllerTrait
|
||||
* Forwards the request to another controller.
|
||||
*
|
||||
* @param string $controller The controller name (a string like BlogBundle:Post:index)
|
||||
* @param array $path An array of path parameters
|
||||
* @param array $query An array of query parameters
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function forward($controller, array $path = array(), array $query = array())
|
||||
protected function forward(string $controller, array $path = array(), array $query = array()): Response
|
||||
{
|
||||
$request = $this->container->get('request_stack')->getCurrentRequest();
|
||||
$path['_forwarded'] = $request->attributes;
|
||||
@ -109,14 +93,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Returns a RedirectResponse to the given URL.
|
||||
*
|
||||
* @param string $url The URL to redirect to
|
||||
* @param int $status The status code to use for the Response
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function redirect($url, $status = 302)
|
||||
protected function redirect(string $url, int $status = 302): RedirectResponse
|
||||
{
|
||||
return new RedirectResponse($url, $status);
|
||||
}
|
||||
@ -124,15 +103,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Returns a RedirectResponse to the given route with the given parameters.
|
||||
*
|
||||
* @param string $route The name of the route
|
||||
* @param array $parameters An array of parameters
|
||||
* @param int $status The status code to use for the Response
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function redirectToRoute($route, array $parameters = array(), $status = 302)
|
||||
protected function redirectToRoute(string $route, array $parameters = array(), int $status = 302): RedirectResponse
|
||||
{
|
||||
return $this->redirect($this->generateUrl($route, $parameters), $status);
|
||||
}
|
||||
@ -140,16 +113,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
|
||||
*
|
||||
* @param mixed $data The response data
|
||||
* @param int $status The status code to use for the Response
|
||||
* @param array $headers Array of extra headers to add
|
||||
* @param array $context Context to pass to serializer when using serializer component
|
||||
*
|
||||
* @return JsonResponse
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function json($data, $status = 200, $headers = array(), $context = array())
|
||||
protected function json($data, int $status = 200, array $headers = array(), array $context = array()): JsonResponse
|
||||
{
|
||||
if ($this->container->has('serializer')) {
|
||||
$json = $this->container->get('serializer')->serialize($data, 'json', array_merge(array(
|
||||
@ -166,14 +132,10 @@ trait ControllerTrait
|
||||
* Returns a BinaryFileResponse object with original or customized file name and disposition header.
|
||||
*
|
||||
* @param \SplFileInfo|string $file File object or path to file to be sent as response
|
||||
* @param string|null $fileName File name to be sent to response or null (will use original file name)
|
||||
* @param string $disposition Disposition of response ("attachment" is default, other type is "inline")
|
||||
*
|
||||
* @return BinaryFileResponse
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function file($file, $fileName = null, $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT)
|
||||
protected function file($file, string $fileName = null, string $disposition = ResponseHeaderBag::DISPOSITION_ATTACHMENT): BinaryFileResponse
|
||||
{
|
||||
$response = new BinaryFileResponse($file);
|
||||
$response->setContentDisposition($disposition, null === $fileName ? $response->getFile()->getFilename() : $fileName);
|
||||
@ -184,14 +146,11 @@ trait ControllerTrait
|
||||
/**
|
||||
* Adds a flash message to the current session for type.
|
||||
*
|
||||
* @param string $type The type
|
||||
* @param string $message The message
|
||||
*
|
||||
* @throws \LogicException
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function addFlash($type, $message)
|
||||
protected function addFlash(string $type, string $message)
|
||||
{
|
||||
if (!$this->container->has('session')) {
|
||||
throw new \LogicException('You can not use the addFlash method if sessions are disabled.');
|
||||
@ -203,16 +162,11 @@ trait ControllerTrait
|
||||
/**
|
||||
* Checks if the attributes are granted against the current authentication token and optionally supplied subject.
|
||||
*
|
||||
* @param mixed $attributes The attributes
|
||||
* @param mixed $subject The subject
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \LogicException
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function isGranted($attributes, $subject = null)
|
||||
protected function isGranted($attributes, $subject = null): bool
|
||||
{
|
||||
if (!$this->container->has('security.authorization_checker')) {
|
||||
throw new \LogicException('The SecurityBundle is not registered in your application.');
|
||||
@ -225,15 +179,11 @@ trait ControllerTrait
|
||||
* Throws an exception unless the attributes are granted against the current authentication token and optionally
|
||||
* supplied subject.
|
||||
*
|
||||
* @param mixed $attributes The attributes
|
||||
* @param mixed $subject The subject
|
||||
* @param string $message The message passed to the exception
|
||||
*
|
||||
* @throws AccessDeniedException
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function denyAccessUnlessGranted($attributes, $subject = null, $message = 'Access Denied.')
|
||||
protected function denyAccessUnlessGranted($attributes, $subject = null, string $message = 'Access Denied.')
|
||||
{
|
||||
if (!$this->isGranted($attributes, $subject)) {
|
||||
$exception = $this->createAccessDeniedException($message);
|
||||
@ -247,14 +197,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Returns a rendered view.
|
||||
*
|
||||
* @param string $view The view name
|
||||
* @param array $parameters An array of parameters to pass to the view
|
||||
*
|
||||
* @return string The rendered view
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function renderView($view, array $parameters = array())
|
||||
protected function renderView(string $view, array $parameters = array()): string
|
||||
{
|
||||
if ($this->container->has('templating')) {
|
||||
return $this->container->get('templating')->render($view, $parameters);
|
||||
@ -270,15 +215,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Renders a view.
|
||||
*
|
||||
* @param string $view The view name
|
||||
* @param array $parameters An array of parameters to pass to the view
|
||||
* @param Response $response A response instance
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function render($view, array $parameters = array(), Response $response = null)
|
||||
protected function render(string $view, array $parameters = array(), Response $response = null): Response
|
||||
{
|
||||
if ($this->container->has('templating')) {
|
||||
$content = $this->container->get('templating')->render($view, $parameters);
|
||||
@ -300,15 +239,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Streams a view.
|
||||
*
|
||||
* @param string $view The view name
|
||||
* @param array $parameters An array of parameters to pass to the view
|
||||
* @param StreamedResponse $response A response instance
|
||||
*
|
||||
* @return StreamedResponse A StreamedResponse instance
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function stream($view, array $parameters = array(), StreamedResponse $response = null)
|
||||
protected function stream(string $view, array $parameters = array(), StreamedResponse $response = null): StreamedResponse
|
||||
{
|
||||
if ($this->container->has('templating')) {
|
||||
$templating = $this->container->get('templating');
|
||||
@ -342,14 +275,9 @@ trait ControllerTrait
|
||||
*
|
||||
* throw $this->createNotFoundException('Page not found!');
|
||||
*
|
||||
* @param string $message A message
|
||||
* @param \Exception|null $previous The previous exception
|
||||
*
|
||||
* @return NotFoundHttpException
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function createNotFoundException($message = 'Not Found', \Exception $previous = null)
|
||||
protected function createNotFoundException(string $message = 'Not Found', \Exception $previous = null): NotFoundHttpException
|
||||
{
|
||||
return new NotFoundHttpException($message, $previous);
|
||||
}
|
||||
@ -361,14 +289,9 @@ trait ControllerTrait
|
||||
*
|
||||
* throw $this->createAccessDeniedException('Unable to access this page!');
|
||||
*
|
||||
* @param string $message A message
|
||||
* @param \Exception|null $previous The previous exception
|
||||
*
|
||||
* @return AccessDeniedException
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function createAccessDeniedException($message = 'Access Denied.', \Exception $previous = null)
|
||||
protected function createAccessDeniedException(string $message = 'Access Denied.', \Exception $previous = null): AccessDeniedException
|
||||
{
|
||||
return new AccessDeniedException($message, $previous);
|
||||
}
|
||||
@ -376,15 +299,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Creates and returns a Form instance from the type of the form.
|
||||
*
|
||||
* @param string $type The fully qualified class name of the form type
|
||||
* @param mixed $data The initial data for the form
|
||||
* @param array $options Options for the form
|
||||
*
|
||||
* @return FormInterface
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function createForm($type, $data = null, array $options = array())
|
||||
protected function createForm(string $type, $data = null, array $options = array()): FormInterface
|
||||
{
|
||||
return $this->container->get('form.factory')->create($type, $data, $options);
|
||||
}
|
||||
@ -392,14 +309,9 @@ trait ControllerTrait
|
||||
/**
|
||||
* Creates and returns a form builder instance.
|
||||
*
|
||||
* @param mixed $data The initial data for the form
|
||||
* @param array $options Options for the form
|
||||
*
|
||||
* @return FormBuilderInterface
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function createFormBuilder($data = null, array $options = array())
|
||||
protected function createFormBuilder($data = null, array $options = array()): FormBuilderInterface
|
||||
{
|
||||
return $this->container->get('form.factory')->createBuilder(FormType::class, $data, $options);
|
||||
}
|
||||
@ -407,13 +319,11 @@ trait ControllerTrait
|
||||
/**
|
||||
* Shortcut to return the Doctrine Registry service.
|
||||
*
|
||||
* @return ManagerRegistry
|
||||
*
|
||||
* @throws \LogicException If DoctrineBundle is not available
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function getDoctrine()
|
||||
protected function getDoctrine(): ManagerRegistry
|
||||
{
|
||||
if (!$this->container->has('doctrine')) {
|
||||
throw new \LogicException('The DoctrineBundle is not registered in your application.');
|
||||
@ -457,11 +367,9 @@ trait ControllerTrait
|
||||
* @param string $id The id used when generating the token
|
||||
* @param string $token The actual token sent with the request that should be validated
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @final since version 3.4
|
||||
*/
|
||||
protected function isCsrfTokenValid($id, $token)
|
||||
protected function isCsrfTokenValid(string $id, string $token): bool
|
||||
{
|
||||
if (!$this->container->has('security.csrf.token_manager')) {
|
||||
throw new \LogicException('CSRF protection is not enabled in your application.');
|
||||
|
@ -27,7 +27,7 @@ class CachePoolPrunerPass implements CompilerPassInterface
|
||||
private $cacheCommandServiceId;
|
||||
private $cachePoolTag;
|
||||
|
||||
public function __construct($cacheCommandServiceId = CachePoolPruneCommand::class, $cachePoolTag = 'cache.pool')
|
||||
public function __construct(string $cacheCommandServiceId = CachePoolPruneCommand::class, string $cachePoolTag = 'cache.pool')
|
||||
{
|
||||
$this->cacheCommandServiceId = $cacheCommandServiceId;
|
||||
$this->cachePoolTag = $cachePoolTag;
|
||||
|
@ -38,9 +38,9 @@ class Configuration implements ConfigurationInterface
|
||||
/**
|
||||
* @param bool $debug Whether debugging is enabled or not
|
||||
*/
|
||||
public function __construct($debug)
|
||||
public function __construct(bool $debug)
|
||||
{
|
||||
$this->debug = (bool) $debug;
|
||||
$this->debug = $debug;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,7 +32,7 @@ abstract class HttpCache extends BaseHttpCache
|
||||
* @param HttpKernelInterface $kernel An HttpKernelInterface instance
|
||||
* @param string $cacheDir The cache directory (default used if null)
|
||||
*/
|
||||
public function __construct(HttpKernelInterface $kernel, $cacheDir = null)
|
||||
public function __construct(HttpKernelInterface $kernel, string $cacheDir = null)
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->cacheDir = $cacheDir;
|
||||
|
@ -28,7 +28,7 @@ class CodeHelper extends Helper
|
||||
* @param string $rootDir The project root directory
|
||||
* @param string $charset The charset
|
||||
*/
|
||||
public function __construct($fileLinkFormat, $rootDir, $charset)
|
||||
public function __construct($fileLinkFormat, string $rootDir, string $charset)
|
||||
{
|
||||
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->rootDir = str_replace('\\', '/', $rootDir).'/';
|
||||
|
@ -30,7 +30,7 @@ class TemplateLocator implements FileLocatorInterface
|
||||
* @param FileLocatorInterface $locator A FileLocatorInterface instance
|
||||
* @param string $cacheDir The cache path
|
||||
*/
|
||||
public function __construct(FileLocatorInterface $locator, $cacheDir = null)
|
||||
public function __construct(FileLocatorInterface $locator, string $cacheDir = null)
|
||||
{
|
||||
if (null !== $cacheDir && file_exists($cache = $cacheDir.'/templates.php')) {
|
||||
$this->cache = require $cache;
|
||||
|
@ -20,7 +20,7 @@ use Symfony\Component\Templating\TemplateReference as BaseTemplateReference;
|
||||
*/
|
||||
class TemplateReference extends BaseTemplateReference
|
||||
{
|
||||
public function __construct($bundle = null, $controller = null, $name = null, $format = null, $engine = null)
|
||||
public function __construct(string $bundle = null, string $controller = null, string $name = null, string $format = null, string $engine = null)
|
||||
{
|
||||
$this->parameters = array(
|
||||
'bundle' => $bundle,
|
||||
|
@ -33,10 +33,7 @@ class CachePruneCommandTest extends TestCase
|
||||
$tester->execute(array());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RewindableGenerator
|
||||
*/
|
||||
private function getRewindableGenerator()
|
||||
private function getRewindableGenerator(): RewindableGenerator
|
||||
{
|
||||
return new RewindableGenerator(function () {
|
||||
yield 'foo_pool' => $this->getPruneableInterfaceMock();
|
||||
@ -44,10 +41,7 @@ class CachePruneCommandTest extends TestCase
|
||||
}, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return RewindableGenerator
|
||||
*/
|
||||
private function getEmptyRewindableGenerator()
|
||||
private function getEmptyRewindableGenerator(): RewindableGenerator
|
||||
{
|
||||
return new RewindableGenerator(function () {
|
||||
return new \ArrayIterator(array());
|
||||
@ -96,10 +90,7 @@ class CachePruneCommandTest extends TestCase
|
||||
return $pruneable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return CommandTester
|
||||
*/
|
||||
private function getCommandTester(KernelInterface $kernel, RewindableGenerator $generator)
|
||||
private function getCommandTester(KernelInterface $kernel, RewindableGenerator $generator): CommandTester
|
||||
{
|
||||
$application = new Application($kernel);
|
||||
$application->add(new CachePoolPruneCommand($generator));
|
||||
|
@ -28,7 +28,7 @@ class FirewallMap implements FirewallMapInterface
|
||||
private $map;
|
||||
private $contexts;
|
||||
|
||||
public function __construct(ContainerInterface $container, $map)
|
||||
public function __construct(ContainerInterface $container, iterable $map)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->map = $map;
|
||||
|
@ -35,7 +35,7 @@ class ExceptionController
|
||||
* @param Environment $twig
|
||||
* @param bool $debug Show error (false) or exception (true) pages by default
|
||||
*/
|
||||
public function __construct(Environment $twig, $debug)
|
||||
public function __construct(Environment $twig, bool $debug)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
$this->debug = $debug;
|
||||
|
@ -30,7 +30,7 @@ class EnvironmentConfigurator
|
||||
private $decimalPoint;
|
||||
private $thousandsSeparator;
|
||||
|
||||
public function __construct($dateFormat, $intervalFormat, $timezone, $decimals, $decimalPoint, $thousandsSeparator)
|
||||
public function __construct(string $dateFormat, string $intervalFormat, ?string $timezone, int $decimals, string $decimalPoint, string $thousandsSeparator)
|
||||
{
|
||||
$this->dateFormat = $dateFormat;
|
||||
$this->intervalFormat = $intervalFormat;
|
||||
|
@ -31,7 +31,7 @@ class FilesystemLoader extends BaseFilesystemLoader
|
||||
/**
|
||||
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
|
||||
*/
|
||||
public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, $rootPath = null)
|
||||
public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, string $rootPath = null)
|
||||
{
|
||||
parent::__construct(array(), $rootPath);
|
||||
|
||||
|
@ -31,7 +31,7 @@ class TemplateIterator implements \IteratorAggregate
|
||||
* @param string $rootDir The directory where global templates can be stored
|
||||
* @param array $paths Additional Twig paths to warm
|
||||
*/
|
||||
public function __construct(KernelInterface $kernel, $rootDir, array $paths = array())
|
||||
public function __construct(KernelInterface $kernel, string $rootDir, array $paths = array())
|
||||
{
|
||||
$this->kernel = $kernel;
|
||||
$this->rootDir = $rootDir;
|
||||
|
@ -30,7 +30,7 @@ class ExceptionController
|
||||
protected $debug;
|
||||
protected $profiler;
|
||||
|
||||
public function __construct(Profiler $profiler = null, Environment $twig, $debug)
|
||||
public function __construct(Profiler $profiler = null, Environment $twig, bool $debug)
|
||||
{
|
||||
$this->profiler = $profiler;
|
||||
$this->twig = $twig;
|
||||
|
@ -35,15 +35,7 @@ class ProfilerController
|
||||
private $cspHandler;
|
||||
private $baseDir;
|
||||
|
||||
/**
|
||||
* @param UrlGeneratorInterface $generator The URL Generator
|
||||
* @param Profiler $profiler The profiler
|
||||
* @param Environment $twig The twig environment
|
||||
* @param array $templates The templates
|
||||
* @param ContentSecurityPolicyHandler $cspHandler The Content-Security-Policy handler
|
||||
* @param string $baseDir The project root directory
|
||||
*/
|
||||
public function __construct(UrlGeneratorInterface $generator, Profiler $profiler = null, Environment $twig, array $templates, ContentSecurityPolicyHandler $cspHandler = null, $baseDir = null)
|
||||
public function __construct(UrlGeneratorInterface $generator, Profiler $profiler = null, Environment $twig, array $templates, ContentSecurityPolicyHandler $cspHandler = null, string $baseDir = null)
|
||||
{
|
||||
$this->generator = $generator;
|
||||
$this->profiler = $profiler;
|
||||
|
@ -77,13 +77,8 @@ class RouterController
|
||||
|
||||
/**
|
||||
* Returns the routing traces associated to the given request.
|
||||
*
|
||||
* @param RequestDataCollector $request
|
||||
* @param string $method
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getTraces(RequestDataCollector $request, $method)
|
||||
private function getTraces(RequestDataCollector $request, string $method): array
|
||||
{
|
||||
$traceRequest = Request::create(
|
||||
$request->getPathInfo(),
|
||||
|
@ -43,12 +43,12 @@ class WebDebugToolbarListener implements EventSubscriberInterface
|
||||
protected $excludedAjaxPaths;
|
||||
private $cspHandler;
|
||||
|
||||
public function __construct(Environment $twig, $interceptRedirects = false, $mode = self::ENABLED, UrlGeneratorInterface $urlGenerator = null, $excludedAjaxPaths = '^/bundles|^/_wdt', ContentSecurityPolicyHandler $cspHandler = null)
|
||||
public function __construct(Environment $twig, bool $interceptRedirects = false, int $mode = self::ENABLED, UrlGeneratorInterface $urlGenerator = null, string $excludedAjaxPaths = '^/bundles|^/_wdt', ContentSecurityPolicyHandler $cspHandler = null)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
$this->urlGenerator = $urlGenerator;
|
||||
$this->interceptRedirects = (bool) $interceptRedirects;
|
||||
$this->mode = (int) $mode;
|
||||
$this->interceptRedirects = $interceptRedirects;
|
||||
$this->mode = $mode;
|
||||
$this->excludedAjaxPaths = $excludedAjaxPaths;
|
||||
$this->cspHandler = $cspHandler;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class ServerRunCommand extends Command
|
||||
|
||||
protected static $defaultName = 'server:run';
|
||||
|
||||
public function __construct($documentRoot = null, $environment = null)
|
||||
public function __construct(string $documentRoot = null, string $environment = null)
|
||||
{
|
||||
$this->documentRoot = $documentRoot;
|
||||
$this->environment = $environment;
|
||||
|
@ -33,7 +33,7 @@ class ServerStartCommand extends Command
|
||||
|
||||
protected static $defaultName = 'server:start';
|
||||
|
||||
public function __construct($documentRoot = null, $environment = null)
|
||||
public function __construct(string $documentRoot = null, string $environment = null)
|
||||
{
|
||||
$this->documentRoot = $documentRoot;
|
||||
$this->environment = $environment;
|
||||
|
@ -22,7 +22,7 @@ class WebServerConfig
|
||||
private $env;
|
||||
private $router;
|
||||
|
||||
public function __construct($documentRoot, $env, $address = null, $router = null)
|
||||
public function __construct(string $documentRoot, string $env, string $address = null, string $router = null)
|
||||
{
|
||||
if (!is_dir($documentRoot)) {
|
||||
throw new \InvalidArgumentException(sprintf('The document root directory "%s" does not exist.', $documentRoot));
|
||||
|
@ -33,7 +33,7 @@ class PathPackage extends Package
|
||||
* @param VersionStrategyInterface $versionStrategy The version strategy
|
||||
* @param ContextInterface|null $context The context
|
||||
*/
|
||||
public function __construct($basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
|
||||
public function __construct(string $basePath, VersionStrategyInterface $versionStrategy, ContextInterface $context = null)
|
||||
{
|
||||
parent::__construct($versionStrategy, $context);
|
||||
|
||||
|
@ -30,7 +30,7 @@ class JsonManifestVersionStrategy implements VersionStrategyInterface
|
||||
/**
|
||||
* @param string $manifestPath Absolute path to the manifest file
|
||||
*/
|
||||
public function __construct($manifestPath)
|
||||
public function __construct(string $manifestPath)
|
||||
{
|
||||
$this->manifestPath = $manifestPath;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class StaticVersionStrategy implements VersionStrategyInterface
|
||||
* @param string $version Version number
|
||||
* @param string $format Url format
|
||||
*/
|
||||
public function __construct($version, $format = null)
|
||||
public function __construct(string $version, string $format = null)
|
||||
{
|
||||
$this->version = $version;
|
||||
$this->format = $format ?: '%s?%s';
|
||||
|
@ -272,7 +272,7 @@ abstract class Client
|
||||
*
|
||||
* @return Crawler
|
||||
*/
|
||||
public function request($method, $uri, array $parameters = array(), array $files = array(), array $server = array(), $content = null, $changeHistory = true)
|
||||
public function request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
|
||||
{
|
||||
if ($this->isMainRequest) {
|
||||
$this->redirectCount = 0;
|
||||
|
@ -53,7 +53,7 @@ class Cookie
|
||||
* @param bool $httponly The cookie httponly flag
|
||||
* @param bool $encodedValue Whether the value is encoded or not
|
||||
*/
|
||||
public function __construct($name, $value, $expires = null, $path = null, $domain = '', $secure = false, $httponly = true, $encodedValue = false)
|
||||
public function __construct(string $name, ?string $value, string $expires = null, string $path = null, string $domain = '', bool $secure = false, bool $httponly = true, bool $encodedValue = false)
|
||||
{
|
||||
if ($encodedValue) {
|
||||
$this->value = urldecode($value);
|
||||
@ -65,8 +65,8 @@ class Cookie
|
||||
$this->name = $name;
|
||||
$this->path = empty($path) ? '/' : $path;
|
||||
$this->domain = $domain;
|
||||
$this->secure = (bool) $secure;
|
||||
$this->httponly = (bool) $httponly;
|
||||
$this->secure = $secure;
|
||||
$this->httponly = $httponly;
|
||||
|
||||
if (null !== $expires) {
|
||||
$timestampAsDateTime = \DateTime::createFromFormat('U', $expires);
|
||||
|
@ -33,7 +33,7 @@ class Request
|
||||
* @param array $server An array of server parameters
|
||||
* @param string $content The raw body data
|
||||
*/
|
||||
public function __construct($uri, $method, array $parameters = array(), array $files = array(), array $cookies = array(), array $server = array(), $content = null)
|
||||
public function __construct(string $uri, string $method, array $parameters = array(), array $files = array(), array $cookies = array(), array $server = array(), string $content = null)
|
||||
{
|
||||
$this->uri = $uri;
|
||||
$this->method = $method;
|
||||
|
@ -28,7 +28,7 @@ class Response
|
||||
* @param int $status The response status code
|
||||
* @param array $headers An array of headers
|
||||
*/
|
||||
public function __construct($content = '', $status = 200, array $headers = array())
|
||||
public function __construct(string $content = '', int $status = 200, array $headers = array())
|
||||
{
|
||||
$this->content = $content;
|
||||
$this->status = $status;
|
||||
|
@ -224,10 +224,7 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl
|
||||
return $this->pool->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Generator
|
||||
*/
|
||||
private function generateItems(array $keys)
|
||||
private function generateItems(array $keys): \Generator
|
||||
{
|
||||
$f = $this->createCacheItem;
|
||||
$fallbackKeys = array();
|
||||
|
@ -105,10 +105,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
return $this->data['instances']['calls'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function calculateStatistics()
|
||||
private function calculateStatistics(): array
|
||||
{
|
||||
$statistics = array();
|
||||
foreach ($this->data['instances']['calls'] as $name => $calls) {
|
||||
@ -160,10 +157,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter
|
||||
return $statistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function calculateTotalStatistics()
|
||||
private function calculateTotalStatistics(): array
|
||||
{
|
||||
$statistics = $this->getStatistics();
|
||||
$totals = array(
|
||||
|
@ -33,7 +33,7 @@ abstract class AbstractCache implements CacheInterface, LoggerAwareInterface, Re
|
||||
|
||||
protected function __construct(string $namespace = '', int $defaultLifetime = 0)
|
||||
{
|
||||
$this->defaultLifetime = max(0, (int) $defaultLifetime);
|
||||
$this->defaultLifetime = max(0, $defaultLifetime);
|
||||
$this->namespace = '' === $namespace ? '' : CacheItem::validateKey($namespace).':';
|
||||
if (null !== $this->maxIdLength && strlen($namespace) > $this->maxIdLength - 24) {
|
||||
throw new InvalidArgumentException(sprintf('Namespace must be %d chars max, %d given ("%s")', $this->maxIdLength - 24, strlen($namespace), $namespace));
|
||||
|
@ -36,7 +36,7 @@ class ArrayCache implements CacheInterface, LoggerAwareInterface, ResettableInte
|
||||
*/
|
||||
public function __construct(int $defaultLifetime = 0, bool $storeSerialized = true)
|
||||
{
|
||||
$this->defaultLifetime = (int) $defaultLifetime;
|
||||
$this->defaultLifetime = $defaultLifetime;
|
||||
$this->storeSerialized = $storeSerialized;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class ChainCache implements CacheInterface, PruneableInterface, ResettableInterf
|
||||
$this->miss = new \stdClass();
|
||||
$this->caches = array_values($caches);
|
||||
$this->cacheCount = count($this->caches);
|
||||
$this->defaultLifetime = 0 < $defaultLifetime ? (int) $defaultLifetime : null;
|
||||
$this->defaultLifetime = 0 < $defaultLifetime ? $defaultLifetime : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,9 +31,9 @@ class ConfigCache extends ResourceCheckerConfigCache
|
||||
* @param string $file The absolute cache path
|
||||
* @param bool $debug Whether debugging is enabled or not
|
||||
*/
|
||||
public function __construct($file, $debug)
|
||||
public function __construct(string $file, bool $debug)
|
||||
{
|
||||
$this->debug = (bool) $debug;
|
||||
$this->debug = $debug;
|
||||
|
||||
$checkers = array();
|
||||
if (true === $this->debug) {
|
||||
|
@ -27,7 +27,7 @@ class ConfigCacheFactory implements ConfigCacheFactoryInterface
|
||||
/**
|
||||
* @param bool $debug The debug flag to pass to ConfigCache
|
||||
*/
|
||||
public function __construct($debug)
|
||||
public function __construct(bool $debug)
|
||||
{
|
||||
$this->debug = $debug;
|
||||
}
|
||||
|
@ -34,12 +34,9 @@ abstract class BaseNode implements NodeInterface
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* @param string $name The name of the node
|
||||
* @param NodeInterface $parent The parent of this node
|
||||
*
|
||||
* @throws \InvalidArgumentException if the name contains a period
|
||||
*/
|
||||
public function __construct($name, NodeInterface $parent = null)
|
||||
public function __construct(?string $name, NodeInterface $parent = null)
|
||||
{
|
||||
if (false !== strpos($name, '.')) {
|
||||
throw new \InvalidArgumentException('The name must not contain ".".');
|
||||
|
@ -39,7 +39,7 @@ class ArrayNodeDefinition extends NodeDefinition implements ParentNodeDefinition
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($name, NodeParentInterface $parent = null)
|
||||
public function __construct(?string $name, NodeParentInterface $parent = null)
|
||||
{
|
||||
parent::__construct($name, $parent);
|
||||
|
||||
|
@ -24,7 +24,7 @@ class BooleanNodeDefinition extends ScalarNodeDefinition
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct($name, NodeParentInterface $parent = null)
|
||||
public function __construct(?string $name, NodeParentInterface $parent = null)
|
||||
{
|
||||
parent::__construct($name, $parent);
|
||||
|
||||
|
@ -36,11 +36,7 @@ abstract class NodeDefinition implements NodeParentInterface
|
||||
protected $parent;
|
||||
protected $attributes = array();
|
||||
|
||||
/**
|
||||
* @param string $name The name of the node
|
||||
* @param NodeParentInterface|null $parent The parent
|
||||
*/
|
||||
public function __construct($name, NodeParentInterface $parent = null)
|
||||
public function __construct(?string $name, NodeParentInterface $parent = null)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
$this->name = $name;
|
||||
|
@ -41,13 +41,7 @@ class XmlReferenceDumper
|
||||
return $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param NodeInterface $node
|
||||
* @param int $depth
|
||||
* @param bool $root If the node is the root node
|
||||
* @param string $namespace The namespace of the node
|
||||
*/
|
||||
private function writeNode(NodeInterface $node, $depth = 0, $root = false, $namespace = null)
|
||||
private function writeNode(NodeInterface $node, int $depth = 0, bool $root = false, string $namespace = null)
|
||||
{
|
||||
$rootName = ($root ? 'config' : $node->getName());
|
||||
$rootNamespace = ($namespace ?: ($root ? 'http://example.org/schema/dic/'.$node->getName() : null));
|
||||
@ -259,11 +253,8 @@ class XmlReferenceDumper
|
||||
|
||||
/**
|
||||
* Outputs a single config reference line.
|
||||
*
|
||||
* @param string $text
|
||||
* @param int $indent
|
||||
*/
|
||||
private function writeLine($text, $indent = 0)
|
||||
private function writeLine(string $text, int $indent = 0)
|
||||
{
|
||||
$indent = strlen($text) + $indent;
|
||||
$format = '%'.$indent.'s';
|
||||
@ -275,10 +266,8 @@ class XmlReferenceDumper
|
||||
* Renders the string conversion of the value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function writeValue($value)
|
||||
private function writeValue($value): string
|
||||
{
|
||||
if ('%%%%not_defined%%%%' === $value) {
|
||||
return '';
|
||||
|
@ -69,13 +69,7 @@ class YamlReferenceDumper
|
||||
return $ref;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param NodeInterface $node
|
||||
* @param NodeInterface|null $parentNode
|
||||
* @param int $depth
|
||||
* @param bool $prototypedArray
|
||||
*/
|
||||
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, $depth = 0, $prototypedArray = false)
|
||||
private function writeNode(NodeInterface $node, NodeInterface $parentNode = null, int $depth = 0, bool $prototypedArray = false)
|
||||
{
|
||||
$comments = array();
|
||||
$default = '';
|
||||
@ -179,11 +173,8 @@ class YamlReferenceDumper
|
||||
|
||||
/**
|
||||
* Outputs a single config reference line.
|
||||
*
|
||||
* @param string $text
|
||||
* @param int $indent
|
||||
*/
|
||||
private function writeLine($text, $indent = 0)
|
||||
private function writeLine(string $text, int $indent = 0)
|
||||
{
|
||||
$indent = strlen($text) + $indent;
|
||||
$format = '%'.$indent.'s';
|
||||
@ -214,12 +205,7 @@ class YamlReferenceDumper
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PrototypedArrayNode $node
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getPrototypeChildren(PrototypedArrayNode $node)
|
||||
private function getPrototypeChildren(PrototypedArrayNode $node): array
|
||||
{
|
||||
$prototype = $node->getPrototype();
|
||||
$key = $node->getKeyAttribute();
|
||||
|
@ -22,7 +22,7 @@ class EnumNode extends ScalarNode
|
||||
{
|
||||
private $values;
|
||||
|
||||
public function __construct($name, NodeInterface $parent = null, array $values = array())
|
||||
public function __construct(string $name, NodeInterface $parent = null, array $values = array())
|
||||
{
|
||||
$values = array_unique($values);
|
||||
if (empty($values)) {
|
||||
|
@ -23,7 +23,7 @@ class NumericNode extends ScalarNode
|
||||
protected $min;
|
||||
protected $max;
|
||||
|
||||
public function __construct($name, NodeInterface $parent = null, $min = null, $max = null)
|
||||
public function __construct(?string $name, NodeInterface $parent = null, $min = null, $max = null)
|
||||
{
|
||||
parent::__construct($name, $parent);
|
||||
$this->min = $min;
|
||||
|
@ -371,11 +371,9 @@ class PrototypedArrayNode extends ArrayNode
|
||||
* Now, the key becomes 'name001' and the child node becomes 'value001' and
|
||||
* the prototype of child node 'name001' should be a ScalarNode instead of an ArrayNode instance.
|
||||
*
|
||||
* @param string $key The key of the child node
|
||||
*
|
||||
* @return mixed The prototype instance
|
||||
*/
|
||||
private function getPrototypeForChild($key)
|
||||
private function getPrototypeForChild(string $key)
|
||||
{
|
||||
$prototype = isset($this->valuePrototypes[$key]) ? $this->valuePrototypes[$key] : $this->prototype;
|
||||
$prototype->setName($key);
|
||||
|
@ -18,7 +18,7 @@ namespace Symfony\Component\Config\Exception;
|
||||
*/
|
||||
class FileLoaderImportCircularReferenceException extends FileLoaderLoadException
|
||||
{
|
||||
public function __construct(array $resources, $code = null, $previous = null)
|
||||
public function __construct(array $resources, int $code = null, \Exception $previous = null)
|
||||
{
|
||||
$message = sprintf('Circular reference detected in "%s" ("%s" > "%s").', $this->varToString($resources[0]), implode('" > "', $resources), $resources[0]);
|
||||
|
||||
|
@ -25,7 +25,7 @@ class FileLoaderLoadException extends \Exception
|
||||
* @param \Exception $previous A previous exception
|
||||
* @param string $type The type of resource
|
||||
*/
|
||||
public function __construct($resource, $sourceResource = null, $code = null, $previous = null, $type = null)
|
||||
public function __construct(string $resource, string $sourceResource = null, int $code = null, \Exception $previous = null, string $type = null)
|
||||
{
|
||||
$message = '';
|
||||
if ($previous) {
|
||||
|
@ -20,7 +20,7 @@ class FileLocatorFileNotFoundException extends \InvalidArgumentException
|
||||
{
|
||||
private $paths;
|
||||
|
||||
public function __construct($message = '', $code = 0, $previous = null, array $paths = array())
|
||||
public function __construct(string $message = '', int $code = 0, \Exception $previous = null, array $paths = array())
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
|
@ -23,7 +23,7 @@ class FileLocator implements FileLocatorInterface
|
||||
protected $paths;
|
||||
|
||||
/**
|
||||
* @param string|array $paths A path or an array of paths where to look for resources
|
||||
* @param string|string[] $paths A path or an array of paths where to look for resources
|
||||
*/
|
||||
public function __construct($paths = array())
|
||||
{
|
||||
|
@ -32,12 +32,10 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
|
||||
* @param string $resource The fully-qualified class name
|
||||
* @param bool|null $exists Boolean when the existency check has already been done
|
||||
*/
|
||||
public function __construct($resource, $exists = null)
|
||||
public function __construct(string $resource, bool $exists = null)
|
||||
{
|
||||
$this->resource = $resource;
|
||||
if (null !== $exists) {
|
||||
$this->exists = (bool) $exists;
|
||||
}
|
||||
$this->exists = $exists;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,7 @@ class DirectoryResource implements SelfCheckingResourceInterface, \Serializable
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($resource, $pattern = null)
|
||||
public function __construct(string $resource, string $pattern = null)
|
||||
{
|
||||
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
|
||||
$this->pattern = $pattern;
|
||||
|
@ -28,9 +28,9 @@ class FileExistenceResource implements SelfCheckingResourceInterface, \Serializa
|
||||
/**
|
||||
* @param string $resource The file path to the resource
|
||||
*/
|
||||
public function __construct($resource)
|
||||
public function __construct(string $resource)
|
||||
{
|
||||
$this->resource = (string) $resource;
|
||||
$this->resource = $resource;
|
||||
$this->exists = file_exists($resource);
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ class FileResource implements SelfCheckingResourceInterface, \Serializable
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($resource)
|
||||
public function __construct(string $resource)
|
||||
{
|
||||
$this->resource = realpath($resource) ?: (file_exists($resource) ? $resource : false);
|
||||
|
||||
|
@ -35,7 +35,7 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface,
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($prefix, $pattern, $recursive)
|
||||
public function __construct(?string $prefix, string $pattern, bool $recursive)
|
||||
{
|
||||
$this->prefix = realpath($prefix) ?: (file_exists($prefix) ? $prefix : false);
|
||||
$this->pattern = $pattern;
|
||||
|
@ -22,7 +22,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
|
||||
private $excludedVendors = array();
|
||||
private $hash;
|
||||
|
||||
public function __construct(\ReflectionClass $classReflector, $excludedVendors = array())
|
||||
public function __construct(\ReflectionClass $classReflector, array $excludedVendors = array())
|
||||
{
|
||||
$this->className = $classReflector->name;
|
||||
$this->classReflector = $classReflector;
|
||||
|
@ -37,7 +37,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
|
||||
* @param string $file The absolute cache path
|
||||
* @param iterable|ResourceCheckerInterface[] $resourceCheckers The ResourceCheckers to use for the freshness check
|
||||
*/
|
||||
public function __construct($file, $resourceCheckers = array())
|
||||
public function __construct(string $file, iterable $resourceCheckers = array())
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->resourceCheckers = $resourceCheckers;
|
||||
|
@ -24,7 +24,7 @@ class ResourceCheckerConfigCacheFactory implements ConfigCacheFactoryInterface
|
||||
/**
|
||||
* @param iterable|ResourceCheckerInterface[] $resourceCheckers
|
||||
*/
|
||||
public function __construct($resourceCheckers = array())
|
||||
public function __construct(iterable $resourceCheckers = array())
|
||||
{
|
||||
$this->resourceCheckers = $resourceCheckers;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class Application
|
||||
* @param string $name The name of the application
|
||||
* @param string $version The version of the application
|
||||
*/
|
||||
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
|
||||
public function __construct(string $name = 'UNKNOWN', string $version = 'UNKNOWN')
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->version = $version;
|
||||
|
@ -66,7 +66,7 @@ class Command
|
||||
*
|
||||
* @throws LogicException When the command name is empty
|
||||
*/
|
||||
public function __construct($name = null)
|
||||
public function __construct(string $name = null)
|
||||
{
|
||||
$this->definition = new InputDefinition();
|
||||
|
||||
@ -636,11 +636,9 @@ class Command
|
||||
*
|
||||
* It must be non-empty and parts can optionally be separated by ":".
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @throws InvalidArgumentException When the name is invalid
|
||||
*/
|
||||
private function validateName($name)
|
||||
private function validateName(string $name)
|
||||
{
|
||||
if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
|
||||
throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
|
||||
|
@ -29,7 +29,7 @@ class AddConsoleCommandPass implements CompilerPassInterface
|
||||
private $commandLoaderServiceId;
|
||||
private $commandTag;
|
||||
|
||||
public function __construct($commandLoaderServiceId = 'console.command_loader', $commandTag = 'console.command')
|
||||
public function __construct(string $commandLoaderServiceId = 'console.command_loader', string $commandTag = 'console.command')
|
||||
{
|
||||
$this->commandLoaderServiceId = $commandLoaderServiceId;
|
||||
$this->commandTag = $commandTag;
|
||||
|
@ -43,12 +43,7 @@ class ApplicationDescription
|
||||
*/
|
||||
private $aliases;
|
||||
|
||||
/**
|
||||
* @param Application $application
|
||||
* @param string|null $namespace
|
||||
* @param bool $showHidden
|
||||
*/
|
||||
public function __construct(Application $application, $namespace = null, $showHidden = false)
|
||||
public function __construct(Application $application, string $namespace = null, bool $showHidden = false)
|
||||
{
|
||||
$this->application = $application;
|
||||
$this->namespace = $namespace;
|
||||
@ -123,10 +118,7 @@ class ApplicationDescription
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function sortCommands(array $commands)
|
||||
private function sortCommands(array $commands): array
|
||||
{
|
||||
$namespacedCommands = array();
|
||||
$globalCommands = array();
|
||||
|
@ -252,10 +252,8 @@ class TextDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* Formats command aliases to show them in the command description.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getCommandAliasesText(Command $command)
|
||||
private function getCommandAliasesText(Command $command): string
|
||||
{
|
||||
$text = '';
|
||||
$aliases = $command->getAliases();
|
||||
@ -271,10 +269,8 @@ class TextDescriptor extends Descriptor
|
||||
* Formats input option/argument default value.
|
||||
*
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function formatDefaultValue($default)
|
||||
private function formatDefaultValue($default): string
|
||||
{
|
||||
if (INF === $default) {
|
||||
return 'INF';
|
||||
@ -295,10 +291,8 @@ class TextDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* @param (Command|string)[] $commands
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getColumnWidth(array $commands)
|
||||
private function getColumnWidth(array $commands): int
|
||||
{
|
||||
$widths = array();
|
||||
|
||||
@ -318,10 +312,8 @@ class TextDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* @param InputOption[] $options
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function calculateTotalWidthForOptions(array $options)
|
||||
private function calculateTotalWidthForOptions(array $options): int
|
||||
{
|
||||
$totalWidth = 0;
|
||||
foreach ($options as $option) {
|
||||
|
@ -188,10 +188,7 @@ class XmlDescriptor extends Descriptor
|
||||
$this->write($dom->saveXML());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getInputArgumentDocument(InputArgument $argument)
|
||||
private function getInputArgumentDocument(InputArgument $argument): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
@ -212,10 +209,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
private function getInputOptionDocument(InputOption $option)
|
||||
private function getInputOptionDocument(InputOption $option): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
|
||||
|
@ -22,14 +22,9 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
*/
|
||||
class ConsoleTerminateEvent extends ConsoleEvent
|
||||
{
|
||||
/**
|
||||
* The exit code of the command.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $exitCode;
|
||||
|
||||
public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
|
||||
public function __construct(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
|
||||
{
|
||||
parent::__construct($command, $input, $output);
|
||||
|
||||
|
@ -26,7 +26,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
|
||||
* @param int $code Exception code
|
||||
* @param \Exception $previous Previous exception used for the exception chaining
|
||||
*/
|
||||
public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
|
||||
public function __construct(string $message, array $alternatives = array(), int $code = 0, \Exception $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user