Merge branch '3.0' into 3.1

* 3.0:
  `@throws` annotations should go after `@return`
  Fix merge
  updated VERSION for 2.3.42
  update CONTRIBUTORS for 2.3.42
  updated CHANGELOG for 2.3.42
  Revert "bug #18908 [DependencyInjection] force enabling the external XML entity loaders (xabbuh)"
  Partial revert of previous PR
  [DependencyInjection] Skip deep reference check for 'service_container'
  Catch \Throwable
  [Serializer] Add missing @throws annotations
  Fix for #18843
  force enabling the external XML entity loaders
  Removed UTC specification with timestamp

Conflicts:
	src/Symfony/Component/Yaml/Tests/InlineTest.php
This commit is contained in:
Nicolas Grekas 2016-06-06 13:34:54 +02:00
commit a249f5d582
30 changed files with 199 additions and 78 deletions

View File

@ -23,8 +23,8 @@ Symfony is the result of the work of many people who made the code better
- Pascal Borreli (pborreli) - Pascal Borreli (pborreli)
- Joseph Bielawski (stloyd) - Joseph Bielawski (stloyd)
- Wouter De Jong (wouterj) - Wouter De Jong (wouterj)
- Karma Dordrak (drak)
- Romain Neutron (romain) - Romain Neutron (romain)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith) - Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason) - Martin Hasoň (hason)
- Jeremy Mikola (jmikola) - 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) - Bilal Amarni (bamarni)
- Florin Patan (florinpatan) - Florin Patan (florinpatan)
- Kevin Bond (kbond) - Kevin Bond (kbond)
- Peter Rehm (rpet)
- Gábor Egyed (1ed) - Gábor Egyed (1ed)
- Michel Weimerskirch (mweimerskirch) - Michel Weimerskirch (mweimerskirch)
- Eric Clemmons (ericclemmons) - Eric Clemmons (ericclemmons)
- Andrej Hudec (pulzarraider) - Andrej Hudec (pulzarraider)
- Peter Rehm (rpet)
- Christian Raue - Christian Raue
- Matthias Pigulla (mpdude) - Matthias Pigulla (mpdude)
- Deni - 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) - Iltar van der Berg (kjarli)
- Ener-Getick (energetick) - Ener-Getick (energetick)
- Douglas Greenshields (shieldo) - Douglas Greenshields (shieldo)
- Charles Sarrazin (csarrazi)
- Lee McDermott - Lee McDermott
- Brandon Turner - Brandon Turner
- Luis Cordova (cordoval) - 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) - Pierre du Plessis (pierredup)
- Bart van den Burg (burgov) - Bart van den Burg (burgov)
- Jordan Alliot (jalliot) - Jordan Alliot (jalliot)
- Charles Sarrazin (csarrazi)
- John Wards (johnwards) - John Wards (johnwards)
- Toni Uebernickel (havvg) - Toni Uebernickel (havvg)
- Fran Moreno (franmomu) - 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) - Alexander M. Turek (derrabus)
- Dariusz Ruminski - Dariusz Ruminski
- marc.weistroff - marc.weistroff
- Issei Murasawa (issei_m)
- lenar - lenar
- Włodzimierz Gajda (gajdaw) - Włodzimierz Gajda (gajdaw)
- Alexander Schwenn (xelaris) - Alexander Schwenn (xelaris)
@ -97,13 +98,12 @@ Symfony is the result of the work of many people who made the code better
- Colin Frei - Colin Frei
- Adrien Brault (adrienbrault) - Adrien Brault (adrienbrault)
- Joshua Thijssen - Joshua Thijssen
- Issei Murasawa (issei_m) - Baptiste Clavié (talus)
- Peter Kokot (maastermedia) - Peter Kokot (maastermedia)
- excelwebzone - excelwebzone
- Jacob Dreesen (jdreesen) - Jacob Dreesen (jdreesen)
- Jérémy DERUSSÉ (jderusse) - Jérémy DERUSSÉ (jderusse)
- Vladimir Reznichenko (kalessil) - Vladimir Reznichenko (kalessil)
- Baptiste Clavié (talus)
- Fabien Pennequin (fabienpennequin) - Fabien Pennequin (fabienpennequin)
- Gordon Franke (gimler) - Gordon Franke (gimler)
- David Buchmann (dbu) - David Buchmann (dbu)
@ -121,6 +121,7 @@ Symfony is the result of the work of many people who made the code better
- Evgeniy (ewgraf) - Evgeniy (ewgraf)
- Guilherme Blanco (guilhermeblanco) - Guilherme Blanco (guilhermeblanco)
- Pablo Godel (pgodel) - Pablo Godel (pgodel)
- Titouan Galopin (tgalopin)
- Jérémie Augustin (jaugustin) - Jérémie Augustin (jaugustin)
- Sebastiaan Stok (sstok) - Sebastiaan Stok (sstok)
- Tugdual Saunier (tucksaun) - 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) - Arnaud Kleinpeter (nanocom)
- Joel Wurtz (brouznouf) - Joel Wurtz (brouznouf)
- Philipp Wahala (hifi) - Philipp Wahala (hifi)
- Titouan Galopin (tgalopin)
- Richard Shank (iampersistent) - Richard Shank (iampersistent)
- Thomas Rabaix (rande) - Thomas Rabaix (rande)
- Vincent AUBERT (vincent) - Vincent AUBERT (vincent)
- Rouven Weßling (realityking)
- Mikael Pajunen - Mikael Pajunen
- Clemens Tolboom - Clemens Tolboom
- Helmer Aaviksoo - Helmer Aaviksoo
@ -143,7 +144,6 @@ Symfony is the result of the work of many people who made the code better
- Amal Raghav (kertz) - Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram) - Jonathan Ingram (jonathaningram)
- Artur Kotyrba - Artur Kotyrba
- Rouven Weßling (realityking)
- Warnar Boekkooi (boekkooi) - Warnar Boekkooi (boekkooi)
- Dmitrii Chekaliuk (lazyhammer) - Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator) - 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) - Kristen Gilden (kgilden)
- Dawid Nowak - Dawid Nowak
- Pierre-Yves LEBECQ (pylebecq) - Pierre-Yves LEBECQ (pylebecq)
- Daniel Espendiller
- Jakub Kucharovic (jkucharovic) - Jakub Kucharovic (jkucharovic)
- Eugene Leonovich (rybakit) - Eugene Leonovich (rybakit)
- Filippo Tessarotto - Filippo Tessarotto
@ -240,7 +241,6 @@ Symfony is the result of the work of many people who made the code better
- Michael Holm (hollo) - Michael Holm (hollo)
- Marc Weistroff (futurecat) - Marc Weistroff (futurecat)
- Hidde Wieringa (hiddewie) - Hidde Wieringa (hiddewie)
- Daniel Espendiller
- Chris Smith (cs278) - Chris Smith (cs278)
- Florian Klein (docteurklein) - Florian Klein (docteurklein)
- Manuel Kiessling (manuelkiessling) - 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) - Inal DJAFAR (inalgnu)
- Christian Gärtner (dagardner) - Christian Gärtner (dagardner)
- Tomasz Kowalczyk (thunderer) - Tomasz Kowalczyk (thunderer)
- Christian Schmidt
- François-Xavier de Guillebon (de-gui_f) - François-Xavier de Guillebon (de-gui_f)
- Damien Alexandre (damienalexandre) - Damien Alexandre (damienalexandre)
- Felix Labrecque - 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) - Philipp Kräutli (pkraeutli)
- Kirill chEbba Chebunin (chebba) - Kirill chEbba Chebunin (chebba)
- Greg Thornton (xdissent) - Greg Thornton (xdissent)
- Robin Chalas (chalas_r)
- Costin Bereveanu (schniper) - Costin Bereveanu (schniper)
- Loïc Chardonnet (gnusat) - Loïc Chardonnet (gnusat)
- Marek Kalnik (marekkalnik) - 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) - Pavel Volokitin (pvolok)
- Endre Fejes - Endre Fejes
- Tobias Naumann (tna) - Tobias Naumann (tna)
- Daniel Beyer
- Shein Alexey - Shein Alexey
- Baptiste Lafontaine - Baptiste Lafontaine
- Joe Lencioni - Joe Lencioni
- Daniel Tschinder - Daniel Tschinder
- Kai - Kai
- Lee Rowlands - Lee Rowlands
- Krzysztof Piasecki (krzysztek)
- Maximilian Reichel (phramz) - Maximilian Reichel (phramz)
- Loick Piera (pyrech) - Loick Piera (pyrech)
- Karoly Negyesi (chx) - Karoly Negyesi (chx)
@ -364,7 +368,6 @@ Symfony is the result of the work of many people who made the code better
- EdgarPE - EdgarPE
- Florian Pfitzer (marmelatze) - Florian Pfitzer (marmelatze)
- Asier Illarramendi (doup) - Asier Illarramendi (doup)
- Christian Schmidt
- Chris Sedlmayr (catchamonkey) - Chris Sedlmayr (catchamonkey)
- Seb Koelen - Seb Koelen
- Christoph Mewes (xrstf) - Christoph Mewes (xrstf)
@ -382,6 +385,7 @@ Symfony is the result of the work of many people who made the code better
- Mathieu Lemoine - Mathieu Lemoine
- franek (franek) - franek (franek)
- Christian Wahler - Christian Wahler
- Mathieu Lemoine
- Gintautas Miselis - Gintautas Miselis
- Zander Baldwin - Zander Baldwin
- Adam Harvey - Adam Harvey
@ -419,7 +423,6 @@ Symfony is the result of the work of many people who made the code better
- Anthony Ferrara - Anthony Ferrara
- Ioan Negulescu - Ioan Negulescu
- Jakub Škvára (jskvara) - Jakub Škvára (jskvara)
- Daniel Beyer
- Andrew Udvare (audvare) - Andrew Udvare (audvare)
- alexpods - alexpods
- Tristan Darricau (nicofuma) - 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) - Denis Gorbachev (starfall)
- Peter van Dommelen - Peter van Dommelen
- Tim van Densen - Tim van Densen
- Martin Morávek (keeo)
- Steven Surowiec - Steven Surowiec
- Kevin Saliou (kbsali) - Kevin Saliou (kbsali)
- NothingWeAre - NothingWeAre
@ -462,7 +466,6 @@ Symfony is the result of the work of many people who made the code better
- Ziumin - Ziumin
- Jeremy Benoist - Jeremy Benoist
- Lenar Lõhmus - Lenar Lõhmus
- Krzysztof Piasecki (krzysztek)
- Benjamin Laugueux (yzalis) - Benjamin Laugueux (yzalis)
- Zach Badgett (zachbadgett) - Zach Badgett (zachbadgett)
- Aurélien Fredouelle - 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) - Javier López (loalf)
- Reinier Kip - Reinier Kip
- Dustin Dobervich (dustin10) - Dustin Dobervich (dustin10)
- dantleech
- Anne-Sophie Bachelard (annesophie) - Anne-Sophie Bachelard (annesophie)
- Sebastian Marek (proofek) - Sebastian Marek (proofek)
- Erkhembayar Gantulga (erheme318) - Erkhembayar Gantulga (erheme318)
@ -563,6 +567,7 @@ Symfony is the result of the work of many people who made the code better
- Peter Ward - Peter Ward
- Dominik Ritter (dritter) - Dominik Ritter (dritter)
- Sebastian Grodzicki (sgrodzicki) - Sebastian Grodzicki (sgrodzicki)
- SpacePossum
- Martin Hujer (martinhujer) - Martin Hujer (martinhujer)
- Pascal Helfenstein - Pascal Helfenstein
- Baldur Rensch (brensch) - 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) - Adrien Lucas (adrienlucas)
- James Michael DuPont - James Michael DuPont
- Tom Klingenberg - Tom Klingenberg
- Filip Procházka (fprochazka)
- Christopher Hall (mythmakr) - Christopher Hall (mythmakr)
- Paul Kamer (pkamer) - Paul Kamer (pkamer)
- Rafał Wrzeszcz (rafalwrzeszcz) - 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) - Alaattin Kahramanlar (alaattin)
- Maksim Kotlyar (makasim) - Maksim Kotlyar (makasim)
- Neil Ferreira - Neil Ferreira
- Nathanael Noblet (gnat)
- Dmitry Parnas (parnas) - Dmitry Parnas (parnas)
- Théo FIDRY (theofidry) - Théo FIDRY (theofidry)
- Paul LE CORRE - Paul LE CORRE
@ -745,7 +752,6 @@ Symfony is the result of the work of many people who made the code better
- Guillaume Royer - Guillaume Royer
- Artem (digi) - Artem (digi)
- boite - boite
- dantleech
- Vadim Tyukov (vatson) - Vadim Tyukov (vatson)
- Sortex - Sortex
- chispita - chispita
@ -851,6 +857,7 @@ Symfony is the result of the work of many people who made the code better
- Christian Sciberras - Christian Sciberras
- Anton Bakai - Anton Bakai
- Clement Herreman (clemherreman) - Clement Herreman (clemherreman)
- Dan Ionut Dumitriu (danionut90)
- Nyro (nyro) - Nyro (nyro)
- Marco - Marco
- Marc Torres - Marc Torres
@ -870,7 +877,6 @@ Symfony is the result of the work of many people who made the code better
- ConneXNL - ConneXNL
- Aharon Perkel - Aharon Perkel
- Abdul.Mohsen B. A. A - Abdul.Mohsen B. A. A
- SpacePossum
- Benoît Burnichon - Benoît Burnichon
- Remi Collet - Remi Collet
- pthompson - pthompson
@ -1059,6 +1065,7 @@ Symfony is the result of the work of many people who made the code better
- stloyd - stloyd
- Chris Tickner - Chris Tickner
- Andrew Coulton - Andrew Coulton
- Jeremy Benoist
- Michal Gebauer - Michal Gebauer
- Gleb Sidora - Gleb Sidora
- David Stone - David Stone
@ -1108,7 +1115,6 @@ Symfony is the result of the work of many people who made the code better
- Simon Sargeant - Simon Sargeant
- efeen - efeen
- Michał Dąbrowski (defrag) - Michał Dąbrowski (defrag)
- Nathanael Noblet (gnat)
- Simone Fumagalli (hpatoio) - Simone Fumagalli (hpatoio)
- Brian Graham (incognito) - Brian Graham (incognito)
- Kevin Vergauwen (innocenzo) - Kevin Vergauwen (innocenzo)
@ -1214,8 +1220,10 @@ Symfony is the result of the work of many people who made the code better
- Alan Chen - Alan Chen
- Maerlyn - Maerlyn
- Even André Fiskvik - Even André Fiskvik
- Erik van Wingerden
- Dane Powell - Dane Powell
- Gerrit Drost - Gerrit Drost
- Linnaea Von Lavia
- Lenar Lõhmus - Lenar Lõhmus
- Cristian Gonzalez - Cristian Gonzalez
- AlberT - AlberT
@ -1271,6 +1279,7 @@ Symfony is the result of the work of many people who made the code better
- Joseph Deray - Joseph Deray
- Damian Sromek - Damian Sromek
- Ben - Ben
- dasmfm
- Arnaud Buathier (arnapou) - Arnaud Buathier (arnapou)
- chesteroni (chesteroni) - chesteroni (chesteroni)
- Mauricio Lopez (diaspar) - Mauricio Lopez (diaspar)
@ -1358,7 +1367,6 @@ Symfony is the result of the work of many people who made the code better
- Norman Soetbeer - Norman Soetbeer
- zorn - zorn
- Benjamin Long - Benjamin Long
- Robin Chalas
- Matt Janssen - Matt Janssen
- Peter Gribanov - Peter Gribanov
- kwiateusz - kwiateusz
@ -1443,6 +1451,7 @@ Symfony is the result of the work of many people who made the code better
- ollie harridge (ollietb) - ollie harridge (ollietb)
- Paul Andrieux (paulandrieux) - Paul Andrieux (paulandrieux)
- Paweł Szczepanek (pauluz) - Paweł Szczepanek (pauluz)
- Philippe Degeeter (pdegeeter)
- Christian López Espínola (penyaskito) - Christian López Espínola (penyaskito)
- Petr Jaroš (petajaros) - Petr Jaroš (petajaros)
- Philipp Hoffmann (philipphoffmann) - Philipp Hoffmann (philipphoffmann)

