diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 0c1ad35f0b..67ba6abf3d 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -39,6 +39,8 @@ class ContainerAwareEventManager extends EventManager /** * {@inheritdoc} + * + * @return void */ public function dispatchEvent($eventName, EventArgs $eventArgs = null) { @@ -59,6 +61,8 @@ class ContainerAwareEventManager extends EventManager /** * {@inheritdoc} + * + * @return object[][] */ public function getListeners($event = null) { @@ -81,6 +85,8 @@ class ContainerAwareEventManager extends EventManager /** * {@inheritdoc} + * + * @return bool */ public function hasListeners($event) { @@ -89,6 +95,8 @@ class ContainerAwareEventManager extends EventManager /** * {@inheritdoc} + * + * @return void */ public function addEventListener($events, $listener) { @@ -109,6 +117,8 @@ class ContainerAwareEventManager extends EventManager /** * {@inheritdoc} + * + * @return void */ public function removeEventListener($events, $listener) { diff --git a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php index b64a82faa2..e3bd6e1319 100644 --- a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php +++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php @@ -34,6 +34,8 @@ class DbalLogger implements SQLLogger /** * {@inheritdoc} + * + * @return void */ public function startQuery($sql, array $params = null, array $types = null) { @@ -48,6 +50,8 @@ class DbalLogger implements SQLLogger /** * {@inheritdoc} + * + * @return void */ public function stopQuery() { diff --git a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php index ae481b5726..a81357a121 100644 --- a/src/Symfony/Bridge/Doctrine/ManagerRegistry.php +++ b/src/Symfony/Bridge/Doctrine/ManagerRegistry.php @@ -29,6 +29,8 @@ abstract class ManagerRegistry extends AbstractManagerRegistry /** * {@inheritdoc} + * + * @return object */ protected function getService($name) { @@ -37,6 +39,8 @@ abstract class ManagerRegistry extends AbstractManagerRegistry /** * {@inheritdoc} + * + * @return void */ protected function resetService($name) { diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php index 0af4271ba7..9e1cd621fe 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/Type/StringWrapperType.php @@ -34,6 +34,8 @@ class StringWrapperType extends StringType /** * {@inheritdoc} + * + * @return string */ public function getName() { diff --git a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php index 1b8cba50f3..68629066f5 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php +++ b/src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/Fixtures/DoctrineFooType.php @@ -27,6 +27,8 @@ class DoctrineFooType extends Type /** * {@inheritdoc} + * + * @return string */ public function getName() { @@ -35,6 +37,8 @@ class DoctrineFooType extends Type /** * {@inheritdoc} + * + * @return string */ public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform) { @@ -76,6 +80,8 @@ class DoctrineFooType extends Type /** * {@inheritdoc} + * + * @return bool */ public function requiresSQLCommentHint(AbstractPlatform $platform) { diff --git a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php index 8f2b6b7749..b0d3676e9b 100644 --- a/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/ServerLogHandler.php @@ -11,6 +11,7 @@ namespace Symfony\Bridge\Monolog\Handler; +use Monolog\Formatter\FormatterInterface; use Monolog\Handler\AbstractHandler; use Monolog\Logger; use Symfony\Bridge\Monolog\Formatter\VarDumperFormatter; @@ -77,6 +78,8 @@ class ServerLogHandler extends AbstractHandler /** * {@inheritdoc} + * + * @return FormatterInterface */ protected function getDefaultFormatter() { diff --git a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php index d7bcb59796..85b3c9229e 100644 --- a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php +++ b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php @@ -63,6 +63,8 @@ class SwiftMailerHandler extends BaseSwiftMailerHandler /** * {@inheritdoc} + * + * @return void */ public function reset() { diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php index 545a736711..de81bcb291 100644 --- a/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php +++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/PhpDumper/LazyLoadingValueHolderGenerator.php @@ -29,6 +29,8 @@ class LazyLoadingValueHolderGenerator extends BaseGenerator /** * {@inheritdoc} + * + * @return void */ public function generate(\ReflectionClass $originalClass, ClassGenerator $classGenerator) { diff --git a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php index 2093553629..2b861a8ecf 100644 --- a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php @@ -31,6 +31,8 @@ class AssetExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php index 7dc490a7e6..ed81d0561f 100644 --- a/src/Symfony/Bridge/Twig/Extension/CodeExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/CodeExtension.php @@ -40,6 +40,8 @@ class CodeExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFilter[] */ public function getFilters() { diff --git a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php index a4ad4a1bc4..c384a7c69b 100644 --- a/src/Symfony/Bridge/Twig/Extension/DumpExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/DumpExtension.php @@ -17,6 +17,7 @@ use Symfony\Component\VarDumper\Dumper\HtmlDumper; use Twig\Environment; use Twig\Extension\AbstractExtension; use Twig\Template; +use Twig\TokenParser\TokenParserInterface; use Twig\TwigFunction; /** @@ -35,6 +36,9 @@ class DumpExtension extends AbstractExtension $this->dumper = $dumper; } + /** + * @return TwigFunction[] + */ public function getFunctions() { return [ @@ -42,6 +46,9 @@ class DumpExtension extends AbstractExtension ]; } + /** + * @return TokenParserInterface[] + */ public function getTokenParsers() { return [new DumpTokenParser()]; diff --git a/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php b/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php index 4ed79ea009..57320d291e 100644 --- a/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/ExpressionExtension.php @@ -24,6 +24,8 @@ class ExpressionExtension extends AbstractExtension { /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/src/Symfony/Bridge/Twig/Extension/FormExtension.php index 909e20d58d..38dd348fe7 100644 --- a/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -15,6 +15,7 @@ use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser; use Symfony\Component\Form\ChoiceList\View\ChoiceView; use Symfony\Component\Form\FormView; use Twig\Extension\AbstractExtension; +use Twig\TokenParser\TokenParserInterface; use Twig\TwigFilter; use Twig\TwigFunction; use Twig\TwigTest; @@ -29,6 +30,8 @@ class FormExtension extends AbstractExtension { /** * {@inheritdoc} + * + * @return TokenParserInterface[] */ public function getTokenParsers() { @@ -40,6 +43,8 @@ class FormExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { @@ -60,6 +65,8 @@ class FormExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFilter[] */ public function getFilters() { @@ -71,6 +78,8 @@ class FormExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigTest[] */ public function getTests() { diff --git a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php index e03676d34f..fa0ad7ad2f 100644 --- a/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/HttpFoundationExtension.php @@ -32,6 +32,8 @@ class HttpFoundationExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php b/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php index ac9cacca2a..20f8b93e52 100644 --- a/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/HttpKernelExtension.php @@ -22,6 +22,9 @@ use Twig\TwigFunction; */ class HttpKernelExtension extends AbstractExtension { + /** + * @return TwigFunction[] + */ public function getFunctions() { return [ diff --git a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php index b409216b60..02c5ae838c 100644 --- a/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/LogoutUrlExtension.php @@ -31,6 +31,8 @@ class LogoutUrlExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php index f3df81c1ee..15d3536068 100644 --- a/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php @@ -34,6 +34,8 @@ class RoutingExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php index 3fa35e290a..41b2cf9e1e 100644 --- a/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/SecurityExtension.php @@ -50,6 +50,8 @@ class SecurityExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php b/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php index 19dfed23e3..fb67ad92c6 100644 --- a/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/StopwatchExtension.php @@ -14,6 +14,7 @@ namespace Symfony\Bridge\Twig\Extension; use Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser; use Symfony\Component\Stopwatch\Stopwatch; use Twig\Extension\AbstractExtension; +use Twig\TokenParser\TokenParserInterface; /** * Twig extension for the stopwatch helper. @@ -36,6 +37,9 @@ class StopwatchExtension extends AbstractExtension return $this->stopwatch; } + /** + * @return TokenParserInterface[] + */ public function getTokenParsers() { return [ diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index b25fa47655..dbdb177eef 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -57,6 +57,8 @@ class TranslationExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFilter[] */ public function getFilters(): array { @@ -83,6 +85,8 @@ class TranslationExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return NodeVisitorInterface[] */ public function getNodeVisitors(): array { diff --git a/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php b/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php index 116c5fbbb8..1f77c26762 100644 --- a/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/WebLinkExtension.php @@ -33,6 +33,8 @@ class WebLinkExtension extends AbstractExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php index 14a5ec4258..6e075d7035 100644 --- a/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php @@ -31,6 +31,9 @@ class WorkflowExtension extends AbstractExtension $this->workflowRegistry = $workflowRegistry; } + /** + * @return TwigFunction[] + */ public function getFunctions() { return [ diff --git a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php index 1c543137a1..700148361e 100644 --- a/src/Symfony/Bridge/Twig/Extension/YamlExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/YamlExtension.php @@ -25,6 +25,8 @@ class YamlExtension extends AbstractExtension { /** * {@inheritdoc} + * + * @return TwigFilter[] */ public function getFilters() { diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php index d98b87b2b3..bcc88f1933 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php @@ -39,6 +39,8 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor /** * {@inheritdoc} + * + * @return Node */ protected function doEnterNode(Node $node, Environment $env) { @@ -91,6 +93,8 @@ class TranslationDefaultDomainNodeVisitor extends AbstractNodeVisitor /** * {@inheritdoc} + * + * @return Node|null */ protected function doLeaveNode(Node $node, Environment $env) { diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php index 3da4141cdd..2d3e1d1ba1 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/TranslationNodeVisitor.php @@ -49,6 +49,8 @@ class TranslationNodeVisitor extends AbstractNodeVisitor /** * {@inheritdoc} + * + * @return Node */ protected function doEnterNode(Node $node, Environment $env) { @@ -89,6 +91,8 @@ class TranslationNodeVisitor extends AbstractNodeVisitor /** * {@inheritdoc} + * + * @return Node|null */ protected function doLeaveNode(Node $node, Environment $env) { diff --git a/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php index a4d7d6f690..1a7326d555 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\DumpNode; +use Twig\Node\Node; use Twig\Token; use Twig\TokenParser\AbstractTokenParser; @@ -30,6 +31,8 @@ class DumpTokenParser extends AbstractTokenParser { /** * {@inheritdoc} + * + * @return Node */ public function parse(Token $token) { @@ -44,6 +47,8 @@ class DumpTokenParser extends AbstractTokenParser /** * {@inheritdoc} + * + * @return string */ public function getTag() { diff --git a/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php index 54dcf6d391..2c306b1a86 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/StopwatchTokenParser.php @@ -13,6 +13,7 @@ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\StopwatchNode; use Twig\Node\Expression\AssignNameExpression; +use Twig\Node\Node; use Twig\Token; use Twig\TokenParser\AbstractTokenParser; @@ -30,6 +31,9 @@ class StopwatchTokenParser extends AbstractTokenParser $this->stopwatchIsAvailable = $stopwatchIsAvailable; } + /** + * @return Node + */ public function parse(Token $token) { $lineno = $token->getLine(); @@ -56,6 +60,9 @@ class StopwatchTokenParser extends AbstractTokenParser return $token->test('endstopwatch'); } + /** + * @return string + */ public function getTag() { return 'stopwatch'; diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php index 72fbda77b8..1f03c6ab89 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransDefaultDomainTokenParser.php @@ -12,6 +12,7 @@ namespace Symfony\Bridge\Twig\TokenParser; use Symfony\Bridge\Twig\Node\TransDefaultDomainNode; +use Twig\Node\Node; use Twig\Token; use Twig\TokenParser\AbstractTokenParser; @@ -24,6 +25,8 @@ class TransDefaultDomainTokenParser extends AbstractTokenParser { /** * {@inheritdoc} + * + * @return Node */ public function parse(Token $token) { @@ -36,6 +39,8 @@ class TransDefaultDomainTokenParser extends AbstractTokenParser /** * {@inheritdoc} + * + * @return string */ public function getTag() { diff --git a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php index 44f10cb6af..1d60eda34a 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/TransTokenParser.php @@ -15,6 +15,7 @@ use Symfony\Bridge\Twig\Node\TransNode; use Twig\Error\SyntaxError; use Twig\Node\Expression\AbstractExpression; use Twig\Node\Expression\ArrayExpression; +use Twig\Node\Node; use Twig\Node\TextNode; use Twig\Token; use Twig\TokenParser\AbstractTokenParser; @@ -28,6 +29,8 @@ class TransTokenParser extends AbstractTokenParser { /** * {@inheritdoc} + * + * @return Node */ public function parse(Token $token) { @@ -86,6 +89,8 @@ class TransTokenParser extends AbstractTokenParser /** * {@inheritdoc} + * + * @return string */ public function getTag() { diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php index d18665e1fa..68fc1fff56 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/AbstractController.php @@ -364,12 +364,12 @@ abstract class AbstractController implements ServiceSubscriberInterface } if (null === $token = $this->container->get('security.token_storage')->getToken()) { - return; + return null; } if (!\is_object($user = $token->getUser())) { // e.g. anonymous authentication - return; + return null; } return $user; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php index d5689701f4..4c123c1d44 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php @@ -62,6 +62,8 @@ class WebProfilerExtension extends ProfilerExtension /** * {@inheritdoc} + * + * @return TwigFunction[] */ public function getFunctions() { diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php index 8cf0770347..e468c4313d 100644 --- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php +++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php @@ -510,7 +510,7 @@ abstract class AbstractBrowser protected function createCrawlerFromContent(string $uri, string $content, string $type) { if (!class_exists('Symfony\Component\DomCrawler\Crawler')) { - return; + return null; } $crawler = new Crawler(null, $uri); diff --git a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php index 2f91434575..0360b71b0b 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php @@ -136,6 +136,8 @@ abstract class AbstractAdapter implements AdapterInterface, CacheInterface, Logg /** * {@inheritdoc} + * + * @return bool */ public function commit() { diff --git a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php index 93f1105bc7..12c1dbcd15 100644 --- a/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/AbstractTagAwareAdapter.php @@ -151,6 +151,8 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA /** * {@inheritdoc} + * + * @return bool */ public function commit() { @@ -213,6 +215,8 @@ abstract class AbstractTagAwareAdapter implements TagAwareAdapterInterface, TagA * {@inheritdoc} * * Overloaded in order to deal with tags for adjusted doDelete() signature. + * + * @return bool */ public function deleteItems(array $keys) { diff --git a/src/Symfony/Component/Cache/Adapter/AdapterInterface.php b/src/Symfony/Component/Cache/Adapter/AdapterInterface.php index 77efe14359..99c5cd1f9f 100644 --- a/src/Symfony/Component/Cache/Adapter/AdapterInterface.php +++ b/src/Symfony/Component/Cache/Adapter/AdapterInterface.php @@ -37,6 +37,8 @@ interface AdapterInterface extends CacheItemPoolInterface /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = ''); } diff --git a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php index b7d7151121..05920d01a9 100644 --- a/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ArrayAdapter.php @@ -78,6 +78,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -120,6 +122,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -133,6 +137,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -145,6 +151,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -176,6 +184,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -184,6 +194,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function commit() { @@ -192,6 +204,8 @@ class ArrayAdapter implements AdapterInterface, CacheInterface, LoggerAwareInter /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { diff --git a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php index 1746361444..78a65e9d6d 100644 --- a/src/Symfony/Component/Cache/Adapter/ChainAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ChainAdapter.php @@ -178,6 +178,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -192,6 +194,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { @@ -211,6 +215,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -226,6 +232,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -241,6 +249,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -256,6 +266,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -271,6 +283,8 @@ class ChainAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function commit() { diff --git a/src/Symfony/Component/Cache/Adapter/NullAdapter.php b/src/Symfony/Component/Cache/Adapter/NullAdapter.php index 7839d5b644..44778d787b 100644 --- a/src/Symfony/Component/Cache/Adapter/NullAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/NullAdapter.php @@ -67,6 +67,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -75,6 +77,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { @@ -83,6 +87,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -91,6 +97,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -99,6 +107,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -107,6 +117,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -115,6 +127,8 @@ class NullAdapter implements AdapterInterface, CacheInterface /** * {@inheritdoc} + * + * @return bool */ public function commit() { diff --git a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php index 4cd7342312..45c9cde144 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpArrayAdapter.php @@ -169,6 +169,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -184,6 +186,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -199,6 +203,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -229,6 +235,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -241,6 +249,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -253,6 +263,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function commit() { @@ -261,6 +273,8 @@ class PhpArrayAdapter implements AdapterInterface, CacheInterface, PruneableInte /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { diff --git a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php index c0a2e46aea..5e1b0276fc 100644 --- a/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/ProxyAdapter.php @@ -139,6 +139,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -147,6 +149,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { @@ -159,6 +163,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -167,6 +173,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -181,6 +189,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -189,6 +199,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -197,6 +209,8 @@ class ProxyAdapter implements AdapterInterface, CacheInterface, PruneableInterfa /** * {@inheritdoc} + * + * @return bool */ public function commit() { diff --git a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php index 338ab345ef..00543d3b19 100644 --- a/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php @@ -151,6 +151,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -213,6 +215,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { @@ -235,6 +239,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -243,6 +249,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -257,6 +265,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -270,6 +280,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -283,6 +295,8 @@ class TagAwareAdapter implements TagAwareAdapterInterface, TagAwareCacheInterfac /** * {@inheritdoc} + * + * @return bool */ public function commit() { diff --git a/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php b/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php index 7371fcb1e7..16d819ee46 100644 --- a/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/TraceableAdapter.php @@ -89,6 +89,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -102,6 +104,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -115,6 +119,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -128,6 +134,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { @@ -167,6 +175,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { @@ -184,6 +194,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -198,6 +210,8 @@ class TraceableAdapter implements AdapterInterface, CacheInterface, PruneableInt /** * {@inheritdoc} + * + * @return bool */ public function commit() { diff --git a/src/Symfony/Component/Cache/CacheItem.php b/src/Symfony/Component/Cache/CacheItem.php index c7f5e00e42..056afbdffd 100644 --- a/src/Symfony/Component/Cache/CacheItem.php +++ b/src/Symfony/Component/Cache/CacheItem.php @@ -60,6 +60,8 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} + * + * @return static */ public function set($value) { @@ -70,6 +72,8 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} + * + * @return static */ public function expiresAt($expiration) { @@ -86,6 +90,8 @@ final class CacheItem implements ItemInterface /** * {@inheritdoc} + * + * @return static */ public function expiresAfter($time) { diff --git a/src/Symfony/Component/Cache/DoctrineProvider.php b/src/Symfony/Component/Cache/DoctrineProvider.php index 3cc186962e..ee3102617e 100644 --- a/src/Symfony/Component/Cache/DoctrineProvider.php +++ b/src/Symfony/Component/Cache/DoctrineProvider.php @@ -58,6 +58,8 @@ class DoctrineProvider extends CacheProvider implements PruneableInterface, Rese /** * {@inheritdoc} + * + * @return bool */ protected function doContains($id) { @@ -66,6 +68,8 @@ class DoctrineProvider extends CacheProvider implements PruneableInterface, Rese /** * {@inheritdoc} + * + * @return bool */ protected function doSave($id, $data, $lifeTime = 0) { @@ -80,6 +84,8 @@ class DoctrineProvider extends CacheProvider implements PruneableInterface, Rese /** * {@inheritdoc} + * + * @return bool */ protected function doDelete($id) { @@ -88,6 +94,8 @@ class DoctrineProvider extends CacheProvider implements PruneableInterface, Rese /** * {@inheritdoc} + * + * @return bool */ protected function doFlush() { @@ -96,6 +104,8 @@ class DoctrineProvider extends CacheProvider implements PruneableInterface, Rese /** * {@inheritdoc} + * + * @return array|null */ protected function doGetStats() { diff --git a/src/Symfony/Component/Cache/Psr16Cache.php b/src/Symfony/Component/Cache/Psr16Cache.php index d67615eb77..36d77a71a0 100644 --- a/src/Symfony/Component/Cache/Psr16Cache.php +++ b/src/Symfony/Component/Cache/Psr16Cache.php @@ -85,6 +85,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return bool */ public function set($key, $value, $ttl = null) { @@ -108,6 +110,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return bool */ public function delete($key) { @@ -122,6 +126,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return bool */ public function clear() { @@ -130,6 +136,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return iterable */ public function getMultiple($keys, $default = null) { @@ -178,6 +186,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return bool */ public function setMultiple($values, $ttl = null) { @@ -229,6 +239,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return bool */ public function deleteMultiple($keys) { @@ -249,6 +261,8 @@ class Psr16Cache implements CacheInterface, PruneableInterface, ResettableInterf /** * {@inheritdoc} + * + * @return bool */ public function has($key) { diff --git a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php index 24f92ca9a5..13e5aedad0 100644 --- a/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php +++ b/src/Symfony/Component/Cache/Tests/Adapter/ProxyAdapterTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Cache\Tests\Adapter; use Psr\Cache\CacheItemInterface; +use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Cache\Adapter\ArrayAdapter; use Symfony\Component\Cache\Adapter\FilesystemAdapter; use Symfony\Component\Cache\Adapter\ProxyAdapter; @@ -28,6 +29,9 @@ class ProxyAdapterTest extends AdapterTestCase 'testPrune' => 'ProxyAdapter just proxies', ]; + /** + * @return CacheItemPoolInterface + */ public function createCachePool($defaultLifetime = 0, $testMethod = null) { if ('testGetMetadata' === $testMethod) { diff --git a/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php b/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php index 95b39d54bd..c00a3aef05 100644 --- a/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php +++ b/src/Symfony/Component/Cache/Tests/Fixtures/ArrayCache.php @@ -13,6 +13,9 @@ class ArrayCache extends CacheProvider return $this->doContains($id) ? $this->data[$id][0] : false; } + /** + * @return bool + */ protected function doContains($id) { if (!isset($this->data[$id])) { @@ -24,6 +27,9 @@ class ArrayCache extends CacheProvider return !$expiry || microtime(true) < $expiry || !$this->doDelete($id); } + /** + * @return bool + */ protected function doSave($id, $data, $lifeTime = 0) { $this->data[$id] = [$data, $lifeTime ? microtime(true) + $lifeTime : false]; @@ -31,6 +37,9 @@ class ArrayCache extends CacheProvider return true; } + /** + * @return bool + */ protected function doDelete($id) { unset($this->data[$id]); @@ -38,6 +47,9 @@ class ArrayCache extends CacheProvider return true; } + /** + * @return bool + */ protected function doFlush() { $this->data = []; @@ -45,6 +57,9 @@ class ArrayCache extends CacheProvider return true; } + /** + * @return array|null + */ protected function doGetStats() { return null; diff --git a/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php b/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php index deb0b3bc34..0481b16bcd 100644 --- a/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php +++ b/src/Symfony/Component/Cache/Tests/Fixtures/ExternalAdapter.php @@ -29,46 +29,73 @@ class ExternalAdapter implements CacheItemPoolInterface $this->cache = new ArrayAdapter($defaultLifetime); } + /** + * @return CacheItemInterface + */ public function getItem($key) { return $this->cache->getItem($key); } + /** + * @return iterable + */ public function getItems(array $keys = []) { return $this->cache->getItems($keys); } + /** + * @return bool + */ public function hasItem($key) { return $this->cache->hasItem($key); } + /** + * @return bool + */ public function clear() { return $this->cache->clear(); } + /** + * @return bool + */ public function deleteItem($key) { return $this->cache->deleteItem($key); } + /** + * @return bool + */ public function deleteItems(array $keys) { return $this->cache->deleteItems($keys); } + /** + * @return bool + */ public function save(CacheItemInterface $item) { return $this->cache->save($item); } + /** + * @return bool + */ public function saveDeferred(CacheItemInterface $item) { return $this->cache->saveDeferred($item); } + /** + * @return bool + */ public function commit() { return $this->cache->commit(); diff --git a/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php b/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php index fe4047ea8b..8f026f750d 100644 --- a/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php +++ b/src/Symfony/Component/Cache/Traits/AbstractAdapterTrait.php @@ -93,6 +93,8 @@ trait AbstractAdapterTrait /** * {@inheritdoc} + * + * @return bool */ public function hasItem($key) { @@ -113,6 +115,8 @@ trait AbstractAdapterTrait /** * {@inheritdoc} + * + * @return bool */ public function clear(string $prefix = '') { @@ -141,6 +145,8 @@ trait AbstractAdapterTrait /** * {@inheritdoc} + * + * @return bool */ public function deleteItem($key) { @@ -149,6 +155,8 @@ trait AbstractAdapterTrait /** * {@inheritdoc} + * + * @return bool */ public function deleteItems(array $keys) { @@ -236,6 +244,8 @@ trait AbstractAdapterTrait /** * {@inheritdoc} + * + * @return bool */ public function save(CacheItemInterface $item) { @@ -249,6 +259,8 @@ trait AbstractAdapterTrait /** * {@inheritdoc} + * + * @return bool */ public function saveDeferred(CacheItemInterface $item) { diff --git a/src/Symfony/Component/Console/Logger/ConsoleLogger.php b/src/Symfony/Component/Console/Logger/ConsoleLogger.php index 3a2853daee..32361189f2 100644 --- a/src/Symfony/Component/Console/Logger/ConsoleLogger.php +++ b/src/Symfony/Component/Console/Logger/ConsoleLogger.php @@ -61,6 +61,8 @@ class ConsoleLogger extends AbstractLogger /** * {@inheritdoc} + * + * @return void */ public function log($level, $message, array $context = []) { diff --git a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php index eec3c7051e..f1506a92ec 100644 --- a/src/Symfony/Component/ErrorHandler/DebugClassLoader.php +++ b/src/Symfony/Component/ErrorHandler/DebugClassLoader.php @@ -27,9 +27,47 @@ use PHPUnit\Framework\MockObject\Matcher\StatelessInvocation; */ class DebugClassLoader { + private const SPECIAL_RETURN_TYPES = [ + 'mixed' => 'mixed', + 'void' => 'void', + 'null' => 'null', + 'resource' => 'resource', + 'static' => 'object', + '$this' => 'object', + 'boolean' => 'bool', + 'true' => 'bool', + 'false' => 'bool', + 'integer' => 'int', + 'array' => 'array', + 'bool' => 'bool', + 'callable' => 'callable', + 'float' => 'float', + 'int' => 'integer', + 'iterable' => 'iterable', + 'object' => 'object', + 'string' => 'string', + 'self' => 'self', + 'parent' => 'parent', + ]; + + private const BUILTIN_RETURN_TYPES = [ + 'void' => true, + 'array' => true, + 'bool' => true, + 'callable' => true, + 'float' => true, + 'int' => true, + 'iterable' => true, + 'object' => true, + 'string' => true, + 'self' => true, + 'parent' => true, + ]; + private $classLoader; private $isFinder; private $loaded = []; + private $compatPatch; private static $caseCheck; private static $checkedClasses = []; private static $final = []; @@ -40,11 +78,14 @@ class DebugClassLoader private static $annotatedParameters = []; private static $darwinCache = ['/' => ['/', []]]; private static $method = []; + private static $returnTypes = []; + private static $methodTraits = []; public function __construct(callable $classLoader) { $this->classLoader = $classLoader; $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile'); + $this->compatPatch = getenv('SYMFONY_PATCH_TYPE_DECLARATIONS_COMPAT') ?: null; if (!isset(self::$caseCheck)) { $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR); @@ -218,11 +259,11 @@ class DebugClassLoader $deprecations = []; // Don't trigger deprecations for classes in the same vendor - if (2 > $len = 1 + (strpos($class, '\\') ?: strpos($class, '_'))) { - $len = 0; - $ns = ''; + if (2 > $vendorLen = 1 + (strpos($class, '\\') ?: strpos($class, '_'))) { + $vendorLen = 0; + $vendor = ''; } else { - $ns = str_replace('_', '\\', substr($class, 0, $len)); + $vendor = str_replace('_', '\\', substr($class, 0, $vendorLen)); } // Detect annotations on the class @@ -252,7 +293,7 @@ class DebugClassLoader } } - $parent = get_parent_class($class); + $parent = get_parent_class($class) ?: null; $parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent); if ($parent) { $parentAndOwnInterfaces[$parent] = $parent; @@ -271,13 +312,13 @@ class DebugClassLoader if (!isset(self::$checkedClasses[$use])) { $this->checkClass($use); } - if (isset(self::$deprecated[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len) && !isset(self::$deprecated[$class])) { + if (isset(self::$deprecated[$use]) && strncmp($vendor, str_replace('_', '\\', $use), $vendorLen) && !isset(self::$deprecated[$class])) { $type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait'); $verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses'); $deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]); } - if (isset(self::$internal[$use]) && strncmp($ns, str_replace('_', '\\', $use), $len)) { + if (isset(self::$internal[$use]) && strncmp($vendor, str_replace('_', '\\', $use), $vendorLen)) { $deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class); } if (isset(self::$method[$use])) { @@ -305,15 +346,24 @@ class DebugClassLoader } if (trait_exists($class)) { + $file = $refl->getFileName(); + + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { + if ($method->getFileName() === $file) { + self::$methodTraits[$file][$method->getStartLine()] = $class; + } + } + return $deprecations; } - // Inherit @final, @internal and @param annotations for methods + // Inherit @final, @internal, @param and @return annotations for methods self::$finalMethods[$class] = []; self::$internalMethods[$class] = []; self::$annotatedParameters[$class] = []; + self::$returnTypes[$class] = []; foreach ($parentAndOwnInterfaces as $use) { - foreach (['finalMethods', 'internalMethods', 'annotatedParameters'] as $property) { + foreach (['finalMethods', 'internalMethods', 'annotatedParameters', 'returnTypes'] as $property) { if (isset(self::${$property}[$use])) { self::${$property}[$class] = self::${$property}[$class] ? self::${$property}[$use] + self::${$property}[$class] : self::${$property}[$use]; } @@ -325,6 +375,16 @@ class DebugClassLoader continue; } + if (null === $ns = self::$methodTraits[$method->getFileName()][$method->getStartLine()] ?? null) { + $ns = $vendor; + $len = $vendorLen; + } elseif (2 > $len = 1 + (strpos($ns, '\\') ?: strpos($ns, '_'))) { + $len = 0; + $ns = ''; + } else { + $ns = str_replace('_', '\\', substr($ns, 0, $len)); + } + if ($parent && isset(self::$finalMethods[$parent][$method->name])) { list($declaringClass, $message) = self::$finalMethods[$parent][$method->name]; $deprecations[] = sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class); @@ -353,10 +413,34 @@ class DebugClassLoader } } + if (isset(self::$returnTypes[$class][$method->name]) && !$method->hasReturnType() && !($doc && preg_match('/\n\s+\* @return +(\S+)/', $doc))) { + list($normalizedType, $returnType, $declaringClass, $declaringFile) = self::$returnTypes[$class][$method->name]; + + if (null !== $this->compatPatch && 0 === strpos($class, $this->compatPatch)) { + self::fixReturnStatements($method, $normalizedType); + } + + if (strncmp($ns, $declaringClass, $len)) { + if (null !== $this->compatPatch && 0 === strpos($class, $this->compatPatch)) { + self::patchMethod($method, $returnType, $declaringFile); + } + + $deprecations[] = sprintf('Method "%s::%s()" will return "%s" as of its next major version. Doing the same in child class "%s" will be required when upgrading.', $declaringClass, $method->name, $normalizedType, $class); + } + } + if (!$doc) { continue; } + if (!$method->hasReturnType() && false !== strpos($doc, '@return') && preg_match('/\n\s+\* @return +(\S+)/', $doc, $matches)) { + $this->setReturnType($matches[1], $method, $parent); + + if (null !== $this->compatPatch && 0 === strpos($class, $this->compatPatch)) { + self::fixReturnStatements($method, self::$returnTypes[$class][$method->name][0] ?? '?'); + } + } + $finalOrInternal = false; foreach (['final', 'internal'] as $annotation) { @@ -382,7 +466,7 @@ class DebugClassLoader foreach ($matches as list(, $parameterType, $parameterName)) { if (!isset($definedParameters[$parameterName])) { $parameterType = trim($parameterType); - self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its parent class "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, $method->class); + self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its parent class "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, $class); } } } @@ -496,11 +580,9 @@ class DebugClassLoader /** * `class_implements` includes interfaces from the parents so we have to manually exclude them. * - * @param string|false $parent - * * @return string[] */ - private function getOwnInterfaces(string $class, $parent): array + private function getOwnInterfaces(string $class, ?string $parent): array { $ownInterfaces = class_implements($class, false); @@ -518,4 +600,234 @@ class DebugClassLoader return $ownInterfaces; } + + private function setReturnType(string $types, \ReflectionMethod $method, ?string $parent): void + { + $nullable = false; + $typesMap = []; + foreach (explode('|', $types) as $t) { + $typesMap[$this->normalizeType($t, $method->class, $parent)] = $t; + } + + if (isset($typesMap['array']) && (isset($typesMap['Traversable']) || isset($typesMap['\Traversable']))) { + $typesMap['iterable'] = 'array' !== $typesMap['array'] ? $typesMap['array'] : 'iterable'; + unset($typesMap['array'], $typesMap['Traversable'], $typesMap['\Traversable']); + } + + if (isset($typesMap['array']) && isset($typesMap['iterable'])) { + if ('[]' === substr($typesMap['array'], -2)) { + $typesMap['iterable'] = $typesMap['array']; + } + unset($typesMap['array']); + } + + $normalizedType = key($typesMap); + $returnType = current($typesMap); + + foreach ($typesMap as $n => $t) { + if ('null' === $n) { + $nullable = true; + } elseif ('null' === $normalizedType) { + $normalizedType = $t; + $returnType = $t; + } elseif ($n !== $normalizedType) { + // ignore multi-types return declarations + return; + } + } + + if ('void' === $normalizedType) { + $nullable = false; + } elseif (!isset(self::BUILTIN_RETURN_TYPES[$normalizedType]) && isset(self::SPECIAL_RETURN_TYPES[$normalizedType])) { + // ignore other special return types + return; + } + + if ($nullable) { + $normalizedType = '?'.$normalizedType; + $returnType .= '|null'; + } + + self::$returnTypes[$method->class][$method->name] = [$normalizedType, $returnType, $method->class, $method->getFileName()]; + } + + private function normalizeType(string $type, string $class, ?string $parent): string + { + if (isset(self::SPECIAL_RETURN_TYPES[$lcType = strtolower($type)])) { + if ('parent' === $lcType = self::SPECIAL_RETURN_TYPES[$lcType]) { + $lcType = null !== $parent ? '\\'.$parent : 'parent'; + } elseif ('self' === $lcType) { + $lcType = '\\'.$class; + } + + return $lcType; + } + + if ('[]' === substr($type, -2)) { + return 'array'; + } + + if (preg_match('/^(array|iterable|callable) *[<(]/', $lcType, $m)) { + return $m[1]; + } + + // We could resolve "use" statements to return the FQDN + // but this would be too expensive for a runtime checker + + return $type; + } + + /** + * Utility method to add @return annotations to the Symfony code-base where it triggers a self-deprecations. + */ + private static function patchMethod(\ReflectionMethod $method, string $returnType, string $declaringFile) + { + static $patchedMethods = []; + static $useStatements = []; + + if (!file_exists($file = $method->getFileName()) || isset($patchedMethods[$file][$startLine = $method->getStartLine()])) { + return; + } + + $patchedMethods[$file][$startLine] = true; + $patchedMethods[$file][0] = $patchedMethods[$file][0] ?? 0; + $startLine += $patchedMethods[$file][0] - 2; + $returnType = explode('|', $returnType); + $code = file($file); + + foreach ($returnType as $i => $type) { + if (preg_match('/((?:\[\])+)$/', $type, $m)) { + $type = substr($type, 0, -\strlen($m[1])); + $format = '%s'.$m[1]; + } elseif (preg_match('/^(array|iterable)<([^,>]++)>$/', $type, $m)) { + $type = $m[2]; + $format = $m[1].'<%s>'; + } else { + $format = null; + } + + if (isset(self::SPECIAL_RETURN_TYPES[$type]) || ('\\' === $type[0] && !$p = strrpos($type, '\\', 1))) { + continue; + } + + list($namespace, $useOffset, $useMap) = $useStatements[$file] ?? $useStatements[$file] = self::getUseStatements($file); + + if ('\\' !== $type[0]) { + list($declaringNamespace, , $declaringUseMap) = $useStatements[$declaringFile] ?? $useStatements[$declaringFile] = self::getUseStatements($declaringFile); + + $p = strpos($type, '\\', 1); + $alias = $p ? substr($type, 0, $p) : $type; + + if (isset($declaringUseMap[$alias])) { + $type = '\\'.$declaringUseMap[$alias].($p ? substr($type, $p) : ''); + } else { + $type = '\\'.$declaringNamespace.$type; + } + + $p = strrpos($type, '\\', 1); + } + + $alias = substr($type, 1 + $p); + $type = substr($type, 1); + + if (!isset($useMap[$alias]) && (class_exists($c = $namespace.$alias) || interface_exists($c) || trait_exists($c))) { + $useMap[$alias] = $c; + } + + if (!isset($useMap[$alias])) { + $useStatements[$file][2][$alias] = $type; + $code[$useOffset] = "use $type;\n".$code[$useOffset]; + ++$patchedMethods[$file][0]; + } elseif ($useMap[$alias] !== $type) { + $alias .= 'FIXME'; + $useStatements[$file][2][$alias] = $type; + $code[$useOffset] = "use $type as $alias;\n".$code[$useOffset]; + ++$patchedMethods[$file][0]; + } + + $returnType[$i] = null !== $format ? sprintf($format, $alias) : $alias; + } + + $returnType = implode('|', $returnType); + + if ($method->getDocComment()) { + $code[$startLine] = " * @return $returnType\n".$code[$startLine]; + } else { + $code[$startLine] .= <<getFileName())) { + return; + } + + $fixedCode = $code = file($file); + $end = $method->getEndLine(); + for ($i = $method->getStartLine(); $i < $end; ++$i) { + if ('void' === $returnType) { + $fixedCode[$i] = str_replace(' return null;', ' return;', $code[$i]); + } elseif ('mixed' === $returnType || '?' === $returnType[0]) { + $fixedCode[$i] = str_replace(' return;', ' return null;', $code[$i]); + } else { + $fixedCode[$i] = str_replace(' return;', " return $returnType!?;", $code[$i]); + } + } + + if ($fixedCode !== $code) { + file_put_contents($file, $fixedCode); + } + } } diff --git a/src/Symfony/Component/ErrorHandler/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/ErrorHandler/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index b59b0d4517..ee9930c097 100644 --- a/src/Symfony/Component/ErrorHandler/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/src/Symfony/Component/ErrorHandler/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -33,11 +33,11 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface $notFoundSuffix = '\' not found'; $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { - return; + return null; } if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; + return null; } foreach (['class', 'interface', 'trait'] as $typeName) { diff --git a/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php index 9e3affb14d..b944b8e11c 100644 --- a/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ b/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php @@ -30,17 +30,17 @@ class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface $notFoundSuffix = '()'; $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { - return; + return null; } if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) { - return; + return null; } $prefix = 'Call to undefined function '; $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { - return; + return null; } $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen); diff --git a/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php index 49de274469..90bb09837e 100644 --- a/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ b/src/Symfony/Component/ErrorHandler/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php @@ -28,7 +28,7 @@ class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface { preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches); if (!$matches) { - return; + return null; } $className = $matches[1]; diff --git a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php index a0d92a680a..753e1a9624 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php +++ b/src/Symfony/Component/ErrorHandler/Tests/DebugClassLoaderTest.php @@ -353,6 +353,40 @@ class DebugClassLoaderTest extends TestCase { $this->assertTrue(class_exists(__NAMESPACE__.'\Fixtures\DefinitionInEvaluatedCode', true)); } + + public function testReturnType() + { + $deprecations = []; + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); + + class_exists('Test\\'.__NAMESPACE__.'\\ReturnType', true); + + error_reporting($e); + restore_error_handler(); + + $this->assertSame([ + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeGrandParent::returnTypeGrandParent()" will return "string" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParentInterface::returnTypeParentInterface()" will return "string" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeInterface::returnTypeInterface()" will return "string" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNonNullableReturnableType()" will return "void" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNonNullableReturnableTypeWithNull()" will return "void" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNullableReturnableType()" will return "array" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneNullableReturnableTypeWithNull()" will return "?bool" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneOtherType()" will return "\ArrayIterator" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::oneOtherTypeWithNull()" will return "?\ArrayIterator" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::manyIterables()" will return "array" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::nullableReturnableTypeNormalization()" will return "object" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::nonNullableReturnableTypeNormalization()" will return "void" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::commonNonObjectReturnedTypeNormalization()" will return "object" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::bracketsNormalization()" will return "array" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::booleanNormalization()" will return "bool" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::callableNormalization1()" will return "callable" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::callableNormalization2()" will return "callable" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::otherTypeNormalization()" will return "\ArrayIterator" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + 'Method "Symfony\Component\ErrorHandler\Tests\Fixtures\ReturnTypeParent::arrayWithLessThanSignNormalization()" will return "array" as of its next major version. Doing the same in child class "Test\Symfony\Component\ErrorHandler\Tests\ReturnType" will be required when upgrading.', + ], $deprecations); + } } class ClassLoader @@ -435,6 +469,10 @@ class ClassLoader } elseif ('Test\\'.__NAMESPACE__.'\ExtendsVirtualMagicCall' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsVirtualMagicCall extends \\'.__NAMESPACE__.'\Fixtures\VirtualClassMagicCall implements \\'.__NAMESPACE__.'\Fixtures\VirtualInterface { }'); + } elseif ('Test\\'.__NAMESPACE__.'\ReturnType' === $class) { + return $fixtureDir.\DIRECTORY_SEPARATOR.'ReturnType.php'; + } elseif ('Test\\'.__NAMESPACE__.'\Fixtures\OutsideInterface' === $class) { + return $fixtureDir.\DIRECTORY_SEPARATOR.'OutsideInterface.php'; } } } diff --git a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/OutsideInterface.php b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/OutsideInterface.php new file mode 100644 index 0000000000..43989a9060 --- /dev/null +++ b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/OutsideInterface.php @@ -0,0 +1,11 @@ + + */ + public function arrayWithLessThanSignNormalization() + { + } + + /** + * @return int + */ + public function notExtended() + { + } +} diff --git a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParentInterface.php b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParentInterface.php new file mode 100644 index 0000000000..d63e31165d --- /dev/null +++ b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParentInterface.php @@ -0,0 +1,11 @@ +logs[$level][] = $message; } + /** + * @return void + */ public function emergency($message, array $context = []) { $this->log('emergency', $message, $context); } + /** + * @return void + */ public function alert($message, array $context = []) { $this->log('alert', $message, $context); } + /** + * @return void + */ public function critical($message, array $context = []) { $this->log('critical', $message, $context); } + /** + * @return void + */ public function error($message, array $context = []) { $this->log('error', $message, $context); } + /** + * @return void + */ public function warning($message, array $context = []) { $this->log('warning', $message, $context); } + /** + * @return void + */ public function notice($message, array $context = []) { $this->log('notice', $message, $context); } + /** + * @return void + */ public function info($message, array $context = []) { $this->log('info', $message, $context); } + /** + * @return void + */ public function debug($message, array $context = []) { $this->log('debug', $message, $context); diff --git a/src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php index 7b22deb88d..e5c0d0c479 100644 --- a/src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/TimezoneDataGenerator.php @@ -84,13 +84,13 @@ class TimezoneDataGenerator extends AbstractDataGenerator // Don't generate aliases, as they are resolved during runtime // Unless an alias is needed as fallback for de-duplication purposes if (isset($this->localeAliases[$displayLocale]) && !$this->generatingFallback) { - return; + return null; } $localeBundle = $reader->read($tempDir, $displayLocale); if (!isset($localeBundle['zoneStrings']) || null === $localeBundle['zoneStrings']) { - return; + return null; } $data = [ @@ -115,7 +115,7 @@ class TimezoneDataGenerator extends AbstractDataGenerator $data['Meta'] = array_diff($data['Meta'], $fallback['Meta']); } if (!$data['Names'] && !$data['Meta']) { - return; + return null; } $this->zoneIds = array_merge($this->zoneIds, array_keys($data['Names'])); diff --git a/src/Symfony/Component/WebLink/GenericLinkProvider.php b/src/Symfony/Component/WebLink/GenericLinkProvider.php index 5c8b2e7114..9dd0e6733f 100644 --- a/src/Symfony/Component/WebLink/GenericLinkProvider.php +++ b/src/Symfony/Component/WebLink/GenericLinkProvider.php @@ -61,6 +61,8 @@ class GenericLinkProvider implements EvolvableLinkProviderInterface /** * {@inheritdoc} + * + * @return static */ public function withLink(LinkInterface $link) { @@ -72,6 +74,8 @@ class GenericLinkProvider implements EvolvableLinkProviderInterface /** * {@inheritdoc} + * + * @return static */ public function withoutLink(LinkInterface $link) { diff --git a/src/Symfony/Component/WebLink/Link.php b/src/Symfony/Component/WebLink/Link.php index a7d034c1fa..a43028443c 100644 --- a/src/Symfony/Component/WebLink/Link.php +++ b/src/Symfony/Component/WebLink/Link.php @@ -92,6 +92,8 @@ class Link implements EvolvableLinkInterface /** * {@inheritdoc} + * + * @return static */ public function withHref($href) { @@ -104,6 +106,8 @@ class Link implements EvolvableLinkInterface /** * {@inheritdoc} + * + * @return static */ public function withRel($rel) { @@ -115,6 +119,8 @@ class Link implements EvolvableLinkInterface /** * {@inheritdoc} + * + * @return static */ public function withoutRel($rel) { @@ -126,6 +132,8 @@ class Link implements EvolvableLinkInterface /** * {@inheritdoc} + * + * @return static */ public function withAttribute($attribute, $value) { @@ -137,6 +145,8 @@ class Link implements EvolvableLinkInterface /** * {@inheritdoc} + * + * @return static */ public function withoutAttribute($attribute) { diff --git a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php index 71b1b7460d..4ec6eb4276 100644 --- a/src/Symfony/Contracts/Service/ServiceLocatorTrait.php +++ b/src/Symfony/Contracts/Service/ServiceLocatorTrait.php @@ -36,6 +36,8 @@ trait ServiceLocatorTrait /** * {@inheritdoc} + * + * @return bool */ public function has($id) {