diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d8e08d8711..94711183ff 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -23,8 +23,8 @@ Symfony is the result of the work of many people who made the code better - Pascal Borreli (pborreli) - Joseph Bielawski (stloyd) - Wouter De Jong (wouterj) - - Karma Dordrak (drak) - Romain Neutron (romain) + - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - Jeremy Mikola (jmikola) @@ -53,11 +53,11 @@ Symfony is the result of the work of many people who made the code better - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Kevin Bond (kbond) + - Peter Rehm (rpet) - Gábor Egyed (1ed) - Michel Weimerskirch (mweimerskirch) - Eric Clemmons (ericclemmons) - Andrej Hudec (pulzarraider) - - Peter Rehm (rpet) - Christian Raue - Matthias Pigulla (mpdude) - Deni @@ -67,6 +67,7 @@ Symfony is the result of the work of many people who made the code better - Iltar van der Berg (kjarli) - Ener-Getick (energetick) - Douglas Greenshields (shieldo) + - Charles Sarrazin (csarrazi) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) @@ -74,7 +75,6 @@ Symfony is the result of the work of many people who made the code better - Pierre du Plessis (pierredup) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - - Charles Sarrazin (csarrazi) - John Wards (johnwards) - Toni Uebernickel (havvg) - Fran Moreno (franmomu) @@ -89,6 +89,7 @@ Symfony is the result of the work of many people who made the code better - Alexander M. Turek (derrabus) - Dariusz Ruminski - marc.weistroff + - Issei Murasawa (issei_m) - lenar - Włodzimierz Gajda (gajdaw) - Alexander Schwenn (xelaris) @@ -97,13 +98,12 @@ Symfony is the result of the work of many people who made the code better - Colin Frei - Adrien Brault (adrienbrault) - Joshua Thijssen - - Issei Murasawa (issei_m) + - Baptiste Clavié (talus) - Peter Kokot (maastermedia) - excelwebzone - Jacob Dreesen (jdreesen) - Jérémy DERUSSÉ (jderusse) - Vladimir Reznichenko (kalessil) - - Baptiste Clavié (talus) - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) - David Buchmann (dbu) @@ -121,6 +121,7 @@ Symfony is the result of the work of many people who made the code better - Evgeniy (ewgraf) - Guilherme Blanco (guilhermeblanco) - Pablo Godel (pgodel) + - Titouan Galopin (tgalopin) - Jérémie Augustin (jaugustin) - Sebastiaan Stok (sstok) - Tugdual Saunier (tucksaun) @@ -129,10 +130,10 @@ Symfony is the result of the work of many people who made the code better - Arnaud Kleinpeter (nanocom) - Joel Wurtz (brouznouf) - Philipp Wahala (hifi) - - Titouan Galopin (tgalopin) - Richard Shank (iampersistent) - Thomas Rabaix (rande) - Vincent AUBERT (vincent) + - Rouven Weßling (realityking) - Mikael Pajunen - Clemens Tolboom - Helmer Aaviksoo @@ -143,7 +144,6 @@ Symfony is the result of the work of many people who made the code better - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba - - Rouven Weßling (realityking) - Warnar Boekkooi (boekkooi) - Dmitrii Chekaliuk (lazyhammer) - Clément JOBEILI (dator) @@ -211,6 +211,7 @@ Symfony is the result of the work of many people who made the code better - Kristen Gilden (kgilden) - Dawid Nowak - Pierre-Yves LEBECQ (pylebecq) + - Daniel Espendiller - Jakub Kucharovic (jkucharovic) - Eugene Leonovich (rybakit) - Filippo Tessarotto @@ -240,7 +241,6 @@ Symfony is the result of the work of many people who made the code better - Michael Holm (hollo) - Marc Weistroff (futurecat) - Hidde Wieringa (hiddewie) - - Daniel Espendiller - Chris Smith (cs278) - Florian Klein (docteurklein) - Manuel Kiessling (manuelkiessling) @@ -293,6 +293,7 @@ Symfony is the result of the work of many people who made the code better - Inal DJAFAR (inalgnu) - Christian Gärtner (dagardner) - Tomasz Kowalczyk (thunderer) + - Christian Schmidt - François-Xavier de Guillebon (de-gui_f) - Damien Alexandre (damienalexandre) - Felix Labrecque @@ -309,6 +310,7 @@ Symfony is the result of the work of many people who made the code better - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) - Greg Thornton (xdissent) + - Robin Chalas (chalas_r) - Costin Bereveanu (schniper) - Loïc Chardonnet (gnusat) - Marek Kalnik (marekkalnik) @@ -319,12 +321,14 @@ Symfony is the result of the work of many people who made the code better - Pavel Volokitin (pvolok) - Endre Fejes - Tobias Naumann (tna) + - Daniel Beyer - Shein Alexey - Baptiste Lafontaine - Joe Lencioni - Daniel Tschinder - Kai - Lee Rowlands + - Krzysztof Piasecki (krzysztek) - Maximilian Reichel (phramz) - Loick Piera (pyrech) - Karoly Negyesi (chx) @@ -364,7 +368,6 @@ Symfony is the result of the work of many people who made the code better - EdgarPE - Florian Pfitzer (marmelatze) - Asier Illarramendi (doup) - - Christian Schmidt - Chris Sedlmayr (catchamonkey) - Seb Koelen - Christoph Mewes (xrstf) @@ -382,6 +385,7 @@ Symfony is the result of the work of many people who made the code better - Mathieu Lemoine - franek (franek) - Christian Wahler + - Mathieu Lemoine - Gintautas Miselis - Zander Baldwin - Adam Harvey @@ -419,7 +423,6 @@ Symfony is the result of the work of many people who made the code better - Anthony Ferrara - Ioan Negulescu - Jakub Škvára (jskvara) - - Daniel Beyer - Andrew Udvare (audvare) - alexpods - Tristan Darricau (nicofuma) @@ -448,6 +451,7 @@ Symfony is the result of the work of many people who made the code better - Denis Gorbachev (starfall) - Peter van Dommelen - Tim van Densen + - Martin Morávek (keeo) - Steven Surowiec - Kevin Saliou (kbsali) - NothingWeAre @@ -462,7 +466,6 @@ Symfony is the result of the work of many people who made the code better - Ziumin - Jeremy Benoist - Lenar Lõhmus - - Krzysztof Piasecki (krzysztek) - Benjamin Laugueux (yzalis) - Zach Badgett (zachbadgett) - Aurélien Fredouelle @@ -501,6 +504,7 @@ Symfony is the result of the work of many people who made the code better - Javier López (loalf) - Reinier Kip - Dustin Dobervich (dustin10) + - dantleech - Anne-Sophie Bachelard (annesophie) - Sebastian Marek (proofek) - Erkhembayar Gantulga (erheme318) @@ -563,6 +567,7 @@ Symfony is the result of the work of many people who made the code better - Peter Ward - Dominik Ritter (dritter) - Sebastian Grodzicki (sgrodzicki) + - SpacePossum - Martin Hujer (martinhujer) - Pascal Helfenstein - Baldur Rensch (brensch) @@ -613,6 +618,7 @@ Symfony is the result of the work of many people who made the code better - Adrien Lucas (adrienlucas) - James Michael DuPont - Tom Klingenberg + - Filip Procházka (fprochazka) - Christopher Hall (mythmakr) - Paul Kamer (pkamer) - Rafał Wrzeszcz (rafalwrzeszcz) @@ -629,6 +635,7 @@ Symfony is the result of the work of many people who made the code better - Alaattin Kahramanlar (alaattin) - Maksim Kotlyar (makasim) - Neil Ferreira + - Nathanael Noblet (gnat) - Dmitry Parnas (parnas) - Théo FIDRY (theofidry) - Paul LE CORRE @@ -745,7 +752,6 @@ Symfony is the result of the work of many people who made the code better - Guillaume Royer - Artem (digi) - boite - - dantleech - Vadim Tyukov (vatson) - Sortex - chispita @@ -851,6 +857,7 @@ Symfony is the result of the work of many people who made the code better - Christian Sciberras - Anton Bakai - Clement Herreman (clemherreman) + - Dan Ionut Dumitriu (danionut90) - Nyro (nyro) - Marco - Marc Torres @@ -870,7 +877,6 @@ Symfony is the result of the work of many people who made the code better - ConneXNL - Aharon Perkel - Abdul.Mohsen B. A. A - - SpacePossum - Benoît Burnichon - Remi Collet - pthompson @@ -1059,6 +1065,7 @@ Symfony is the result of the work of many people who made the code better - stloyd - Chris Tickner - Andrew Coulton + - Jeremy Benoist - Michal Gebauer - Gleb Sidora - David Stone @@ -1108,7 +1115,6 @@ Symfony is the result of the work of many people who made the code better - Simon Sargeant - efeen - Michał Dąbrowski (defrag) - - Nathanael Noblet (gnat) - Simone Fumagalli (hpatoio) - Brian Graham (incognito) - Kevin Vergauwen (innocenzo) @@ -1214,8 +1220,10 @@ Symfony is the result of the work of many people who made the code better - Alan Chen - Maerlyn - Even André Fiskvik + - Erik van Wingerden - Dane Powell - Gerrit Drost + - Linnaea Von Lavia - Lenar Lõhmus - Cristian Gonzalez - AlberT @@ -1271,6 +1279,7 @@ Symfony is the result of the work of many people who made the code better - Joseph Deray - Damian Sromek - Ben + - dasmfm - Arnaud Buathier (arnapou) - chesteroni (chesteroni) - Mauricio Lopez (diaspar) @@ -1358,7 +1367,6 @@ Symfony is the result of the work of many people who made the code better - Norman Soetbeer - zorn - Benjamin Long - - Robin Chalas - Matt Janssen - Peter Gribanov - kwiateusz @@ -1443,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better - ollie harridge (ollietb) - Paul Andrieux (paulandrieux) - Paweł Szczepanek (pauluz) + - Philippe Degeeter (pdegeeter) - Christian López Espínola (penyaskito) - Petr Jaroš (petajaros) - Philipp Hoffmann (philipphoffmann) diff --git a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php index 1712bd5afe..f9333bf683 100644 --- a/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php +++ b/src/Symfony/Bridge/Twig/NodeVisitor/Scope.php @@ -67,9 +67,9 @@ class Scope * @param string $key * @param mixed $value * - * @throws \LogicException - * * @return Scope Current scope + * + * @throws \LogicException */ public function set($key, $value) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php index ce06c6169b..68ec13a464 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/DelegatingLoader.php @@ -78,7 +78,7 @@ class DelegatingLoader extends BaseDelegatingLoader if ($controller = $route->getDefault('_controller')) { try { $controller = $this->parser->parse($controller); - } catch (\Exception $e) { + } catch (\InvalidArgumentException $e) { // unable to optimize unknown notation } diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index ca9e7f994c..cf7f3c5769 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -182,9 +182,9 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface /** * @param string $file * - * @throws \InvalidArgumentException - * * @return bool + * + * @throws \InvalidArgumentException */ protected function canBeExtracted($file) { diff --git a/src/Symfony/Component/CssSelector/Parser/Parser.php b/src/Symfony/Component/CssSelector/Parser/Parser.php index f94aea36a6..3c5b2dd264 100644 --- a/src/Symfony/Component/CssSelector/Parser/Parser.php +++ b/src/Symfony/Component/CssSelector/Parser/Parser.php @@ -58,9 +58,9 @@ class Parser implements ParserInterface * * @param Token[] $tokens * - * @throws SyntaxErrorException - * * @return array + * + * @throws SyntaxErrorException */ public static function parseSeries(array $tokens) { @@ -133,9 +133,9 @@ class Parser implements ParserInterface * * @param TokenStream $stream * - * @throws SyntaxErrorException - * * @return Node\SelectorNode + * + * @throws SyntaxErrorException */ private function parserSelectorNode(TokenStream $stream) { @@ -173,9 +173,9 @@ class Parser implements ParserInterface * @param TokenStream $stream * @param bool $insideNegation * - * @throws SyntaxErrorException - * * @return array + * + * @throws SyntaxErrorException */ private function parseSimpleSelector(TokenStream $stream, $insideNegation = false) { @@ -330,9 +330,9 @@ class Parser implements ParserInterface * @param Node\NodeInterface $selector * @param TokenStream $stream * - * @throws SyntaxErrorException - * * @return Node\AttributeNode + * + * @throws SyntaxErrorException */ private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream) { diff --git a/src/Symfony/Component/CssSelector/Parser/TokenStream.php b/src/Symfony/Component/CssSelector/Parser/TokenStream.php index 1ec727febf..b1f912f9d7 100644 --- a/src/Symfony/Component/CssSelector/Parser/TokenStream.php +++ b/src/Symfony/Component/CssSelector/Parser/TokenStream.php @@ -85,9 +85,9 @@ class TokenStream /** * Returns next token. * - * @throws InternalErrorException If there is no more token - * * @return Token + * + * @throws InternalErrorException If there is no more token */ public function getNext() { @@ -133,9 +133,9 @@ class TokenStream /** * Returns nex identifier token. * - * @throws SyntaxErrorException If next token is not an identifier - * * @return string The identifier token value + * + * @throws SyntaxErrorException If next token is not an identifier */ public function getNextIdentifier() { @@ -151,9 +151,9 @@ class TokenStream /** * Returns nex identifier or star delimiter token. * - * @throws SyntaxErrorException If next token is not an identifier or a star delimiter - * * @return null|string The identifier token value or null if star found + * + * @throws SyntaxErrorException If next token is not an identifier or a star delimiter */ public function getNextIdentifierOrStar() { diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php index 8c021b3bee..8cbea5ca95 100644 --- a/src/Symfony/Component/CssSelector/XPath/Translator.php +++ b/src/Symfony/Component/CssSelector/XPath/Translator.php @@ -268,9 +268,9 @@ class Translator implements TranslatorInterface * @param string $attribute * @param string $value * - * @throws ExpressionErrorException - * * @return XPathExpr + * + * @throws ExpressionErrorException */ public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value) { diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index ce0336b3e4..c6660ccb6a 100644 --- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -1176,7 +1176,7 @@ EOF; return true; } - if ($deep && !isset($visited[$argumentId])) { + if ($deep && !isset($visited[$argumentId]) && 'service_container' !== $argumentId) { $visited[$argumentId] = true; $service = $this->container->getDefinition($argumentId); diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index 97a72b8266..b40c835d3f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -284,4 +284,15 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase $this->assertEquals(file_get_contents(self::$fixturesPath.'/php/services24.php'), $dumper->dump()); } + + public function testInlinedDefinitionReferencingServiceContainer() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addMethodCall('add', array(new Reference('service_container')))->setPublic(false); + $container->register('bar', 'stdClass')->addArgument(new Reference('foo')); + $container->compile(); + + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); + } } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php new file mode 100644 index 0000000000..a3dcfc6986 --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services13.php @@ -0,0 +1,57 @@ +services = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + ); + + $this->aliases = array(); + } + + /** + * {@inheritdoc} + */ + public function compile() + { + throw new LogicException('You cannot compile a dumped frozen container.'); + } + + /** + * Gets the 'bar' service. + * + * This service is shared. + * This method always returns the same instance of the service. + * + * @return \stdClass A stdClass instance. + */ + protected function getBarService() + { + $a = new \stdClass(); + $a->add($this); + + return $this->services['bar'] = new \stdClass($a); + } +} diff --git a/src/Symfony/Component/EventDispatcher/GenericEvent.php b/src/Symfony/Component/EventDispatcher/GenericEvent.php index 6458180a5a..03cbcfe334 100644 --- a/src/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/src/Symfony/Component/EventDispatcher/GenericEvent.php @@ -61,9 +61,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate * * @param string $key Key. * - * @throws \InvalidArgumentException If key is not found. - * * @return mixed Contents of array key. + * + * @throws \InvalidArgumentException If key is not found. */ public function getArgument($key) { @@ -130,9 +130,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate * * @param string $key Array key. * - * @throws \InvalidArgumentException If key does not exist in $this->args. - * * @return mixed + * + * @throws \InvalidArgumentException If key does not exist in $this->args. */ public function offsetGet($key) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index d6467fc194..2e6df405d5 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -126,7 +126,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer try { // read timestamp into DateTime object - the formatter delivers in UTC - $dateTime = new \DateTime(sprintf('@%s UTC', $timestamp)); + $dateTime = new \DateTime(sprintf('@%s', $timestamp)); } catch (\Exception $e) { throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); } diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index f306e11051..74ff45b297 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -1018,9 +1018,9 @@ class Form implements \IteratorAggregate, FormInterface * * @param mixed $value The value to transform * - * @throws TransformationFailedException If the value cannot be transformed to "normalized" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "normalized" format */ private function modelToNorm($value) { @@ -1044,9 +1044,9 @@ class Form implements \IteratorAggregate, FormInterface * * @param string $value The value to reverse transform * - * @throws TransformationFailedException If the value cannot be transformed to "model" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "model" format */ private function normToModel($value) { @@ -1072,9 +1072,9 @@ class Form implements \IteratorAggregate, FormInterface * * @param mixed $value The value to transform * - * @throws TransformationFailedException If the value cannot be transformed to "view" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "view" format */ private function normToView($value) { @@ -1107,9 +1107,9 @@ class Form implements \IteratorAggregate, FormInterface * * @param string $value The value to reverse transform * - * @throws TransformationFailedException If the value cannot be transformed to "normalized" format - * * @return mixed + * + * @throws TransformationFailedException If the value cannot be transformed to "normalized" format */ private function viewToNorm($value) { diff --git a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php index 06534aa75b..1d26e86b9b 100644 --- a/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php +++ b/src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php @@ -181,9 +181,9 @@ class ResponseHeaderBag extends HeaderBag * * @param string $format * - * @throws \InvalidArgumentException When the $format is invalid - * * @return array + * + * @throws \InvalidArgumentException When the $format is invalid */ public function getCookies($format = self::COOKIES_FLAT) { diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 4b2f5d27aa..206f18e77f 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -24,9 +24,9 @@ interface SessionStorageInterface /** * Starts the session. * - * @throws \RuntimeException If something goes wrong starting the session. - * * @return bool True if started. + * + * @throws \RuntimeException If something goes wrong starting the session. */ public function start(); diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index 546e3ca2b3..1c7684a91b 100644 --- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -154,6 +154,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * Gets the Surrogate instance. * * @return SurrogateInterface A Surrogate instance + * + * @throws \LogicException */ public function getSurrogate() { diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 40690c404f..53c4d8781d 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -486,10 +486,10 @@ class Process implements \IteratorAggregate * In comparison with the getOutput method which always return the whole * output, this one returns the new output since the last call. * + * @return string The process output since the last call + * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started - * - * @return string The process output since the last call */ public function getIncrementalOutput() { @@ -601,10 +601,10 @@ class Process implements \IteratorAggregate * whole error output, this one returns the new error output since the last * call. * + * @return string The process error output since the last call + * * @throws LogicException in case the output has been disabled * @throws LogicException In case the process is not started - * - * @return string The process error output since the last call */ public function getIncrementalErrorOutput() { diff --git a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php index f8f17b4f72..352ba584a7 100644 --- a/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php +++ b/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php @@ -59,7 +59,7 @@ class ChainDecoder implements DecoderInterface * * @return DecoderInterface * - * @throws RuntimeException if no decoder is found + * @throws RuntimeException If no decoder is found. */ private function getDecoder($format) { diff --git a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php index 460a6998c5..c9fab66558 100644 --- a/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php +++ b/src/Symfony/Component/Serializer/Encoder/XmlEncoder.php @@ -464,6 +464,8 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec * @param mixed $val * * @return bool + * + * @throws UnexpectedValueException */ private function selectNodeType(\DOMNode $node, $val) { diff --git a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index 86c270299e..8ad1386a6c 100644 --- a/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -33,6 +33,8 @@ interface DenormalizableInterface * @param string|null $format The format is optionally given to be able to denormalize differently * based on different input formats * @param array $context options for denormalizing + * + * @return object */ public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); } diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php index b9fefe887a..e19fe5ce58 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php @@ -33,7 +33,7 @@ interface NormalizableInterface * based on different output formats. * @param array $context Options for normalizing this object * - * @return array|string|bool|int|float|null + * @return array|scalar */ public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array()); } diff --git a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index 2a51d631b1..f4bd355232 100644 --- a/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -25,7 +25,7 @@ interface NormalizerInterface * @param string $format format the normalization result will be encoded as * @param array $context Context options for the normalizer * - * @return array|string|bool|int|float|null + * @return array|scalar */ public function normalize($object, $format = null, array $context = array()); diff --git a/src/Symfony/Component/Stopwatch/StopwatchEvent.php b/src/Symfony/Component/Stopwatch/StopwatchEvent.php index 930722d2f5..957a5d0dae 100644 --- a/src/Symfony/Component/Stopwatch/StopwatchEvent.php +++ b/src/Symfony/Component/Stopwatch/StopwatchEvent.php @@ -87,8 +87,6 @@ class StopwatchEvent /** * Stops the last started event period. * - * @throws \LogicException When start wasn't called before stopping - * * @return StopwatchEvent The event * * @throws \LogicException When stop() is called without a matching call to start() diff --git a/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php b/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php index 196bc33410..57fd4938d2 100644 --- a/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php +++ b/src/Symfony/Component/Translation/Extractor/AbstractFileExtractor.php @@ -54,9 +54,9 @@ abstract class AbstractFileExtractor /** * @param string $file * - * @throws \InvalidArgumentException - * * @return bool + * + * @throws \InvalidArgumentException */ protected function isFile($file) { diff --git a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php index 9c13e2df87..3f10d2f232 100644 --- a/src/Symfony/Component/Translation/Loader/XliffFileLoader.php +++ b/src/Symfony/Component/Translation/Loader/XliffFileLoader.php @@ -165,6 +165,8 @@ class XliffFileLoader implements LoaderInterface } /** + * Validates and parses the given file into a DOMDocument. + * * @param string $file * @param \DOMDocument $dom * @param string $schema source of the schema diff --git a/src/Symfony/Component/Translation/TranslatorBagInterface.php b/src/Symfony/Component/Translation/TranslatorBagInterface.php index 6f650b5ee0..14fbb17f5e 100644 --- a/src/Symfony/Component/Translation/TranslatorBagInterface.php +++ b/src/Symfony/Component/Translation/TranslatorBagInterface.php @@ -23,9 +23,9 @@ interface TranslatorBagInterface * * @param string|null $locale The locale or null to use the default * - * @throws \InvalidArgumentException If the locale contains invalid characters - * * @return MessageCatalogueInterface + * + * @throws \InvalidArgumentException If the locale contains invalid characters */ public function getCatalogue($locale = null); } diff --git a/src/Symfony/Component/Translation/TranslatorInterface.php b/src/Symfony/Component/Translation/TranslatorInterface.php index 869e0b9004..6916c335bd 100644 --- a/src/Symfony/Component/Translation/TranslatorInterface.php +++ b/src/Symfony/Component/Translation/TranslatorInterface.php @@ -26,9 +26,9 @@ interface TranslatorInterface * @param string|null $domain The domain for the message or null to use the default * @param string|null $locale The locale or null to use the default * - * @throws \InvalidArgumentException If the locale contains invalid characters - * * @return string The translated string + * + * @throws \InvalidArgumentException If the locale contains invalid characters */ public function trans($id, array $parameters = array(), $domain = null, $locale = null); @@ -41,9 +41,9 @@ interface TranslatorInterface * @param string|null $domain The domain for the message or null to use the default * @param string|null $locale The locale or null to use the default * - * @throws \InvalidArgumentException If the locale contains invalid characters - * * @return string The translated string + * + * @throws \InvalidArgumentException If the locale contains invalid characters */ public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); diff --git a/src/Symfony/Component/Yaml/Dumper.php b/src/Symfony/Component/Yaml/Dumper.php index 0c6cf3c209..8a1d574b60 100644 --- a/src/Symfony/Component/Yaml/Dumper.php +++ b/src/Symfony/Component/Yaml/Dumper.php @@ -85,7 +85,7 @@ class Dumper if ($inline <= 0 || !is_array($input) || empty($input)) { $output .= $prefix.Inline::dump($input, $flags); } else { - $isAHash = array_keys($input) !== range(0, count($input) - 1); + $isAHash = Inline::isHash($input); foreach ($input as $key => $value) { if ($inline > 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n")) { diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index cc994b9562..aab8fe3458 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -214,6 +214,28 @@ class Inline } } + /** + * Check if given array is hash or just normal indexed array. + * + * @internal + * + * @param array $value The PHP array to check + * + * @return bool true if value is hash array, false otherwise + */ + public static function isHash(array $value) + { + $expectedKey = 0; + + foreach ($value as $key => $val) { + if ($key !== $expectedKey++) { + return true; + } + } + + return false; + } + /** * Dumps a PHP array to a YAML string. * @@ -225,11 +247,7 @@ class Inline private static function dumpArray($value, $flags) { // array - $keys = array_keys($value); - $keysCount = count($keys); - if ((1 === $keysCount && '0' == $keys[0]) - || ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2) - ) { + if ($value && !self::isHash($value)) { $output = array(); foreach ($value as $val) { $output[] = self::dump($val, $flags); @@ -238,7 +256,7 @@ class Inline return sprintf('[%s]', implode(', ', $output)); } - // mapping + // hash $output = array(); foreach ($value as $key => $val) { $output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index aadb7ff6cb..fb6210dd7d 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -277,6 +277,24 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->assertContains('Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1 and will throw a ParseException in 4.0.', $deprecations[0]); } + /** + * @dataProvider getDataForIsHash + */ + public function testIsHash($array, $expected) + { + $this->assertSame($expected, Inline::isHash($array)); + } + + public function getDataForIsHash() + { + return array( + array(array(), false), + array(array(1, 2, 3), false), + array(array(2 => 1, 1 => 2, 0 => 3), true), + array(array('foo' => 1, 'bar' => 2), true), + ); + } + public function getTestsForParse() { return array( @@ -483,6 +501,8 @@ class InlineTest extends \PHPUnit_Framework_TestCase array('[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]', array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo')))), array('[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']', array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%'), true, '@service_container')), + + array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))), ); }