View File

@ -67,9 +67,9 @@ class Scope
* @param string $key * @param string $key
* @param mixed $value * @param mixed $value
* *
* @throws \LogicException
*
* @return Scope Current scope * @return Scope Current scope
*
* @throws \LogicException
*/ */
public function set($key, $value) public function set($key, $value)
{ {

View File

@ -78,7 +78,7 @@ class DelegatingLoader extends BaseDelegatingLoader
if ($controller = $route->getDefault('_controller')) { if ($controller = $route->getDefault('_controller')) {
try { try {
$controller = $this->parser->parse($controller); $controller = $this->parser->parse($controller);
} catch (\Exception $e) { } catch (\InvalidArgumentException $e) {
// unable to optimize unknown notation // unable to optimize unknown notation
} }

View File

@ -182,9 +182,9 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface
/** /**
* @param string $file * @param string $file
* *
* @throws \InvalidArgumentException
*
* @return bool * @return bool
*
* @throws \InvalidArgumentException
*/ */
protected function canBeExtracted($file) protected function canBeExtracted($file)
{ {

View File

@ -58,9 +58,9 @@ class Parser implements ParserInterface
* *
* @param Token[] $tokens * @param Token[] $tokens
* *
* @throws SyntaxErrorException
*
* @return array * @return array
*
* @throws SyntaxErrorException
*/ */
public static function parseSeries(array $tokens) public static function parseSeries(array $tokens)
{ {
@ -133,9 +133,9 @@ class Parser implements ParserInterface
* *
* @param TokenStream $stream * @param TokenStream $stream
* *
* @throws SyntaxErrorException
*
* @return Node\SelectorNode * @return Node\SelectorNode
*
* @throws SyntaxErrorException
*/ */
private function parserSelectorNode(TokenStream $stream) private function parserSelectorNode(TokenStream $stream)
{ {
@ -173,9 +173,9 @@ class Parser implements ParserInterface
* @param TokenStream $stream * @param TokenStream $stream
* @param bool $insideNegation * @param bool $insideNegation
* *
* @throws SyntaxErrorException
*
* @return array * @return array
*
* @throws SyntaxErrorException
*/ */
private function parseSimpleSelector(TokenStream $stream, $insideNegation = false) private function parseSimpleSelector(TokenStream $stream, $insideNegation = false)
{ {
@ -330,9 +330,9 @@ class Parser implements ParserInterface
* @param Node\NodeInterface $selector * @param Node\NodeInterface $selector
* @param TokenStream $stream * @param TokenStream $stream
* *
* @throws SyntaxErrorException
*
* @return Node\AttributeNode * @return Node\AttributeNode
*
* @throws SyntaxErrorException
*/ */
private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream) private function parseAttributeNode(Node\NodeInterface $selector, TokenStream $stream)
{ {

View File

@ -85,9 +85,9 @@ class TokenStream
/** /**
* Returns next token. * Returns next token.
* *
* @throws InternalErrorException If there is no more token
*
* @return Token * @return Token
*
* @throws InternalErrorException If there is no more token
*/ */
public function getNext() public function getNext()
{ {
@ -133,9 +133,9 @@ class TokenStream
/** /**
* Returns nex identifier token. * Returns nex identifier token.
* *
* @throws SyntaxErrorException If next token is not an identifier
*
* @return string The identifier token value * @return string The identifier token value
*
* @throws SyntaxErrorException If next token is not an identifier
*/ */
public function getNextIdentifier() public function getNextIdentifier()
{ {
@ -151,9 +151,9 @@ class TokenStream
/** /**
* Returns nex identifier or star delimiter token. * 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 * @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() public function getNextIdentifierOrStar()
{ {

View File

@ -268,9 +268,9 @@ class Translator implements TranslatorInterface
* @param string $attribute * @param string $attribute
* @param string $value * @param string $value
* *
* @throws ExpressionErrorException
*
* @return XPathExpr * @return XPathExpr
*
* @throws ExpressionErrorException
*/ */
public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value) public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $value)
{ {

View File

@ -1176,7 +1176,7 @@ EOF;
return true; return true;
} }
if ($deep && !isset($visited[$argumentId])) { if ($deep && !isset($visited[$argumentId]) && 'service_container' !== $argumentId) {
$visited[$argumentId] = true; $visited[$argumentId] = true;
$service = $this->container->getDefinition($argumentId); $service = $this->container->getDefinition($argumentId);

View File

@ -284,4 +284,15 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(file_get_contents(self::$fixturesPath.'/php/services24.php'), $dumper->dump()); $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');
}
} }

View File

@ -0,0 +1,57 @@
<?php
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
/**
* ProjectServiceContainer.
*
* This class has been auto-generated
* by the Symfony Dependency Injection Component.
*/
class ProjectServiceContainer extends Container
{
private $parameters;
private $targetDirs = array();
/**
* Constructor.
*/
public function __construct()
{
$this->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);
}
}

View File

@ -61,9 +61,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
* *
* @param string $key Key. * @param string $key Key.
* *
* @throws \InvalidArgumentException If key is not found.
*
* @return mixed Contents of array key. * @return mixed Contents of array key.
*
* @throws \InvalidArgumentException If key is not found.
*/ */
public function getArgument($key) public function getArgument($key)
{ {
@ -130,9 +130,9 @@ class GenericEvent extends Event implements \ArrayAccess, \IteratorAggregate
* *
* @param string $key Array key. * @param string $key Array key.
* *
* @throws \InvalidArgumentException If key does not exist in $this->args.
*
* @return mixed * @return mixed
*
* @throws \InvalidArgumentException If key does not exist in $this->args.
*/ */
public function offsetGet($key) public function offsetGet($key)
{ {

View File

@ -126,7 +126,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
try { try {
// read timestamp into DateTime object - the formatter delivers in UTC // 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) { } catch (\Exception $e) {
throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
} }

View File

@ -1018,9 +1018,9 @@ class Form implements \IteratorAggregate, FormInterface
* *
* @param mixed $value The value to transform * @param mixed $value The value to transform
* *
* @throws TransformationFailedException If the value cannot be transformed to "normalized" format
*
* @return mixed * @return mixed
*
* @throws TransformationFailedException If the value cannot be transformed to "normalized" format
*/ */
private function modelToNorm($value) private function modelToNorm($value)
{ {
@ -1044,9 +1044,9 @@ class Form implements \IteratorAggregate, FormInterface
* *
* @param string $value The value to reverse transform * @param string $value The value to reverse transform
* *
* @throws TransformationFailedException If the value cannot be transformed to "model" format
*
* @return mixed * @return mixed
*
* @throws TransformationFailedException If the value cannot be transformed to "model" format
*/ */
private function normToModel($value) private function normToModel($value)
{ {
@ -1072,9 +1072,9 @@ class Form implements \IteratorAggregate, FormInterface
* *
* @param mixed $value The value to transform * @param mixed $value The value to transform
* *
* @throws TransformationFailedException If the value cannot be transformed to "view" format
*
* @return mixed * @return mixed
*
* @throws TransformationFailedException If the value cannot be transformed to "view" format
*/ */
private function normToView($value) private function normToView($value)
{ {
@ -1107,9 +1107,9 @@ class Form implements \IteratorAggregate, FormInterface
* *
* @param string $value The value to reverse transform * @param string $value The value to reverse transform
* *
* @throws TransformationFailedException If the value cannot be transformed to "normalized" format
*
* @return mixed * @return mixed
*
* @throws TransformationFailedException If the value cannot be transformed to "normalized" format
*/ */
private function viewToNorm($value) private function viewToNorm($value)
{ {

View File

@ -181,9 +181,9 @@ class ResponseHeaderBag extends HeaderBag
* *
* @param string $format * @param string $format
* *
* @throws \InvalidArgumentException When the $format is invalid
*
* @return array * @return array
*
* @throws \InvalidArgumentException When the $format is invalid
*/ */
public function getCookies($format = self::COOKIES_FLAT) public function getCookies($format = self::COOKIES_FLAT)
{ {

View File

@ -24,9 +24,9 @@ interface SessionStorageInterface
/** /**
* Starts the session. * Starts the session.
* *
* @throws \RuntimeException If something goes wrong starting the session.
*
* @return bool True if started. * @return bool True if started.
*
* @throws \RuntimeException If something goes wrong starting the session.
*/ */
public function start(); public function start();

View File

@ -154,6 +154,8 @@ class HttpCache implements HttpKernelInterface, TerminableInterface
* Gets the Surrogate instance. * Gets the Surrogate instance.
* *
* @return SurrogateInterface A Surrogate instance * @return SurrogateInterface A Surrogate instance
*
* @throws \LogicException
*/ */
public function getSurrogate() public function getSurrogate()
{ {

View File

@ -486,10 +486,10 @@ class Process implements \IteratorAggregate
* In comparison with the getOutput method which always return the whole * In comparison with the getOutput method which always return the whole
* output, this one returns the new output since the last call. * 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 output has been disabled
* @throws LogicException In case the process is not started * @throws LogicException In case the process is not started
*
* @return string The process output since the last call
*/ */
public function getIncrementalOutput() public function getIncrementalOutput()
{ {
@ -601,10 +601,10 @@ class Process implements \IteratorAggregate
* whole error output, this one returns the new error output since the last * whole error output, this one returns the new error output since the last
* call. * 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 output has been disabled
* @throws LogicException In case the process is not started * @throws LogicException In case the process is not started
*
* @return string The process error output since the last call
*/ */
public function getIncrementalErrorOutput() public function getIncrementalErrorOutput()
{ {

View File

@ -59,7 +59,7 @@ class ChainDecoder implements DecoderInterface
* *
* @return DecoderInterface * @return DecoderInterface
* *
* @throws RuntimeException if no decoder is found * @throws RuntimeException If no decoder is found.
*/ */
private function getDecoder($format) private function getDecoder($format)
{ {

View File

@ -464,6 +464,8 @@ class XmlEncoder extends SerializerAwareEncoder implements EncoderInterface, Dec
* @param mixed $val * @param mixed $val
* *
* @return bool * @return bool
*
* @throws UnexpectedValueException
*/ */
private function selectNodeType(\DOMNode $node, $val) private function selectNodeType(\DOMNode $node, $val)
{ {

View File

@ -33,6 +33,8 @@ interface DenormalizableInterface
* @param string|null $format The format is optionally given to be able to denormalize differently * @param string|null $format The format is optionally given to be able to denormalize differently
* based on different input formats * based on different input formats
* @param array $context options for denormalizing * @param array $context options for denormalizing
*
* @return object
*/ */
public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array()); public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null, array $context = array());
} }

View File

@ -33,7 +33,7 @@ interface NormalizableInterface
* based on different output formats. * based on different output formats.
* @param array $context Options for normalizing this object * @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()); public function normalize(NormalizerInterface $normalizer, $format = null, array $context = array());
} }

View File

@ -25,7 +25,7 @@ interface NormalizerInterface
* @param string $format format the normalization result will be encoded as * @param string $format format the normalization result will be encoded as
* @param array $context Context options for the normalizer * @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()); public function normalize($object, $format = null, array $context = array());

View File

@ -87,8 +87,6 @@ class StopwatchEvent
/** /**
* Stops the last started event period. * Stops the last started event period.
* *
* @throws \LogicException When start wasn't called before stopping
*
* @return StopwatchEvent The event * @return StopwatchEvent The event
* *
* @throws \LogicException When stop() is called without a matching call to start() * @throws \LogicException When stop() is called without a matching call to start()

View File

@ -54,9 +54,9 @@ abstract class AbstractFileExtractor
/** /**
* @param string $file * @param string $file
* *
* @throws \InvalidArgumentException
*
* @return bool * @return bool
*
* @throws \InvalidArgumentException
*/ */
protected function isFile($file) protected function isFile($file)
{ {

View File

@ -165,6 +165,8 @@ class XliffFileLoader implements LoaderInterface
} }
/** /**
* Validates and parses the given file into a DOMDocument.
*
* @param string $file * @param string $file
* @param \DOMDocument $dom * @param \DOMDocument $dom
* @param string $schema source of the schema * @param string $schema source of the schema

View File

@ -23,9 +23,9 @@ interface TranslatorBagInterface
* *
* @param string|null $locale The locale 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 MessageCatalogueInterface * @return MessageCatalogueInterface
*
* @throws \InvalidArgumentException If the locale contains invalid characters
*/ */
public function getCatalogue($locale = null); public function getCatalogue($locale = null);
} }

View File

@ -26,9 +26,9 @@ interface TranslatorInterface
* @param string|null $domain The domain for the message or null to use the default * @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 * @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 * @return string The translated string
*
* @throws \InvalidArgumentException If the locale contains invalid characters
*/ */
public function trans($id, array $parameters = array(), $domain = null, $locale = null); 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 $domain The domain for the message or null to use the default
* @param string|null $locale The locale 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 * @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); public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null);

View File

@ -85,7 +85,7 @@ class Dumper
if ($inline <= 0 || !is_array($input) || empty($input)) { if ($inline <= 0 || !is_array($input) || empty($input)) {
$output .= $prefix.Inline::dump($input, $flags); $output .= $prefix.Inline::dump($input, $flags);
} else { } else {
$isAHash = array_keys($input) !== range(0, count($input) - 1); $isAHash = Inline::isHash($input);
foreach ($input as $key => $value) { foreach ($input as $key => $value) {
if ($inline > 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n")) { if ($inline > 1 && Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && is_string($value) && false !== strpos($value, "\n")) {

View File

@ -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. * Dumps a PHP array to a YAML string.
* *
@ -225,11 +247,7 @@ class Inline
private static function dumpArray($value, $flags) private static function dumpArray($value, $flags)
{ {
// array // array
$keys = array_keys($value); if ($value && !self::isHash($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)
) {
$output = array(); $output = array();
foreach ($value as $val) { foreach ($value as $val) {
$output[] = self::dump($val, $flags); $output[] = self::dump($val, $flags);
@ -238,7 +256,7 @@ class Inline
return sprintf('[%s]', implode(', ', $output)); return sprintf('[%s]', implode(', ', $output));
} }
// mapping // hash
$output = array(); $output = array();
foreach ($value as $key => $val) { foreach ($value as $key => $val) {
$output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags)); $output[] = sprintf('%s: %s', self::dump($key, $flags), self::dump($val, $flags));

View File

@ -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]); $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() public function getTestsForParse()
{ {
return array( 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, { 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, \'@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)))),
); );
} }