minor #32480 [FrameworkBundle] Added type declarations where possible (derrabus)
This PR was merged into the 5.0-dev branch.
Discussion
----------
[FrameworkBundle] Added type declarations where possible
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #32179
| License | MIT
| Doc PR | N/A
Commits
-------
377f5ed8ba
[FrameworkBundle] Added type declarations where possible.
This commit is contained in:
commit
45148dd255
@ -69,10 +69,7 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $cacheDir
|
|
||||||
* @param ArrayAdapter $arrayAdapter
|
|
||||||
*
|
|
||||||
* @return bool false if there is nothing to warm-up
|
* @return bool false if there is nothing to warm-up
|
||||||
*/
|
*/
|
||||||
abstract protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter);
|
abstract protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
|
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter)
|
||||||
{
|
{
|
||||||
$annotatedClassPatterns = $cacheDir.'/annotations.map';
|
$annotatedClassPatterns = $cacheDir.'/annotations.map';
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function readAllComponents(Reader $reader, $class)
|
private function readAllComponents(Reader $reader, string $class)
|
||||||
{
|
{
|
||||||
$reflectionClass = new \ReflectionClass($class);
|
$reflectionClass = new \ReflectionClass($class);
|
||||||
$reader->getClassAnnotations($reflectionClass);
|
$reader->getClassAnnotations($reflectionClass);
|
||||||
|
@ -42,7 +42,7 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
|
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter)
|
||||||
{
|
{
|
||||||
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
|
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -43,7 +43,7 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function doWarmUp($cacheDir, ArrayAdapter $arrayAdapter)
|
protected function doWarmUp(string $cacheDir, ArrayAdapter $arrayAdapter)
|
||||||
{
|
{
|
||||||
if (!method_exists($this->validatorBuilder, 'getLoaders')) {
|
if (!method_exists($this->validatorBuilder, 'getLoaders')) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -55,7 +55,7 @@ abstract class AbstractConfigCommand extends ContainerDebugCommand
|
|||||||
/**
|
/**
|
||||||
* @return ExtensionInterface
|
* @return ExtensionInterface
|
||||||
*/
|
*/
|
||||||
protected function findExtension($name)
|
protected function findExtension(string $name)
|
||||||
{
|
{
|
||||||
$bundles = $this->initializeBundles();
|
$bundles = $this->initializeBundles();
|
||||||
$minScore = INF;
|
$minScore = INF;
|
||||||
|
@ -96,11 +96,8 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes content to output.
|
* Writes content to output.
|
||||||
*
|
|
||||||
* @param string $content
|
|
||||||
* @param bool $decorated
|
|
||||||
*/
|
*/
|
||||||
protected function write($content, $decorated = false)
|
protected function write(string $content, bool $decorated = false)
|
||||||
{
|
{
|
||||||
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
|
$this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
|
||||||
}
|
}
|
||||||
@ -224,12 +221,9 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $builder
|
|
||||||
* @param string $serviceId
|
|
||||||
*
|
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
protected function resolveServiceDefinition(ContainerBuilder $builder, $serviceId)
|
protected function resolveServiceDefinition(ContainerBuilder $builder, string $serviceId)
|
||||||
{
|
{
|
||||||
if ($builder->hasDefinition($serviceId)) {
|
if ($builder->hasDefinition($serviceId)) {
|
||||||
return $builder->getDefinition($serviceId);
|
return $builder->getDefinition($serviceId);
|
||||||
@ -249,12 +243,9 @@ abstract class Descriptor implements DescriptorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ContainerBuilder $builder
|
|
||||||
* @param bool $showHidden
|
|
||||||
*
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden)
|
protected function findDefinitionsByTag(ContainerBuilder $builder, bool $showHidden)
|
||||||
{
|
{
|
||||||
$definitions = [];
|
$definitions = [];
|
||||||
$tags = $builder->findTags();
|
$tags = $builder->findTags();
|
||||||
|
@ -139,7 +139,7 @@ class FrameworkBundle extends Bundle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addCompilerPassIfExists(ContainerBuilder $container, $class, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, $priority = 0)
|
private function addCompilerPassIfExists(ContainerBuilder $container, string $class, string $type = PassConfig::TYPE_BEFORE_OPTIMIZATION, int $priority = 0)
|
||||||
{
|
{
|
||||||
$container->addResource(new ClassExistenceResource($class));
|
$container->addResource(new ClassExistenceResource($class));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user