some backports from master

This commit is contained in:
Nicolas Grekas 2019-08-20 18:24:39 +02:00
parent 31b668b8c4
commit 8073b8abfb
14 changed files with 48 additions and 60 deletions

View File

@ -206,11 +206,9 @@ abstract class Descriptor implements DescriptorInterface
}
/**
* @param string $serviceId
*
* @return mixed
*/
protected function resolveServiceDefinition(ContainerBuilder $builder, $serviceId)
protected function resolveServiceDefinition(ContainerBuilder $builder, string $serviceId)
{
if ($builder->hasDefinition($serviceId)) {
return $builder->getDefinition($serviceId);
@ -229,10 +227,7 @@ abstract class Descriptor implements DescriptorInterface
return $builder->get($serviceId);
}
/**
* @param bool $showHidden
*/
protected function findDefinitionsByTag(ContainerBuilder $builder, $showHidden): array
protected function findDefinitionsByTag(ContainerBuilder $builder, bool $showHidden): array
{
$definitions = [];
$tags = $builder->findTags();

View File

@ -59,8 +59,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
/**
* Initializes console output formatter.
*
* @param bool $decorated Whether this formatter should actually decorate strings
* @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
* @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
*/
public function __construct(bool $decorated = false, array $styles = [])
{

View File

@ -21,7 +21,7 @@ class ProxyHelper
/**
* @return string|null The FQCN or builtin name of the type hint, or null when the type hint references an invalid self|parent context
*/
public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, $noBuiltin = false): ?string
public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionParameter $p = null, bool $noBuiltin = false): ?string
{
if ($p instanceof \ReflectionParameter) {
$type = $p->getType();

View File

@ -22,7 +22,7 @@ class FormFieldRegistry
{
private $fields = [];
private $base;
private $base = '';
/**
* Adds a field to the registry.
@ -47,7 +47,7 @@ class FormFieldRegistry
}
/**
* Removes a field and its children from the registry.
* Removes a field based on the fully qualifed name and its children from the registry.
*/
public function remove(string $name)
{
@ -64,7 +64,7 @@ class FormFieldRegistry
}
/**
* Returns the value of the field and its children.
* Returns the value of the field based on the fully qualifed name and its children.
*
* @return mixed The value of the field
*
@ -86,7 +86,7 @@ class FormFieldRegistry
}
/**
* Tests whether the form has the given field.
* Tests whether the form has the given field based on the fully qualified name.
*
* @return bool Whether the form has the given field
*/
@ -102,7 +102,7 @@ class FormFieldRegistry
}
/**
* Set the value of a field and its children.
* Set the value of a field based on the fully qualified name and its children.
*
* @param mixed $value The value
*

View File

@ -51,7 +51,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir): array
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
{
return $scanner->scanLocales($sourceDir.'/curr');
}
@ -59,7 +59,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir)
{
$compiler->compile($sourceDir.'/curr', $tempDir);
$compiler->compile($sourceDir.'/misc/currencyNumericCodes.txt', $tempDir);
@ -76,7 +76,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale): ?array
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
{
$localeBundle = $reader->read($tempDir, $displayLocale);
@ -97,7 +97,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');
@ -110,7 +110,7 @@ class CurrencyDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');
$supplementalDataBundle = $reader->read($tempDir, 'supplementalData');

View File

@ -101,7 +101,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir): array
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
{
return $scanner->scanLocales($sourceDir.'/lang');
}
@ -109,7 +109,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir)
{
$compiler->compile($sourceDir.'/lang', $tempDir);
$compiler->compile($sourceDir.'/misc/metadata.txt', $tempDir);
@ -126,7 +126,7 @@ class LanguageDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale): ?array
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
{
$localeBundle = $reader->read($tempDir, $displayLocale);
@ -148,14 +148,14 @@ class LanguageDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
}
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');
$metadataBundle = $reader->read($tempDir, 'metadata');

View File

@ -36,7 +36,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir): array
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
{
$this->locales = $scanner->scanLocales($sourceDir.'/locales');
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
@ -48,7 +48,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir)
{
$filesystem = new Filesystem();
$filesystem->mkdir([
@ -74,7 +74,7 @@ class LocaleDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale): ?array
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
{
// Don't generate aliases, as they are resolved during runtime
// Unless an alias is needed as fallback for de-duplication purposes
@ -133,14 +133,14 @@ class LocaleDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
}
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
return [
'Locales' => $this->locales,

View File

@ -84,7 +84,7 @@ class RegionDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir): array
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
{
return $scanner->scanLocales($sourceDir.'/region');
}
@ -92,7 +92,7 @@ class RegionDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir)
{
$compiler->compile($sourceDir.'/region', $tempDir);
$compiler->compile($sourceDir.'/misc/metadata.txt', $tempDir);
@ -109,7 +109,7 @@ class RegionDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale): ?array
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
{
$localeBundle = $reader->read($tempDir, $displayLocale);
@ -131,14 +131,14 @@ class RegionDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
}
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');
$metadataBundle = $reader->read($tempDir, 'metadata');

View File

@ -38,7 +38,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir): array
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
{
return $scanner->scanLocales($sourceDir.'/lang');
}
@ -46,7 +46,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir)
{
$compiler->compile($sourceDir.'/lang', $tempDir);
}
@ -62,7 +62,7 @@ class ScriptDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale): ?array
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
{
$localeBundle = $reader->read($tempDir, $displayLocale);
@ -84,14 +84,14 @@ class ScriptDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
}
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');

View File

@ -42,7 +42,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function scanLocales(LocaleScanner $scanner, $sourceDir): array
protected function scanLocales(LocaleScanner $scanner, string $sourceDir): array
{
$this->localeAliases = $scanner->scanAliases($sourceDir.'/locales');
@ -52,7 +52,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, $sourceDir, $tempDir)
protected function compileTemporaryBundles(BundleCompilerInterface $compiler, string $sourceDir, string $tempDir)
{
$filesystem = new Filesystem();
$filesystem->mkdir($tempDir.'/region');
@ -75,7 +75,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForLocale(BundleEntryReaderInterface $reader, $tempDir, $displayLocale): ?array
protected function generateDataForLocale(BundleEntryReaderInterface $reader, string $tempDir, string $displayLocale): ?array
{
if (!$this->zoneToCountryMapping) {
$this->zoneToCountryMapping = self::generateZoneToCountryMapping($reader->read($tempDir, 'windowsZones'));
@ -126,7 +126,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForRoot(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForRoot(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');
@ -139,7 +139,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator
/**
* {@inheritdoc}
*/
protected function generateDataForMeta(BundleEntryReaderInterface $reader, $tempDir): ?array
protected function generateDataForMeta(BundleEntryReaderInterface $reader, string $tempDir): ?array
{
$rootBundle = $reader->read($tempDir, 'root');

View File

@ -24,17 +24,15 @@ interface PipesInterface
/**
* Returns an array of descriptors for the use of proc_open.
*
* @return array
*/
public function getDescriptors();
public function getDescriptors(): array;
/**
* Returns an array of filenames indexed by their related stream in case these pipes use temporary files.
*
* @return string[]
*/
public function getFiles();
public function getFiles(): array;
/**
* Reads data in file handles and pipes.
@ -44,21 +42,17 @@ interface PipesInterface
*
* @return string[] An array of read data indexed by their fd
*/
public function readAndWrite($blocking, $close = false);
public function readAndWrite(bool $blocking, bool $close = false): array;
/**
* Returns if the current state has open file handles or pipes.
*
* @return bool
*/
public function areOpen();
public function areOpen(): bool;
/**
* Returns if pipes are able to read output.
*
* @return bool
*/
public function haveReadSupport();
public function haveReadSupport(): bool;
/**
* Closes file handles and pipes.

View File

@ -89,7 +89,7 @@ class UnixPipes extends AbstractPipes
/**
* {@inheritdoc}
*/
public function readAndWrite($blocking, $close = false): array
public function readAndWrite(bool $blocking, bool $close = false): array
{
$this->unblock();
$w = $this->write();

View File

@ -126,7 +126,7 @@ class WindowsPipes extends AbstractPipes
/**
* {@inheritdoc}
*/
public function readAndWrite($blocking, $close = false): array
public function readAndWrite(bool $blocking, bool $close = false): array
{
$this->unblock();
$w = $this->write();

View File

@ -33,7 +33,7 @@ class RoutingConfigurator
$this->file = $file;
}
final public function import($resource, $type = null, $ignoreErrors = false): ImportConfigurator
final public function import($resource, string $type = null, bool $ignoreErrors = false): ImportConfigurator
{
$this->loader->setCurrentDir(\dirname($this->path));
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
@ -49,7 +49,7 @@ class RoutingConfigurator
return new ImportConfigurator($this->collection, $mergedCollection);
}
final public function collection($name = ''): CollectionConfigurator
final public function collection(string $name = ''): CollectionConfigurator
{
return new CollectionConfigurator($this->collection, $name);
}