From 962dcfeed0bbfed1e5364f4f287d561fd63f305e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 22 Aug 2019 15:01:48 +0200 Subject: [PATCH] Add return types to internal & magic methods when possible --- .../DoctrineDataCollectorTest.php | 2 +- .../Tests/Fixtures/CompositeIntIdEntity.php | 2 +- .../Fixtures/CompositeStringIdEntity.php | 2 +- .../Bridge/Doctrine/Tests/Fixtures/Person.php | 2 +- .../SingleAssociationToIntIdEntity.php | 2 +- .../Tests/Fixtures/SingleIntIdEntity.php | 2 +- .../Fixtures/SingleStringCastableIdEntity.php | 4 ++-- .../Tests/Fixtures/SingleStringIdEntity.php | 2 +- .../Tests/Functional/app/AppKernel.php | 2 +- .../Tests/Kernel/ConcreteMicroKernel.php | 2 +- .../Bundle/TwigBundle/TemplateIterator.php | 2 +- .../Config/Resource/GlobResource.php | 3 +++ .../Component/Console/Helper/TableRows.php | 2 +- .../Tests/Formatter/OutputFormatterTest.php | 2 +- .../Tests/Helper/QuestionHelperTest.php | 2 +- .../Tests/Logger/ConsoleLoggerTest.php | 2 +- .../Argument/RewindableGenerator.php | 4 ++-- .../Fixtures/includes/ProjectExtension.php | 6 +++--- .../includes/ProjectWithXsdExtension.php | 6 +++--- .../ProjectWithXsdExtensionInPhar.phar | Bin 1161 -> 1185 bytes .../Tests/Fixtures/includes/classes.php | 6 +++--- .../Tests/Fixtures/includes/createphar.php | 6 +++--- .../ExcludeDirectoryFilterIterator.php | 3 +++ .../Finder/Iterator/SortableIterator.php | 3 +++ .../Finder/Tests/Iterator/Iterator.php | 2 +- .../DataCollector/FormDataCollector.php | 2 +- src/Symfony/Component/Form/FormBuilder.php | 2 +- .../Factory/DefaultChoiceListFactoryTest.php | 2 +- .../Form/Tests/Fixtures/CustomArrayObject.php | 8 ++++---- .../Component/Form/Tests/SimpleFormTest.php | 4 ++-- .../Form/Util/InheritDataAwareIterator.php | 2 +- .../Component/Form/Util/OrderedHashMap.php | 6 +++--- .../Form/Util/OrderedHashMapIterator.php | 2 +- .../Handler/AbstractSessionHandler.php | 10 +++++----- .../Handler/MemcachedSessionHandler.php | 6 +++--- .../Handler/MigratingSessionHandler.php | 16 ++++++++-------- .../Storage/Handler/MongoDbSessionHandler.php | 6 +++--- .../Storage/Handler/NullSessionHandler.php | 8 ++++---- .../Storage/Handler/PdoSessionHandler.php | 10 +++++----- .../Storage/Handler/RedisSessionHandler.php | 2 +- .../Storage/Handler/StrictSessionHandler.php | 10 +++++----- .../Storage/Proxy/SessionHandlerProxy.php | 16 ++++++++-------- .../HttpFoundation/Tests/ResponseTest.php | 2 +- .../DataCollector/DumpDataCollector.php | 2 +- .../Controller/ControllerResolverTest.php | 2 +- .../Component/HttpKernel/Tests/KernelTest.php | 1 - .../HttpKernel/Tests/Log/LoggerTest.php | 2 +- .../Util/ArrayAccessibleResourceBundle.php | 6 +++--- .../Component/Intl/Data/Util/RingBuffer.php | 2 +- .../Ldap/Adapter/ExtLdap/Collection.php | 9 +++++++++ src/Symfony/Component/Ldap/Tests/LdapTest.php | 3 ++- src/Symfony/Component/Lock/Key.php | 2 +- src/Symfony/Component/Mime/RawMessage.php | 2 +- src/Symfony/Component/Process/InputStream.php | 3 +++ .../Fixtures/NonTraversableArrayObject.php | 6 +++--- .../Tests/Fixtures/TraversableArrayObject.php | 8 ++++---- .../Component/Routing/CompiledRoute.php | 2 ++ src/Symfony/Component/Routing/Route.php | 2 ++ .../Authentication/Token/AbstractToken.php | 3 +-- .../Exception/AuthenticationException.php | 2 +- .../AuthenticationTrustResolverTest.php | 2 +- .../Token/AbstractTokenTest.php | 2 +- .../Security/Core/Tests/SecurityTest.php | 2 +- .../Component/Security/Core/User/User.php | 2 +- .../FormLoginAuthenticatorTest.php | 4 ++-- ...PasswordFormAuthenticationListenerTest.php | 2 +- .../Tests/Fixtures/TraversableDummy.php | 2 +- .../Tests/Fixtures/SimpleHelper.php | 2 +- .../Translation/Tests/TranslatorTest.php | 2 +- .../Validator/ConstraintViolationList.php | 4 ++-- .../AbstractComparisonValidatorTestCase.php | 2 +- .../Tests/Constraints/BicValidatorTest.php | 2 +- .../Tests/Constraints/UrlValidatorTest.php | 2 +- .../Validator/Tests/Fixtures/Countable.php | 2 +- .../Tests/Fixtures/CustomArrayObject.php | 8 ++++---- .../Validator/Tests/Fixtures/ToString.php | 2 +- .../Component/VarDumper/Cloner/Data.php | 9 +++++++++ .../Component/VarDumper/Cloner/Stub.php | 2 +- .../VarExporter/Tests/VarExporterTest.php | 12 ++++++------ .../Workflow/TransitionBlockerList.php | 2 +- 80 files changed, 171 insertions(+), 138 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php index 6a33f0680a..b9c9d51b71 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/DataCollector/DoctrineDataCollectorTest.php @@ -205,7 +205,7 @@ class DoctrineDataCollectorTest extends TestCase class StringRepresentableClass { - public function __toString() + public function __toString(): string { return 'string representation'; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeIntIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeIntIdEntity.php index 8a9b00ddc7..7c64cc20ad 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeIntIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeIntIdEntity.php @@ -34,7 +34,7 @@ class CompositeIntIdEntity $this->name = $name; } - public function __toString() + public function __toString(): string { return $this->name; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeStringIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeStringIdEntity.php index 0755a89e6a..d6e8d2cd2a 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeStringIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/CompositeStringIdEntity.php @@ -34,7 +34,7 @@ class CompositeStringIdEntity $this->name = $name; } - public function __toString() + public function __toString(): string { return $this->name; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Person.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Person.php index 6e383394be..b90a54ac02 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Person.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Person.php @@ -38,7 +38,7 @@ class Person $this->name = $name; } - public function __toString() + public function __toString(): string { return (string) $this->name; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php index 5cd6d40796..bed8bb9a51 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php @@ -31,7 +31,7 @@ class SingleAssociationToIntIdEntity $this->name = $name; } - public function __toString() + public function __toString(): string { return (string) $this->name; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIntIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIntIdEntity.php index ff29145e33..612566b45d 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIntIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIntIdEntity.php @@ -33,7 +33,7 @@ class SingleIntIdEntity $this->name = $name; } - public function __toString() + public function __toString(): string { return (string) $this->name; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringCastableIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringCastableIdEntity.php index e457f69dd0..128801a02c 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringCastableIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringCastableIdEntity.php @@ -35,7 +35,7 @@ class SingleStringCastableIdEntity $this->name = $name; } - public function __toString() + public function __toString(): string { return (string) $this->name; } @@ -50,7 +50,7 @@ class StringCastableObjectIdentity $this->id = $id; } - public function __toString() + public function __toString(): string { return (string) $this->id; } diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringIdEntity.php index 3e25e2aea5..83f7a9f9ab 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringIdEntity.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleStringIdEntity.php @@ -30,7 +30,7 @@ class SingleStringIdEntity $this->name = $name; } - public function __toString() + public function __toString(): string { return $this->name; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 0ea364b196..0d329582b3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -79,7 +79,7 @@ class AppKernel extends Kernel $container->register('logger', NullLogger::class); } - public function __sleep() + public function __sleep(): array { return ['varDir', 'testCase', 'rootConfig', 'environment', 'debug']; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php index 7e6bb34810..954eef5948 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php @@ -64,7 +64,7 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface return $this->cacheDir; } - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } diff --git a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php index b96a18318b..2f33a9ed31 100644 --- a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php +++ b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php @@ -43,7 +43,7 @@ class TemplateIterator implements \IteratorAggregate } /** - * {@inheritdoc} + * @return \Traversable */ public function getIterator() { diff --git a/src/Symfony/Component/Config/Resource/GlobResource.php b/src/Symfony/Component/Config/Resource/GlobResource.php index e33cafc6e0..ad7531dcd5 100644 --- a/src/Symfony/Component/Config/Resource/GlobResource.php +++ b/src/Symfony/Component/Config/Resource/GlobResource.php @@ -91,6 +91,9 @@ class GlobResource implements \IteratorAggregate, SelfCheckingResourceInterface return ['prefix', 'pattern', 'recursive', 'hash', 'forExclusion', 'excludedPrefixes']; } + /** + * @return \Traversable + */ public function getIterator() { if (!file_exists($this->prefix) || (!$this->recursive && '' === $this->pattern)) { diff --git a/src/Symfony/Component/Console/Helper/TableRows.php b/src/Symfony/Component/Console/Helper/TableRows.php index 4809daf1ca..16aabb3fc9 100644 --- a/src/Symfony/Component/Console/Helper/TableRows.php +++ b/src/Symfony/Component/Console/Helper/TableRows.php @@ -23,7 +23,7 @@ class TableRows implements \IteratorAggregate $this->generator = $generator; } - public function getIterator() + public function getIterator(): \Traversable { $g = $this->generator; diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index 440088822b..1bd2b5d57b 100644 --- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -339,7 +339,7 @@ EOF class TableCell { - public function __toString() + public function __toString(): string { return 'some info'; } diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php index f9122a74c8..83d01f6818 100644 --- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php @@ -835,7 +835,7 @@ class AutocompleteValues implements \IteratorAggregate $this->values = $values; } - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator($this->values); } diff --git a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php index ef115767ef..0f5884136b 100644 --- a/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php +++ b/src/Symfony/Component/Console/Tests/Logger/ConsoleLoggerTest.php @@ -204,7 +204,7 @@ class ConsoleLoggerTest extends TestCase class DummyTest { - public function __toString() + public function __toString(): string { } } diff --git a/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php b/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php index b00a36c34f..41fec786fd 100644 --- a/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php +++ b/src/Symfony/Component/DependencyInjection/Argument/RewindableGenerator.php @@ -28,14 +28,14 @@ class RewindableGenerator implements \IteratorAggregate, \Countable $this->count = $count; } - public function getIterator() + public function getIterator(): \Traversable { $g = $this->generator; return $g(); } - public function count() + public function count(): int { if (\is_callable($count = $this->count)) { $this->count = $count(); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php index 81ea2b18bb..4dee6add01 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php @@ -25,17 +25,17 @@ class ProjectExtension implements ExtensionInterface return $configuration; } - public function getXsdValidationBasePath() + public function getXsdValidationBasePath(): string { return false; } - public function getNamespace() + public function getNamespace(): string { return 'http://www.example.com/schema/project'; } - public function getAlias() + public function getAlias(): string { return 'project'; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php index 2ee2f12dc8..f457abd2a3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php @@ -2,17 +2,17 @@ class ProjectWithXsdExtension extends ProjectExtension { - public function getXsdValidationBasePath() + public function getXsdValidationBasePath(): string { return __DIR__.'/schema'; } - public function getNamespace() + public function getNamespace(): string { return 'http://www.example.com/schema/projectwithxsd'; } - public function getAlias() + public function getAlias(): string { return 'projectwithxsd'; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar index 040e136a342520de248a1e0ae9006bd67a732b1b..93d4e87c0b89b6295ecf024eb6ec7dc8c30c0f05 100644 GIT binary patch delta 116 zcmeC=T*$eBn^CZZk%8gC#JE@x?Z5x_wOV diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 29913a8556..f3a490691a 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -83,17 +83,17 @@ class MethodCallClass class DummyProxyDumper implements ProxyDumper { - public function isProxyCandidate(Definition $definition) + public function isProxyCandidate(Definition $definition): bool { return $definition->isLazy(); } - public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null) + public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null): string { return " // lazy factory for {$definition->getClass()}\n\n"; } - public function getProxyCode(Definition $definition) + public function getProxyCode(Definition $definition): string { return "// proxy code for {$definition->getClass()}\n"; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php index c675478fd6..3ad4a8cf0e 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php @@ -11,17 +11,17 @@ $phar->addFromString('ProjectWithXsdExtensionInPhar.php', <<<'EOT' class ProjectWithXsdExtensionInPhar extends ProjectExtension { - public function getXsdValidationBasePath() + public function getXsdValidationBasePath(): string { return __DIR__.'/schema'; } - public function getNamespace() + public function getNamespace(): string { return 'http://www.example.com/schema/projectwithxsdinphar'; } - public function getAlias() + public function getAlias(): string { return 'projectwithxsdinphar'; } diff --git a/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php b/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php index eb37f1310e..6a1b291ade 100644 --- a/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -68,6 +68,9 @@ class ExcludeDirectoryFilterIterator extends \FilterIterator implements \Recursi return true; } + /** + * @return bool + */ public function hasChildren() { return $this->isRecursive && $this->iterator->hasChildren(); diff --git a/src/Symfony/Component/Finder/Iterator/SortableIterator.php b/src/Symfony/Component/Finder/Iterator/SortableIterator.php index eda093fa2c..cc955a7108 100644 --- a/src/Symfony/Component/Finder/Iterator/SortableIterator.php +++ b/src/Symfony/Component/Finder/Iterator/SortableIterator.php @@ -80,6 +80,9 @@ class SortableIterator implements \IteratorAggregate } } + /** + * @return \Traversable + */ public function getIterator() { if (1 === $this->sort) { diff --git a/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php b/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php index 3e21a07004..bc2eb53b39 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/Iterator.php @@ -33,7 +33,7 @@ class Iterator implements \Iterator reset($this->values); } - public function valid() + public function valid(): bool { return false !== $this->current(); } diff --git a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php index df7726a83f..ee600878f2 100644 --- a/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php +++ b/src/Symfony/Component/Form/Extension/DataCollector/FormDataCollector.php @@ -234,7 +234,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf /** * @internal */ - public function __sleep() + public function __sleep(): array { foreach ($this->data['forms_by_hash'] as &$form) { if (isset($form['type_class']) && !$form['type_class'] instanceof ClassStub) { diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 87b4485a6f..e9c7213a98 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -158,7 +158,7 @@ class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormB } /** - * {@inheritdoc} + * @return int */ public function count() { diff --git a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php index b39f67acb7..4472bd06c9 100644 --- a/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php +++ b/src/Symfony/Component/Form/Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php @@ -860,7 +860,7 @@ class DefaultChoiceListFactoryTest_Castable $this->property = $property; } - public function __toString() + public function __toString(): string { return $this->property; } diff --git a/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php b/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php index 47fa14090e..5c12b6b400 100644 --- a/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php +++ b/src/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php @@ -24,7 +24,7 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, $this->array = $array ?: []; } - public function offsetExists($offset) + public function offsetExists($offset): bool { return \array_key_exists($offset, $this->array); } @@ -48,12 +48,12 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, unset($this->array[$offset]); } - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator($this->array); } - public function count() + public function count(): int { return \count($this->array); } @@ -63,7 +63,7 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, return $this->array; } - public function serialize() + public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 33f815891b..949885222e 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -32,7 +32,7 @@ class SimpleFormTest_Countable implements \Countable $this->count = $count; } - public function count() + public function count(): int { return $this->count; } @@ -47,7 +47,7 @@ class SimpleFormTest_Traversable implements \IteratorAggregate $this->iterator = new \ArrayIterator($count > 0 ? array_fill(0, $count, 'Foo') : []); } - public function getIterator() + public function getIterator(): \Traversable { return $this->iterator; } diff --git a/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php b/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php index b48549c6e0..ec93757059 100644 --- a/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php +++ b/src/Symfony/Component/Form/Util/InheritDataAwareIterator.php @@ -34,7 +34,7 @@ class InheritDataAwareIterator extends \IteratorIterator implements \RecursiveIt } /** - * {@inheritdoc} + * @return bool */ public function hasChildren() { diff --git a/src/Symfony/Component/Form/Util/OrderedHashMap.php b/src/Symfony/Component/Form/Util/OrderedHashMap.php index 19ec4fc7d2..5d67b3124e 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMap.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMap.php @@ -99,7 +99,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable } /** - * {@inheritdoc} + * @return bool */ public function offsetExists($key) { @@ -157,7 +157,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable } /** - * {@inheritdoc} + * @return \Traversable */ public function getIterator() { @@ -165,7 +165,7 @@ class OrderedHashMap implements \ArrayAccess, \IteratorAggregate, \Countable } /** - * {@inheritdoc} + * @return int */ public function count() { diff --git a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php index c34bf2e39b..323fdd2329 100644 --- a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php +++ b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php @@ -128,7 +128,7 @@ class OrderedHashMapIterator implements \Iterator /** * {@inheritdoc} */ - public function valid() + public function valid(): bool { return null !== $this->key; } diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php index 78340efbd2..bcde59ee6b 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -29,7 +29,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess private $igbinaryEmptyData; /** - * {@inheritdoc} + * @return bool */ public function open($savePath, $sessionName) { @@ -64,7 +64,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess abstract protected function doDestroy($sessionId); /** - * {@inheritdoc} + * @return bool */ public function validateId($sessionId) { @@ -75,7 +75,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess } /** - * {@inheritdoc} + * @return string */ public function read($sessionId) { @@ -98,7 +98,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess } /** - * {@inheritdoc} + * @return bool */ public function write($sessionId, $data) { @@ -115,7 +115,7 @@ abstract class AbstractSessionHandler implements \SessionHandlerInterface, \Sess } /** - * {@inheritdoc} + * @return bool */ public function destroy($sessionId) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index 3faa336f69..7a528e655a 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -55,7 +55,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function close() { @@ -71,7 +71,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { @@ -99,7 +99,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php index 5293d2448a..ccf23de7eb 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MigratingSessionHandler.php @@ -39,7 +39,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return bool */ public function close() { @@ -50,7 +50,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return bool */ public function destroy($sessionId) { @@ -61,7 +61,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { @@ -72,7 +72,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return bool */ public function open($savePath, $sessionName) { @@ -83,7 +83,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return string */ public function read($sessionId) { @@ -92,7 +92,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return bool */ public function write($sessionId, $sessionData) { @@ -103,7 +103,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return bool */ public function validateId($sessionId) { @@ -112,7 +112,7 @@ class MigratingSessionHandler implements \SessionHandlerInterface, \SessionUpdat } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $sessionData) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 53d9369e8d..ad1bd24d4f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -80,7 +80,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function close() { @@ -100,7 +100,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { @@ -134,7 +134,7 @@ class MongoDbSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php index 8d193155b0..ba06396046 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php @@ -19,7 +19,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; class NullSessionHandler extends AbstractSessionHandler { /** - * {@inheritdoc} + * @return bool */ public function close() { @@ -27,7 +27,7 @@ class NullSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function validateId($sessionId) { @@ -43,7 +43,7 @@ class NullSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { @@ -67,7 +67,7 @@ class NullSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 043252cd31..0cd1296c09 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -260,7 +260,7 @@ class PdoSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function open($savePath, $sessionName) { @@ -274,7 +274,7 @@ class PdoSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return string */ public function read($sessionId) { @@ -288,7 +288,7 @@ class PdoSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { @@ -367,7 +367,7 @@ class PdoSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { @@ -391,7 +391,7 @@ class PdoSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function close() { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php index c2e7d34dcf..752e58f73f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/RedisSessionHandler.php @@ -104,7 +104,7 @@ class RedisSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php index 83a1f2c063..31a39a6973 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/StrictSessionHandler.php @@ -31,7 +31,7 @@ class StrictSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function open($savePath, $sessionName) { @@ -49,7 +49,7 @@ class StrictSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { @@ -65,7 +65,7 @@ class StrictSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function destroy($sessionId) { @@ -86,7 +86,7 @@ class StrictSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return bool */ public function close() { @@ -94,7 +94,7 @@ class StrictSessionHandler extends AbstractSessionHandler } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index b11cc397a0..8034b7a46b 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -36,7 +36,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf // \SessionHandlerInterface /** - * {@inheritdoc} + * @return bool */ public function open($savePath, $sessionName) { @@ -44,7 +44,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return bool */ public function close() { @@ -52,7 +52,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return string */ public function read($sessionId) { @@ -60,7 +60,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return bool */ public function write($sessionId, $data) { @@ -68,7 +68,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return bool */ public function destroy($sessionId) { @@ -76,7 +76,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return int */ public function gc($maxlifetime) { @@ -84,7 +84,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return bool */ public function validateId($sessionId) { @@ -92,7 +92,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf } /** - * {@inheritdoc} + * @return bool */ public function updateTimestamp($sessionId, $data) { diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 03b29653e8..edce7dbf4b 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -1054,7 +1054,7 @@ class ResponseTest extends ResponseTestCase class StringableObject { - public function __toString() + public function __toString(): string { return 'Foo'; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 408d6d31a2..7ace03ae68 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -148,7 +148,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface /** * @internal */ - public function __sleep() + public function __sleep(): array { if (!$this->dataCount) { $this->data = []; diff --git a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index 77ce524fc6..014b21e83a 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -203,7 +203,7 @@ class ControllerTest { } - public function __toString() + public function __toString(): string { return ''; } diff --git a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 35304bc982..3d82538279 100644 --- a/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -21,7 +21,6 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; -use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; diff --git a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php index c89146aff5..c562af1bcb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Log/LoggerTest.php @@ -200,7 +200,7 @@ class LoggerTest extends TestCase class DummyTest { - public function __toString() + public function __toString(): string { } } diff --git a/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php b/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php index d1de8d5b09..037f704df7 100644 --- a/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php +++ b/src/Symfony/Component/Intl/Data/Util/ArrayAccessibleResourceBundle.php @@ -39,7 +39,7 @@ class ArrayAccessibleResourceBundle implements \ArrayAccess, \IteratorAggregate, return $value instanceof \ResourceBundle ? new static($value) : $value; } - public function offsetExists($offset) + public function offsetExists($offset): bool { return null !== $this->bundleImpl->get($offset); } @@ -59,12 +59,12 @@ class ArrayAccessibleResourceBundle implements \ArrayAccess, \IteratorAggregate, throw new BadMethodCallException('Resource bundles cannot be modified.'); } - public function getIterator() + public function getIterator(): \Traversable { return $this->bundleImpl; } - public function count() + public function count(): int { return $this->bundleImpl->count(); } diff --git a/src/Symfony/Component/Intl/Data/Util/RingBuffer.php b/src/Symfony/Component/Intl/Data/Util/RingBuffer.php index 9b4a860594..db33a4fc15 100644 --- a/src/Symfony/Component/Intl/Data/Util/RingBuffer.php +++ b/src/Symfony/Component/Intl/Data/Util/RingBuffer.php @@ -42,7 +42,7 @@ class RingBuffer implements \ArrayAccess /** * {@inheritdoc} */ - public function offsetExists($key) + public function offsetExists($key): bool { return isset($this->indices[$key]); } diff --git a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php index 4aa9663dc9..2f3d22743d 100644 --- a/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php +++ b/src/Symfony/Component/Ldap/Adapter/ExtLdap/Collection.php @@ -42,6 +42,9 @@ class Collection implements CollectionInterface return $this->entries; } + /** + * @return int + */ public function count() { $con = $this->connection->getResource(); @@ -58,6 +61,9 @@ class Collection implements CollectionInterface return $count; } + /** + * @return \Traversable + */ public function getIterator() { if (0 === $this->count()) { @@ -81,6 +87,9 @@ class Collection implements CollectionInterface } } + /** + * @return bool + */ public function offsetExists($offset) { $this->toArray(); diff --git a/src/Symfony/Component/Ldap/Tests/LdapTest.php b/src/Symfony/Component/Ldap/Tests/LdapTest.php index 68e9da2451..881a15a4b2 100644 --- a/src/Symfony/Component/Ldap/Tests/LdapTest.php +++ b/src/Symfony/Component/Ldap/Tests/LdapTest.php @@ -55,8 +55,9 @@ class LdapTest extends TestCase ->expects($this->once()) ->method('escape') ->with('foo', 'bar', 'baz') - ->willReturn(''); + ->willReturn('') ; + $this->ldap->escape('foo', 'bar', 'baz'); } diff --git a/src/Symfony/Component/Lock/Key.php b/src/Symfony/Component/Lock/Key.php index 798e571d00..c53892ab6b 100644 --- a/src/Symfony/Component/Lock/Key.php +++ b/src/Symfony/Component/Lock/Key.php @@ -27,7 +27,7 @@ final class Key $this->resource = $resource; } - public function __toString() + public function __toString(): string { return $this->resource; } diff --git a/src/Symfony/Component/Mime/RawMessage.php b/src/Symfony/Component/Mime/RawMessage.php index 17501ec1d0..8a01049e51 100644 --- a/src/Symfony/Component/Mime/RawMessage.php +++ b/src/Symfony/Component/Mime/RawMessage.php @@ -54,7 +54,7 @@ class RawMessage implements \Serializable /** * @internal */ - final public function serialize() + final public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Process/InputStream.php b/src/Symfony/Component/Process/InputStream.php index 426ffa33a3..c952daf592 100644 --- a/src/Symfony/Component/Process/InputStream.php +++ b/src/Symfony/Component/Process/InputStream.php @@ -66,6 +66,9 @@ class InputStream implements \IteratorAggregate return !$this->open; } + /** + * @return \Traversable + */ public function getIterator() { $this->open = true; diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php index cb659f907c..cf02ee69f2 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/NonTraversableArrayObject.php @@ -24,7 +24,7 @@ class NonTraversableArrayObject implements \ArrayAccess, \Countable, \Serializab $this->array = $array ?: []; } - public function offsetExists($offset) + public function offsetExists($offset): bool { return \array_key_exists($offset, $this->array); } @@ -48,7 +48,7 @@ class NonTraversableArrayObject implements \ArrayAccess, \Countable, \Serializab unset($this->array[$offset]); } - public function count() + public function count(): int { return \count($this->array); } @@ -58,7 +58,7 @@ class NonTraversableArrayObject implements \ArrayAccess, \Countable, \Serializab return $this->array; } - public function serialize() + public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php index ba5ec36e76..5693c6b73e 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TraversableArrayObject.php @@ -24,7 +24,7 @@ class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Count $this->array = $array ?: []; } - public function offsetExists($offset) + public function offsetExists($offset): bool { return \array_key_exists($offset, $this->array); } @@ -48,12 +48,12 @@ class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Count unset($this->array[$offset]); } - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator($this->array); } - public function count() + public function count(): int { return \count($this->array); } @@ -63,7 +63,7 @@ class TraversableArrayObject implements \ArrayAccess, \IteratorAggregate, \Count return $this->array; } - public function serialize() + public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Routing/CompiledRoute.php b/src/Symfony/Component/Routing/CompiledRoute.php index 87278e702a..b6f31b2ebe 100644 --- a/src/Symfony/Component/Routing/CompiledRoute.php +++ b/src/Symfony/Component/Routing/CompiledRoute.php @@ -64,6 +64,8 @@ class CompiledRoute implements \Serializable } /** + * @return string + * * @internal since Symfony 4.3 * @final since Symfony 4.3 */ diff --git a/src/Symfony/Component/Routing/Route.php b/src/Symfony/Component/Routing/Route.php index b402665b92..03ec76e0dd 100644 --- a/src/Symfony/Component/Routing/Route.php +++ b/src/Symfony/Component/Routing/Route.php @@ -78,6 +78,8 @@ class Route implements \Serializable } /** + * @return string + * * @internal since Symfony 4.3 * @final since Symfony 4.3 */ diff --git a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php index ce16144639..6c9903c780 100644 --- a/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php +++ b/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php @@ -163,10 +163,9 @@ abstract class AbstractToken implements TokenInterface } /** - * {@inheritdoc} + * @return string * * @final since Symfony 4.3, use __serialize() instead - * * @internal since Symfony 4.3, use __serialize() instead */ public function serialize() diff --git a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php index 94e8d24cb7..1cfec5352f 100644 --- a/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php +++ b/src/Symfony/Component/Security/Core/Exception/AuthenticationException.php @@ -113,7 +113,7 @@ class AuthenticationException extends RuntimeException /** * @internal */ - public function __sleep() + public function __sleep(): array { if (__CLASS__ !== $c = (new \ReflectionMethod($this, 'serialize'))->getDeclaringClass()->name) { @trigger_error(sprintf('Implementing the "%s::serialize()" method is deprecated since Symfony 4.3, implement the __serialize() and __unserialize() methods instead.', $c), E_USER_DEPRECATED); diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php index 3556f4afea..a446e61602 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/AuthenticationTrustResolverTest.php @@ -152,7 +152,7 @@ class FakeCustomToken implements TokenInterface { } - public function serialize() + public function serialize(): string { } diff --git a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php index c8b5fed8d7..fe0ed08cc6 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authentication/Token/AbstractTokenTest.php @@ -259,7 +259,7 @@ class TestUser $this->name = $name; } - public function __toString() + public function __toString(): string { return $this->name; } diff --git a/src/Symfony/Component/Security/Core/Tests/SecurityTest.php b/src/Symfony/Component/Security/Core/Tests/SecurityTest.php index e30b14e7f9..49f6f8dbe3 100644 --- a/src/Symfony/Component/Security/Core/Tests/SecurityTest.php +++ b/src/Symfony/Component/Security/Core/Tests/SecurityTest.php @@ -122,7 +122,7 @@ class SecurityTest extends TestCase class StringishUser { - public function __toString() + public function __toString(): string { return 'stringish_user'; } diff --git a/src/Symfony/Component/Security/Core/User/User.php b/src/Symfony/Component/Security/Core/User/User.php index cd763821c8..ce41c02a1c 100644 --- a/src/Symfony/Component/Security/Core/User/User.php +++ b/src/Symfony/Component/Security/Core/User/User.php @@ -45,7 +45,7 @@ final class User implements UserInterface, EquatableInterface, AdvancedUserInter $this->extraFields = $extraFields; } - public function __toString() + public function __toString(): string { return $this->getUsername(); } diff --git a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php index 56ee7f3919..e0cd29131e 100644 --- a/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php +++ b/src/Symfony/Component/Security/Guard/Tests/Authenticator/FormLoginAuthenticatorTest.php @@ -111,7 +111,7 @@ class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator /** * @param mixed $defaultSuccessRedirectUrl */ - public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl): TestFormLoginAuthenticator + public function setDefaultSuccessRedirectUrl($defaultSuccessRedirectUrl): self { $this->defaultSuccessRedirectUrl = $defaultSuccessRedirectUrl; @@ -121,7 +121,7 @@ class TestFormLoginAuthenticator extends AbstractFormLoginAuthenticator /** * @param mixed $loginUrl */ - public function setLoginUrl($loginUrl): TestFormLoginAuthenticator + public function setLoginUrl($loginUrl): self { $this->loginUrl = $loginUrl; diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php index 723b4ebb97..c83d7e8787 100644 --- a/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php +++ b/src/Symfony/Component/Security/Http/Tests/Firewall/UsernamePasswordFormAuthenticationListenerTest.php @@ -191,7 +191,7 @@ class UsernamePasswordFormAuthenticationListenerTest extends TestCase class DummyUserClass { - public function __toString() + public function __toString(): string { return ''; } diff --git a/src/Symfony/Component/Serializer/Tests/Fixtures/TraversableDummy.php b/src/Symfony/Component/Serializer/Tests/Fixtures/TraversableDummy.php index bcf46e512e..ac98f1c2e7 100644 --- a/src/Symfony/Component/Serializer/Tests/Fixtures/TraversableDummy.php +++ b/src/Symfony/Component/Serializer/Tests/Fixtures/TraversableDummy.php @@ -16,7 +16,7 @@ class TraversableDummy implements \IteratorAggregate public $foo = 'foo'; public $bar = 'bar'; - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator(get_object_vars($this)); } diff --git a/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php b/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php index 9538fcc313..5ddb9f13a9 100644 --- a/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php +++ b/src/Symfony/Component/Templating/Tests/Fixtures/SimpleHelper.php @@ -22,7 +22,7 @@ class SimpleHelper extends Helper $this->value = $value; } - public function __toString() + public function __toString(): string { return $this->value; } diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php index 87603a9dc8..f171ed93fc 100644 --- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php @@ -662,7 +662,7 @@ class StringClass $this->str = $str; } - public function __toString() + public function __toString(): string { return $this->str; } diff --git a/src/Symfony/Component/Validator/ConstraintViolationList.php b/src/Symfony/Component/Validator/ConstraintViolationList.php index c30ee57cb2..e56c8e31f1 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationList.php +++ b/src/Symfony/Component/Validator/ConstraintViolationList.php @@ -116,7 +116,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation } /** - * {@inheritdoc} + * @return int */ public function count() { @@ -124,7 +124,7 @@ class ConstraintViolationList implements \IteratorAggregate, ConstraintViolation } /** - * {@inheritdoc} + * @return bool */ public function offsetExists($offset) { diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php index 486901bfc3..944195f0f3 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractComparisonValidatorTestCase.php @@ -25,7 +25,7 @@ class ComparisonTest_Class $this->value = $value; } - public function __toString() + public function __toString(): string { return (string) $this->value; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php index 80c00423e7..b07f6f9f83 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/BicValidatorTest.php @@ -248,7 +248,7 @@ class BicComparisonTestClass $this->value = $value; } - public function __toString() + public function __toString(): string { return (string) $this->value; } diff --git a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php index e59c6fe5c0..bcfa07ad9a 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/UrlValidatorTest.php @@ -387,7 +387,7 @@ class UrlValidatorTest extends ConstraintValidatorTestCase class EmailProvider { - public function __toString() + public function __toString(): string { return ''; } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/Countable.php b/src/Symfony/Component/Validator/Tests/Fixtures/Countable.php index afc42376a2..6479c23b2d 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/Countable.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/Countable.php @@ -20,7 +20,7 @@ class Countable implements \Countable $this->content = $content; } - public function count() + public function count(): int { return \count($this->content); } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php b/src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php index 9b5303c167..34b208b2be 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/CustomArrayObject.php @@ -24,7 +24,7 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, $this->array = $array ?: []; } - public function offsetExists($offset) + public function offsetExists($offset): bool { return \array_key_exists($offset, $this->array); } @@ -48,12 +48,12 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, unset($this->array[$offset]); } - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator($this->array); } - public function count() + public function count(): int { return \count($this->array); } @@ -63,7 +63,7 @@ class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, return $this->array; } - public function serialize() + public function serialize(): string { return serialize($this->__serialize()); } diff --git a/src/Symfony/Component/Validator/Tests/Fixtures/ToString.php b/src/Symfony/Component/Validator/Tests/Fixtures/ToString.php index 714fdb9e98..2512066baf 100644 --- a/src/Symfony/Component/Validator/Tests/Fixtures/ToString.php +++ b/src/Symfony/Component/Validator/Tests/Fixtures/ToString.php @@ -15,7 +15,7 @@ class ToString { public $data; - public function __toString() + public function __toString(): string { return 'toString'; } diff --git a/src/Symfony/Component/VarDumper/Cloner/Data.php b/src/Symfony/Component/VarDumper/Cloner/Data.php index 55baec5dde..fd7a18a752 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Data.php +++ b/src/Symfony/Component/VarDumper/Cloner/Data.php @@ -106,11 +106,17 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate return $children; } + /** + * @return int + */ public function count() { return \count($this->getValue()); } + /** + * @return \Traversable + */ public function getIterator() { if (!\is_array($value = $this->getValue())) { @@ -136,6 +142,9 @@ class Data implements \ArrayAccess, \Countable, \IteratorAggregate return null !== $this->seek($key); } + /** + * @return bool + */ public function offsetExists($key) { return $this->__isset($key); diff --git a/src/Symfony/Component/VarDumper/Cloner/Stub.php b/src/Symfony/Component/VarDumper/Cloner/Stub.php index 27dd3ef32c..7e9eb6d59f 100644 --- a/src/Symfony/Component/VarDumper/Cloner/Stub.php +++ b/src/Symfony/Component/VarDumper/Cloner/Stub.php @@ -44,7 +44,7 @@ class Stub /** * @internal */ - public function __sleep() + public function __sleep(): array { $properties = []; diff --git a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php index d80c2858ee..d62639095e 100644 --- a/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php +++ b/src/Symfony/Component/VarExporter/Tests/VarExporterTest.php @@ -209,7 +209,7 @@ class VarExporterTest extends TestCase class MySerializable implements \Serializable { - public function serialize() + public function serialize(): string { return '123'; } @@ -227,7 +227,7 @@ class MyWakeup public $baz; public $def = 234; - public function __sleep() + public function __sleep(): array { return ['sub', 'baz']; } @@ -305,7 +305,7 @@ class MyArrayObject extends \ArrayObject class GoodNight { - public function __sleep() + public function __sleep(): array { $this->good = 'night'; @@ -395,7 +395,7 @@ class FooSerializable implements \Serializable class Php74Serializable implements \Serializable { - public function __serialize() + public function __serialize(): array { return [$this->foo = new \stdClass()]; } @@ -405,7 +405,7 @@ class Php74Serializable implements \Serializable list($this->foo) = $data; } - public function __sleep() + public function __sleep(): array { throw new \BadMethodCallException(); } @@ -415,7 +415,7 @@ class Php74Serializable implements \Serializable throw new \BadMethodCallException(); } - public function serialize() + public function serialize(): string { throw new \BadMethodCallException(); } diff --git a/src/Symfony/Component/Workflow/TransitionBlockerList.php b/src/Symfony/Component/Workflow/TransitionBlockerList.php index 8569b28fea..f7f4a63ea3 100644 --- a/src/Symfony/Component/Workflow/TransitionBlockerList.php +++ b/src/Symfony/Component/Workflow/TransitionBlockerList.php @@ -63,7 +63,7 @@ final class TransitionBlockerList implements \IteratorAggregate, \Countable * * @return \ArrayIterator|TransitionBlocker[] */ - public function getIterator() + public function getIterator(): \Traversable { return new \ArrayIterator($this->blockers); }