From 9a6c39b81b64f5e55aa5ddc8f389b993cf48a870 Mon Sep 17 00:00:00 2001 From: Gilles Doge Date: Thu, 27 Dec 2018 15:09:02 +0100 Subject: [PATCH 1/3] fixed DocBlock about LogicException This is a follow-up of #28536 --- src/Symfony/Component/BrowserKit/Client.php | 2 +- src/Symfony/Component/Config/Util/XmlUtils.php | 2 +- src/Symfony/Component/Console/Command/LockableTrait.php | 3 +++ .../Component/DependencyInjection/Dumper/YamlDumper.php | 2 ++ src/Symfony/Component/DomCrawler/Crawler.php | 2 +- .../Messenger/Transport/Serialization/Serializer.php | 7 +++++++ src/Symfony/Component/Process/Process.php | 2 +- src/Symfony/Component/PropertyAccess/PropertyAccessor.php | 2 +- .../Component/PropertyInfo/Extractor/PhpDocExtractor.php | 2 ++ .../Component/Routing/Loader/AnnotationFileLoader.php | 2 +- 10 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index d483dbcb070c0..3ab9de73ac539 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -113,7 +113,7 @@ public function getMaxRedirects() * * @param bool $insulated Whether to insulate the requests or not * - * @throws \RuntimeException When Symfony Process Component is not installed + * @throws \LogicException When Symfony Process Component is not installed */ public function insulate($insulated = true) { diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index b29e51e0f697f..3b15b890dd7b5 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -42,7 +42,7 @@ private function __construct() * * @throws XmlParsingException When parsing of XML file returns error * @throws InvalidXmlException When parsing of XML with schema or callable produces any errors unrelated to the XML parsing itself - * @throws \RuntimeException When DOM extension is missing + * @throws \LogicException When DOM extension is missing */ public static function parse($content, $schemaOrCallable = null) { diff --git a/src/Symfony/Component/Console/Command/LockableTrait.php b/src/Symfony/Component/Console/Command/LockableTrait.php index f4ebe45bf37c7..b0c97a16472f2 100644 --- a/src/Symfony/Component/Console/Command/LockableTrait.php +++ b/src/Symfony/Component/Console/Command/LockableTrait.php @@ -31,6 +31,9 @@ trait LockableTrait * Locks a command. * * @return bool + * + * @throws LogicException When Symfony Lock Component is not installed + * or when a lock is already in place. */ private function lock($name = null, $blocking = false) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 3ca193c7c9478..d83150b383110 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -42,6 +42,8 @@ class YamlDumper extends Dumper * Dumps the service container as an YAML string. * * @return string A YAML string representing of the service container + * + * @throws LogicException When Symfony Yaml Component is not installed. */ public function dump(array $options = array()) { diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 3526a1ebc6111..8e4b3fa876aef 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -1175,7 +1175,7 @@ private function createSubCrawler($nodes) } /** - * @throws \RuntimeException If the CssSelector Component is not available + * @throws \LogicException If the CssSelector Component is not available */ private function createCssSelectorConverter(): CssSelectorConverter { diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php b/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php index 22c01debea0aa..b082855d9b29b 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php @@ -42,6 +42,13 @@ public function __construct(SymfonySerializerInterface $serializer = null, strin $this->context = $context; } + /** + * Create a new Transport Serializer. + * + * @return self + * + * @throws LogicException When Symfony Serializer Component is not installed. + */ public static function create(): self { if (!class_exists(SymfonySerializer::class)) { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 666c109ab2ab0..2dd2c653cf058 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -135,7 +135,7 @@ class Process implements \IteratorAggregate * @param mixed|null $input The input as stream resource, scalar or \Traversable, or null for no input * @param int|float|null $timeout The timeout in seconds or null to disable * - * @throws RuntimeException When proc_open is not installed + * @throws LogicException When proc_open is not installed */ public function __construct($command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60) { diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index 40f10a54725b5..2f43ca6437b81 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -795,7 +795,7 @@ private function getPropertyPath($propertyPath): PropertyPath * * @return AdapterInterface * - * @throws RuntimeException When the Cache Component isn't available + * @throws \LogicException When the Symfony Cache Component isn't available */ public static function createCache($namespace, $defaultLifetime, $version, LoggerInterface $logger = null) { diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index cdb111bf02bf5..7486072e91ef9 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -50,6 +50,8 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property * @param string[]|null $mutatorPrefixes * @param string[]|null $accessorPrefixes * @param string[]|null $arrayMutatorPrefixes + * + * @throws \LogicException When "phpdocumentor/reflection-docblock" package is not installed. */ public function __construct(DocBlockFactoryInterface $docBlockFactory = null, array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null) { diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index b69fa99c4ae16..b505b65818b14 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -27,7 +27,7 @@ class AnnotationFileLoader extends FileLoader protected $loader; /** - * @throws \RuntimeException + * @throws \LogicException When PHP Tokenizer extension is not installed. */ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) { From 25ea4f9af374c5e654e457e546e1b327e51cf403 Mon Sep 17 00:00:00 2001 From: Gilles Doge Date: Fri, 28 Dec 2018 17:04:47 +0100 Subject: [PATCH 2/3] fix CS --- src/Symfony/Component/Console/Command/LockableTrait.php | 4 ++-- .../Component/DependencyInjection/Dumper/YamlDumper.php | 2 +- .../Messenger/Transport/Serialization/Serializer.php | 2 +- .../Component/PropertyInfo/Extractor/PhpDocExtractor.php | 2 +- src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Component/Console/Command/LockableTrait.php b/src/Symfony/Component/Console/Command/LockableTrait.php index b0c97a16472f2..77996c896bb42 100644 --- a/src/Symfony/Component/Console/Command/LockableTrait.php +++ b/src/Symfony/Component/Console/Command/LockableTrait.php @@ -32,8 +32,8 @@ trait LockableTrait * * @return bool * - * @throws LogicException When Symfony Lock Component is not installed - * or when a lock is already in place. + * @throws LogicException when Symfony Lock Component is not installed + * or when a lock is already in place */ private function lock($name = null, $blocking = false) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index d83150b383110..1cc581cdb6010 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -43,7 +43,7 @@ class YamlDumper extends Dumper * * @return string A YAML string representing of the service container * - * @throws LogicException When Symfony Yaml Component is not installed. + * @throws LogicException when Symfony Yaml Component is not installed */ public function dump(array $options = array()) { diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php b/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php index b082855d9b29b..7b585eb6f5638 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php @@ -47,7 +47,7 @@ public function __construct(SymfonySerializerInterface $serializer = null, strin * * @return self * - * @throws LogicException When Symfony Serializer Component is not installed. + * @throws LogicException when Symfony Serializer Component is not installed */ public static function create(): self { diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index 7486072e91ef9..1bd48f1884106 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -51,7 +51,7 @@ class PhpDocExtractor implements PropertyDescriptionExtractorInterface, Property * @param string[]|null $accessorPrefixes * @param string[]|null $arrayMutatorPrefixes * - * @throws \LogicException When "phpdocumentor/reflection-docblock" package is not installed. + * @throws \LogicException when "phpdocumentor/reflection-docblock" package is not installed */ public function __construct(DocBlockFactoryInterface $docBlockFactory = null, array $mutatorPrefixes = null, array $accessorPrefixes = null, array $arrayMutatorPrefixes = null) { diff --git a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index b505b65818b14..05de0a865f54b 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -27,7 +27,7 @@ class AnnotationFileLoader extends FileLoader protected $loader; /** - * @throws \LogicException When PHP Tokenizer extension is not installed. + * @throws \LogicException when PHP Tokenizer extension is not installed */ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) { From 4da66d881f0ba07fe0d135fc08de62b40e413517 Mon Sep 17 00:00:00 2001 From: Gilles Doge Date: Fri, 28 Dec 2018 17:07:13 +0100 Subject: [PATCH 3/3] remove non valuable comment. The method is already self-documented with it's signature --- .../Messenger/Transport/Serialization/Serializer.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php b/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php index 7b585eb6f5638..14f40fdebcea6 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/Serializer.php @@ -43,10 +43,6 @@ public function __construct(SymfonySerializerInterface $serializer = null, strin } /** - * Create a new Transport Serializer. - * - * @return self - * * @throws LogicException when Symfony Serializer Component is not installed */ public static function create(): self