From 17f02e0dc4825c870311e4fe0c355559bddfbd96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haso=C5=88?= Date: Fri, 9 Dec 2016 11:59:21 +0100 Subject: [PATCH 01/61] [Config] Fix checking cache for non existing meta file --- .../Component/Config/ResourceCheckerConfigCache.php | 5 ----- .../Config/Tests/ResourceCheckerConfigCacheTest.php | 12 ++++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php index ba7d600c7737b..0e3a411b07552 100644 --- a/src/Symfony/Component/Config/ResourceCheckerConfigCache.php +++ b/src/Symfony/Component/Config/ResourceCheckerConfigCache.php @@ -72,11 +72,6 @@ public function isFresh() return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all } - $metadata = $this->getMetaFile(); - if (!is_file($metadata)) { - return true; - } - $metadata = $this->getMetaFile(); if (!is_file($metadata)) { return false; diff --git a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php index c76c0dd0ac2b9..f921ad492848d 100644 --- a/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php +++ b/src/Symfony/Component/Config/Tests/ResourceCheckerConfigCacheTest.php @@ -128,4 +128,16 @@ public function testCacheKeepsContent() $this->assertSame('FOOBAR', file_get_contents($cache->getPath())); } + + public function testCacheIsNotFreshIfNotExistsMetaFile() + { + $checker = $this->getMock('\Symfony\Component\Config\ResourceCheckerInterface'); + $cache = new ResourceCheckerConfigCache($this->cacheFile, array($checker)); + $cache->write('foo', array(new FileResource(__FILE__))); + + $metaFile = "{$this->cacheFile}.meta"; + unlink($metaFile); + + $this->assertFalse($cache->isFresh()); + } } From 9e0d531d36d607e711b97e2c7951fda867397dee Mon Sep 17 00:00:00 2001 From: HeahDude Date: Tue, 27 Dec 2016 15:46:49 +0100 Subject: [PATCH 02/61] [Form] Fixed DateType format option --- .../Form/Extension/Core/Type/DateType.php | 12 +++++--- .../Extension/Core/Type/DateTypeTest.php | 29 +++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 8af7a96f13cd6..2bc433f8414f2 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -51,11 +51,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'); } - if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) { - throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern)); - } - if ('single_text' === $options['widget']) { + if (null !== $pattern && false === strpos($pattern, 'y') && false === strpos($pattern, 'M') && false === strpos($pattern, 'd')) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" or "d". Its current value is "%s".', $pattern)); + } + $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer( $options['model_timezone'], $options['view_timezone'], @@ -65,6 +65,10 @@ public function buildForm(FormBuilderInterface $builder, array $options) $pattern )); } else { + if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern)); + } + $yearOptions = $monthOptions = $dayOptions = array( 'error_bubbling' => true, ); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index ea302d020eec3..b31fa5e9c5fe1 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -67,6 +67,22 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat() $this->assertEquals('2010-06-02', $form->getViewData()); } + public function testSubmitFromSingleTextDateTimeWithCustomFormat() + { + $form = $this->factory->create('date', null, array( + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', + 'widget' => 'single_text', + 'input' => 'datetime', + 'format' => 'yyyy', + )); + + $form->submit('2010'); + + $this->assertDateTimeEquals(new \DateTime('2010-01-01 UTC'), $form->getData()); + $this->assertEquals('2010', $form->getViewData()); + } + public function testSubmitFromSingleTextDateTime() { // we test against "de_AT", so we need the full implementation @@ -337,6 +353,7 @@ public function testThrowExceptionIfFormatIsNoPattern() /** * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @expectedExceptionMessage The "format" option should contain the letters "y", "M" and "d". Its current value is "yy". */ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() { @@ -346,6 +363,18 @@ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() )); } + /** + * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + * @expectedExceptionMessage The "format" option should contain the letters "y", "M" or "d". Its current value is "wrong". + */ + public function testThrowExceptionIfFormatDoesNotContainYearMonthOrDay() + { + $this->factory->create('date', null, array( + 'widget' => 'single_text', + 'format' => 'wrong', + )); + } + /** * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException */ From 7f15bc39ea9f5d923d16adcceaedd76d43559058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 12 Jan 2017 19:45:33 +0100 Subject: [PATCH 03/61] [FrameworkBundle] Skip test if xdebug.file_link_format is defined. The test suite does not pass locally because I use a custom file_link_format. I do it because it works everywhere. Then, Symfony tries to read this value before the default one. We could use ini_set before the test but unfortunatelly there are no way to define the "cfg_var". For recall, get_cfg_var allows to return the configuration value even if the extension is not loaded. And again it's my case: I don't enable xdebug to have better performance. --- .../Tests/DependencyInjection/FrameworkExtensionTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index b9116d39a3602..bc1eac93e6dac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -318,6 +318,10 @@ public function testAnnotations() public function testFileLinkFormat() { + if (ini_get('xdebug.file_link_format') || get_cfg_var('xdebug.file_link_format')) { + $this->markTestSkipped('A custom file_link_format is defined.'); + } + $container = $this->createContainerFromFile('full'); $this->assertEquals('file%link%format', $container->getParameter('templating.helper.code.file_link_format')); From dd3fbea1491467e5287bf1c0e219adc6319bf6e6 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:02:04 -0800 Subject: [PATCH 04/61] updated CHANGELOG for 2.7.23 --- CHANGELOG-2.7.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md index ff7d6301ddcc4..df5011ef69c67 100644 --- a/CHANGELOG-2.7.md +++ b/CHANGELOG-2.7.md @@ -7,6 +7,43 @@ in 2.7 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1 +* 2.7.23 (2017-01-12) + + * bug #21218 [Form] DateTimeToLocalizedStringTransformer does not use timezone when using date only (magnetik) + * bug #21104 [FrameworkBundle] fix IPv6 address handling in server commands (xabbuh) + * bug #20793 [Validator] Fix caching of constraints derived from non-serializable parents (uwej711) + * bug #19586 [TwigBundle] Fix bug where namespaced paths don't take parent bundles in account (wesleylancel) + * bug #21237 [FrameworkBundle] Fix relative paths used as cache keys (nicolas-grekas) + * bug #21183 [Validator] respect groups when merging constraints (xabbuh) + * bug #21179 [TwigBundle] Fixing regression in TwigEngine exception handling (Bertalan Attila) + * bug #21220 [DI] Fix missing new line after private alias (ogizanagi) + * bug #21211 Classloader tmpname (lyrixx) + * bug #21205 [TwigBundle] fixed usage when Templating is not installed (fabpot) + * bug #21155 [Validator] Check cascasdedGroups for being countable (scaytrase) + * bug #21200 [Filesystem] Check that directory is writable after created it in dumpFile() (chalasr) + * bug #21113 [FrameworkBundle][HttpKernel] Fix resources loading for bundles with custom structure (chalasr) + * bug #21084 [Yaml] handle empty lines inside unindented collection (xabbuh) + * bug #20925 [HttpFoundation] Validate/cast cookie expire time (ro0NL) + * bug #21032 [SecurityBundle] Made collection of user provider unique when injecting them to the RemberMeService (lyrixx) + * bug #21078 [Console] Escape default value when dumping help (lyrixx) + * bug #21076 [Console] OS X Can't call cli_set_process_title php without superuser (ogizanagi) + * bug #20900 [Console] Descriptors should use Helper::strlen (ogizanagi) + * bug #21064 [Debug] Wrap call to ->log in a try catch block (lyrixx) + * bug #21010 [Debug] UndefinedMethodFatalErrorHandler - Handle anonymous classes (SpacePossum) + * bug #20859 Avoid warning in PHP 7.2 because of non-countable data (wouterj) + * bug #21053 [Validator] override property constraints in child class (xabbuh) + * bug #20970 [Console] Fix question formatting using SymfonyStyle::ask() (chalasr, ogizanagi) + * bug #20975 [Form] fix group sequence based validation (xabbuh) + * bug #20599 [WebProfilerBundle] Display multiple HTTP headers in WDT (ro0NL) + * bug #20799 [TwigBundle] do not try to register incomplete definitions (xabbuh) + * bug #20961 [Validator] phpize default option values (xabbuh) + * bug #20934 [FrameworkBundle] Fix PHP form templates on translatable attributes (ro0NL) + * bug #20957 [FrameworkBundle] test for the Validator component to be present (xabbuh) + * bug #20936 [DependencyInjection] Fix on-invalid attribute type in xsd (ogizanagi) + * bug #20931 [VarDumper] Fix dumping by-ref variadics (nicolas-grekas) + * bug #20734 [Security] AbstractVoter->supportsAttribute gives false positive if attribute is zero (0) (martynas-foodpanda) + * bug #14082 [config] Fix issue when key removed and left value only (zerustech) + * 2.7.22 (2016-12-13) * bug #20714 [FrameworkBundle] Fix unresolved parameters from default configs in debug:config (chalasr) From fe67ce520968c763be3e34f8ac8919ead730fd23 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:02:11 -0800 Subject: [PATCH 05/61] update CONTRIBUTORS for 2.7.23 --- CONTRIBUTORS.md | 77 +++++++++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 24f9845d0b517..f740b56abf6f9 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -27,18 +27,18 @@ Symfony is the result of the work of many people who made the code better - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) - Martin Hasoň (hason) - - Jeremy Mikola (jmikola) - Grégoire Pineau (lyrixx) + - Jeremy Mikola (jmikola) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Eriksen Costa (eriksencosta) - - Jules Pietri (heah) - Maxime Steinhausser (ogizanagi) + - Jules Pietri (heah) + - Robin Chalas (chalas_r) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Diego Saint Esteben (dosten) - - Robin Chalas (chalas_r) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar @@ -49,11 +49,12 @@ Symfony is the result of the work of many people who made the code better - Saša Stamenković (umpirsky) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik - - Diego Saint Esteben (dii3g0) - Ener-Getick (energetick) + - Diego Saint Esteben (dii3g0) - Konstantin Kudryashov (everzet) - - Bilal Amarni (bamarni) - Iltar van der Berg (kjarli) + - Roland Franssen (ro0) + - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Peter Rehm (rpet) - Kevin Bond (kbond) @@ -69,19 +70,18 @@ Symfony is the result of the work of many people who made the code better - Henrik Westphal (snc) - Dariusz Górecki (canni) - Douglas Greenshields (shieldo) + - Titouan Galopin (tgalopin) - Konstantin Myakshin (koc) - Lee McDermott - Brandon Turner - Luis Cordova (cordoval) - Graham Campbell (graham) - - Titouan Galopin (tgalopin) - Daniel Holmes (dholmes) - Pierre du Plessis (pierredup) - Toni Uebernickel (havvg) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - John Wards (johnwards) - - Roland Franssen (ro0) - Fran Moreno (franmomu) - Jáchym Toušek (enumag) - Antoine Hérault (herzult) @@ -98,6 +98,7 @@ Symfony is the result of the work of many people who made the code better - lenar - Włodzimierz Gajda (gajdaw) - Baptiste Clavié (talus) + - Maxime STEINHAUSSER - Alexander Schwenn (xelaris) - Florian Voutzinos (florianv) - Colin Frei @@ -114,13 +115,13 @@ Symfony is the result of the work of many people who made the code better - Eric GELOEN (gelo) - David Buchmann (dbu) - Tugdual Saunier (tucksaun) - - Maxime STEINHAUSSER - Théo FIDRY (theofidry) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) - Stefano Sala (stefano.sala) - Evgeniy (ewgraf) - Juti Noppornpitak (shiroyuki) + - Tobias Nyholm (tobias) - Tigran Azatyan (tigranazatyan) - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) @@ -130,12 +131,11 @@ Symfony is the result of the work of many people who made the code better - Pablo Godel (pgodel) - Jérémie Augustin (jaugustin) - Andréia Bohner (andreia) + - Yonel Ceruto González (yonelceruto) - Rafael Dohms (rdohms) - Arnaud Kleinpeter (nanocom) - jwdeitch - - Tobias Nyholm (tobias) - Joel Wurtz (brouznouf) - - Yonel Ceruto González (yonelceruto) - Philipp Wahala (hifi) - Vyacheslav Pavlov - Javier Spagnoletti (phansys) @@ -179,6 +179,7 @@ Symfony is the result of the work of many people who made the code better - fivestar - Dominique Bongiraud - Jeremy Livingston (jeremylivingston) + - Michael Lee (zerustech) - Matthieu Auger (matthieuauger) - Leszek Prabucki (l3l0) - François Zaninotto (fzaninotto) @@ -187,6 +188,7 @@ Symfony is the result of the work of many people who made the code better - John Kary (johnkary) - Justin Hileman (bobthecow) - Blanchon Vincent (blanchonvincent) + - Chris Wilkinson (thewilkybarkid) - Michele Orselli (orso) - Tom Van Looy (tvlooy) - Sven Paulus (subsven) @@ -195,6 +197,7 @@ Symfony is the result of the work of many people who made the code better - Dawid Nowak - Eugene Wissner - Julien Brochet (mewt) + - Tristan Darricau (nicofuma) - Sergey Linnik (linniksa) - Michaël Perrin (michael.perrin) - Marcel Beerta (mazen) @@ -202,7 +205,6 @@ Symfony is the result of the work of many people who made the code better - Jannik Zschiesche (apfelbox) - Marco Pivetta (ocramius) - julien pauli (jpauli) - - Michael Lee (zerustech) - Lorenz Schori - Sébastien Lavoie (lavoiesl) - Francois Zaninotto @@ -216,20 +218,20 @@ Symfony is the result of the work of many people who made the code better - Roman Marintšenko (inori) - Christian Schmidt - Xavier Montaña Carreras (xmontana) - - Chris Wilkinson (thewilkybarkid) - Mickaël Andrieu (mickaelandrieu) - Xavier Perez - Arjen Brouwer (arjenjb) - Katsuhiro OGAWA + - Patrick McDougle (patrick-mcdougle) - James Halsall (jaitsu) - Alif Rachmawadi - Kristen Gilden (kgilden) + - SpacePossum - Pierre-Yves LEBECQ (pylebecq) - Alex Pott - Jakub Kucharovic (jkucharovic) - Eugene Leonovich (rybakit) - Filippo Tessarotto - - Tristan Darricau (nicofuma) - Joseph Rouff (rouffj) - Félix Labrecque (woodspire) - GordonsLondon @@ -259,7 +261,6 @@ Symfony is the result of the work of many people who made the code better - Peter Kruithof (pkruithof) - Michael Holm (hollo) - Marc Weistroff (futurecat) - - SpacePossum - Hidde Wieringa (hiddewie) - Chris Smith (cs278) - Florian Klein (docteurklein) @@ -278,12 +279,14 @@ Symfony is the result of the work of many people who made the code better - Ismael Ambrosi (iambrosi) - Uwe Jäger (uwej711) - Aurelijus Valeiša (aurelijus) + - Victor Bocharsky (bocharsky_bw) - Jan Decavele (jandc) - Gustavo Piltcher - Stepan Tanasiychuk (stfalcon) - Tiago Ribeiro (fixe) - Hidde Boomsma (hboomsma) - John Bafford (jbafford) + - Pavel Batanov (scaytrase) - Bob den Otter (bopp) - Adrian Rudnik (kreischweide) - Francesc Rosàs (frosas) @@ -304,6 +307,7 @@ Symfony is the result of the work of many people who made the code better - Matthew Lewinski (lewinski) - Magnus Nordlander (magnusnordlander) - alquerci + - Adam Prager (padam87) - Francesco Levorato - Vitaliy Zakharov (zakharovvi) - Tobias Sjösten (tobiassjosten) @@ -324,6 +328,7 @@ Symfony is the result of the work of many people who made the code better - Clément Gautier (clementgautier) - Eduardo Gulias (egulias) - giulio de donato (liuggio) + - ShinDarth - Stéphane PY (steph_py) - Philipp Kräutli (pkraeutli) - Kirill chEbba Chebunin (chebba) @@ -336,9 +341,9 @@ Symfony is the result of the work of many people who made the code better - Hassan Amouhzi - Tamas Szijarto - Pavel Volokitin (pvolok) + - François Pluchino (francoispluchino) - Nicolas Dewez (nicolas_dewez) - Endre Fejes - - Victor Bocharsky (bocharsky_bw) - Tobias Naumann (tna) - Daniel Beyer - Shein Alexey @@ -355,7 +360,6 @@ Symfony is the result of the work of many people who made the code better - Xavier HAUSHERR - Albert Jessurum (ajessu) - Laszlo Korte - - Pavel Batanov (scaytrase) - Miha Vrhovnik - Alessandro Desantis - hubert lecorche (hlecorche) @@ -412,6 +416,7 @@ Symfony is the result of the work of many people who made the code better - boombatower - Fabrice Bernhard (fabriceb) - Jérôme Macias (jeromemacias) + - Andrey Astakhov (aast) - Fabian Lange (codingfabian) - Frank Neff (fneff) - Roman Lapin (memphys) @@ -422,6 +427,7 @@ Symfony is the result of the work of many people who made the code better - Pablo Díez (pablodip) - Kevin McBride - Sergio Santoro + - Robin van der Vleuten (robinvdvleuten) - Philipp Rieber (bicpi) - Manuel de Ruiter (manuel) - Eduardo Oliveira (entering) @@ -478,7 +484,6 @@ Symfony is the result of the work of many people who made the code better - Alexander Deruwe (aderuwe) - Alain Hippolyte (aloneh) - Dave Hulbert (dave1010) - - François Pluchino (francoispluchino) - Ivan Rey (ivanrey) - Marcin Chyłek (songoq) - Ned Schwartz @@ -512,6 +517,7 @@ Symfony is the result of the work of many people who made the code better - Konstantin S. M. Möllers (ksmmoellers) - Sinan Eldem - Alexandre Dupuy (satchette) + - Rob Frawley 2nd - Nahuel Cuesta (ncuesta) - Chris Boden (cboden) - Asmir Mustafic (goetas) @@ -522,6 +528,7 @@ Symfony is the result of the work of many people who made the code better - Åsmund Garfors - Maxime Douailin - Jean Pasdeloup (pasdeloup) + - Benjamin Cremer (bcremer) - Javier López (loalf) - Andreas Braun - Reinier Kip @@ -551,7 +558,6 @@ Symfony is the result of the work of many people who made the code better - umpirski - Chris Heng (gigablah) - Ulumuddin Yunus (joenoez) - - Adam Prager (padam87) - Luc Vieillescazes (iamluc) - Johann Saunier (prophet777) - Samuel ROZE (sroze) @@ -586,6 +592,7 @@ Symfony is the result of the work of many people who made the code better - develop - ReenExe - Mark Sonnabaum + - Thomas Royer (cydonia7) - Richard Quadling - jochenvdv - Arturas Smorgun (asarturas) @@ -593,6 +600,7 @@ Symfony is the result of the work of many people who made the code better - Michael Piecko - yclian - twifty + - Indra Gunawan (guind) - Peter Ward - Julien DIDIER (juliendidier) - Dominik Ritter (dritter) @@ -600,10 +608,10 @@ Symfony is the result of the work of many people who made the code better - Martin Hujer (martinhujer) - Pascal Helfenstein - Baldur Rensch (brensch) + - Thomas Calvet - Vladyslav Petrovych - Alex Xandra Albert Sim - Carson Full - - Andrey Astakhov (aast) - Trent Steel (trsteel88) - Yuen-Chi Lian - Besnik Br @@ -630,11 +638,13 @@ Symfony is the result of the work of many people who made the code better - Christian Soronellas (theunic) - Romain Gautier (mykiwi) - Yosmany Garcia (yosmanyga) + - Wouter J - Wouter de Wild - Miroslav Sustek - Degory Valentine - Benoit Lévêque (benoit_leveque) - Jeroen Fiege (fieg) + - Arthur de Moulins (4rthem) - Krzysiek Łabuś - Xavier Lacot (xavier) - possum @@ -642,6 +652,7 @@ Symfony is the result of the work of many people who made the code better - Olivier Maisonneuve (olineuve) - Masterklavi - Francis Turmel (fturmel) + - Nikita Nefedov (nikita2206) - cgonzalez - Ben - Jayson Xu (superjavason) @@ -683,8 +694,10 @@ Symfony is the result of the work of many people who made the code better - Ivan Menshykov - David Romaní - Patrick Allaert + - Fabien Bourigault (fbourigault) - Gustavo Falco (gfalco) - Matt Robinson (inanimatt) + - Ruud Kamphuis (ruudk) - Aleksey Podskrebyshev - Calin Mihai Pristavu - David Marín Carreño (davefx) @@ -734,7 +747,6 @@ Symfony is the result of the work of many people who made the code better - Mikhail Yurasov (mym) - LOUARDI Abdeltif (ouardisoft) - Robert Gruendler (pulse00) - - Robin van der Vleuten (robinvdvleuten) - Simon Terrien (sterrien) - Benoît Merlet (trompette) - Koen Kuipers @@ -763,6 +775,7 @@ Symfony is the result of the work of many people who made the code better - Colin O'Dell (colinodell) - xaav - Mahmoud Mostafa (mahmoud) + - Alessandro Lai - Pieter - Michael Tibben - Sander Marechal @@ -811,8 +824,10 @@ Symfony is the result of the work of many people who made the code better - Nicolas Macherey - Lin Clark - Jeremy David (jeremy.david) + - Denis Brumann (dbrumann) - Troy McCabe - Ville Mattila + - ilyes kooli - Boris Vujicic (boris.vujicic) - Max Beutel - Antanas Arvasevicius @@ -832,6 +847,7 @@ Symfony is the result of the work of many people who made the code better - Christian - Sergii Smertin (nfx) - hugofonseca (fonsecas72) + - Martynas Narbutas - Bailey Parker - Eddie Jaoude - Haritz Iturbe (hizai) @@ -846,7 +862,6 @@ Symfony is the result of the work of many people who made the code better - Alex Demchenko (pilot) - Tadas Gliaubicas (tadcka) - Benoit Garret - - Thomas Royer (cydonia7) - DerManoMann - Olaf Klischat - orlovv @@ -867,7 +882,6 @@ Symfony is the result of the work of many people who made the code better - rpg600 - Péter Buri (burci) - Davide Borsatto (davide.borsatto) - - Indra Gunawan (guind) - kaiwa - Charles Sanquer (csanquer) - Albert Ganiev (helios-ag) @@ -909,6 +923,7 @@ Symfony is the result of the work of many people who made the code better - Krzysztof Przybyszewski - Paul Matthews - Juan Traverso + - Tarjei Huse (tarjei) - Philipp Strube - Christian Sciberras - Clement Herreman (clemherreman) @@ -919,7 +934,6 @@ Symfony is the result of the work of many people who made the code better - Alberto Aldegheri - heccjj - Alexandre Melard - - Thomas Calvet - Sergey Yuferev - Tobias Stöckler - Mario Young @@ -973,6 +987,7 @@ Symfony is the result of the work of many people who made the code better - Samuel Vogel (samuelvogel) - Berat Doğan - Juanmi Rodriguez Cerón + - Andy Raines - Anthony Ferrara - Klaas Cuvelier (kcuvelier) - Steve Frécinaux @@ -998,6 +1013,7 @@ Symfony is the result of the work of many people who made the code better - Alberto Pirovano (geezmo) - Pete Mitchell (peterjmit) - Tom Corrigan (tomcorrigan) + - Luis Galeas - Martin Pärtel - Noah Heck (myesain) - Patrick Daley (padrig) @@ -1014,7 +1030,6 @@ Symfony is the result of the work of many people who made the code better - Romain Geissler - Adrien Moiruad - Tomaz Ahlin - - Benjamin Cremer (bcremer) - Marcus Stöhr (dafish) - Emmanuel Vella (emmanuel.vella) - Carsten Nielsen (phreaknerd) @@ -1036,6 +1051,7 @@ Symfony is the result of the work of many people who made the code better - Damien Tournoud - Jon Gotlin (jongotlin) - Michael Dowling (mtdowling) + - Karlos Presumido (oneko) - BilgeXA - r1pp3rj4ck - Robert Queck @@ -1073,7 +1089,6 @@ Symfony is the result of the work of many people who made the code better - kor3k kor3k (kor3k) - Stelian Mocanita (stelian) - Flavian (2much) - - Arthur de Moulins (4rthem) - mike - Keith Maika - Mephistofeles @@ -1164,6 +1179,7 @@ Symfony is the result of the work of many people who made the code better - Julius Beckmann - Romain Dorgueil - Grayson Koonce (breerly) + - Fabien LUCAS (flucas2) - Karim Cassam Chenaï (ka) - Nicolas Bastien (nicolas_bastien) - Denis (yethee) @@ -1212,7 +1228,6 @@ Symfony is the result of the work of many people who made the code better - Bram Van der Sype (brammm) - Guile (guile) - Julien Moulin (lizjulien) - - Nikita Nefedov (nikita2206) - Mauro Foti (skler) - Yannick Warnier (ywarnier) - Kevin Decherf @@ -1235,7 +1250,9 @@ Symfony is the result of the work of many people who made the code better - Tischoi - J Bruni - Alexey Prilipko + - vlakoff - bertillon + - Bertalan Attila - Yannick Bensacq (cibou) - Luca Genuzio (genuzio) - Hans Nilsson (hansnilsson) @@ -1254,7 +1271,6 @@ Symfony is the result of the work of many people who made the code better - Joel Marcey - David Christmann - root - - Wouter J - James Hudson - Tom Maguire - David Zuelke @@ -1309,9 +1325,9 @@ Symfony is the result of the work of many people who made the code better - ddebree - Tomas Liubinas - Alex + - Patrick Dawkins - Klaas Naaijkens - Daniel González Cerviño - - ShinDarth - Rafał - Adria Lopez (adlpz) - Rosio (ben-rosio) @@ -1338,9 +1354,9 @@ Symfony is the result of the work of many people who made the code better - Michael Pohlers (mick_the_big) - Cayetano Soriano Gallego (neoshadybeat) - Ondrej Machulda (ondram) - - Patrick McDougle (patrick-mcdougle) - Pablo Monterde Perez (plebs) - Jimmy Leger (redpanda) + - Marcin Szepczynski (szepczynski) - Cyrille Jouineau (tuxosaurus) - Yorkie Chadwick (yorkie76) - Yanick Witschi @@ -1363,6 +1379,7 @@ Symfony is the result of the work of many people who made the code better - Arnaud Buathier (arnapou) - chesteroni (chesteroni) - Mauricio Lopez (diaspar) + - HADJEDJ Vincent (hadjedjvincent) - Daniele Cesarini (ijanki) - Ismail Asci (ismailasci) - Simon CONSTANS (kosssi) @@ -1505,7 +1522,6 @@ Symfony is the result of the work of many people who made the code better - Damián Nohales (eagleoneraptor) - Elliot Anderson (elliot) - Fabien D. (fabd) - - Fabien Bourigault (fbourigault) - Carsten Eilers (fnc) - Sorin Gitlan (forapathy) - Yohan Giarelli (frequence-web) @@ -1549,7 +1565,6 @@ Symfony is the result of the work of many people who made the code better - Daniel Perez Pinazo (pitiflautico) - Brayden Williams (redstar504) - Rich Sage (richsage) - - Ruud Kamphuis (ruudk) - Bart Ruysseveldt (ruyss) - Sascha Dens (saschadens) - scourgen hung (scourgen) From 69a553a2a3769db6d0095bf1230be0facb812da2 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:02:12 -0800 Subject: [PATCH 06/61] updated VERSION for 2.7.23 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index d4e79f35b6510..0e65c94231a8b 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.23-DEV'; + const VERSION = '2.7.23'; const VERSION_ID = 20723; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; const RELEASE_VERSION = 23; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From 6babdb3296a5fbbd9c69d1e3410adbdf749959ef Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:24:37 -0800 Subject: [PATCH 07/61] bumped Symfony version to 2.7.24 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 0e65c94231a8b..cdb573837452a 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.7.23'; - const VERSION_ID = 20723; + const VERSION = '2.7.24-DEV'; + const VERSION_ID = 20724; const MAJOR_VERSION = 2; const MINOR_VERSION = 7; - const RELEASE_VERSION = 23; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 24; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '05/2018'; const END_OF_LIFE = '05/2019'; From e18281eef637125786c199a4661c2f48d0c032fa Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 12 Jan 2017 12:42:17 -0800 Subject: [PATCH 08/61] bumped Symfony version to 2.8.17 --- src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index acc77dc8c789b..27439d33399e1 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.16'; - const VERSION_ID = 20816; + const VERSION = '2.8.17-DEV'; + const VERSION_ID = 20817; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 16; - const EXTRA_VERSION = ''; + const RELEASE_VERSION = 17; + const EXTRA_VERSION = 'DEV'; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019'; From 9e36436703b9b378e22b4e48eaf9b2e783a13f0b Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Thu, 12 Jan 2017 23:09:43 +0100 Subject: [PATCH 09/61] DX: remove invalid inheritdoc --- .../Component/Intl/Data/Generator/AbstractDataGenerator.php | 3 --- .../Component/Intl/Data/Generator/LocaleDataGenerator.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php index 84b7f74373992..6b7cf5a0caf1d 100644 --- a/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/AbstractDataGenerator.php @@ -42,9 +42,6 @@ public function __construct(GenrbCompiler $compiler, $dirName) $this->dirName = $dirName; } - /** - * {@inheritdoc} - */ public function generateData(GeneratorConfig $config) { $filesystem = new Filesystem(); diff --git a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php index 5f4f95102fd85..e89e5e8757b67 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php @@ -57,9 +57,6 @@ public function __construct($dirName, LanguageDataProvider $languageDataProvider $this->regionDataProvider = $regionDataProvider; } - /** - * {@inheritdoc} - */ public function generateData(GeneratorConfig $config) { $filesystem = new Filesystem(); From 47feb18d31efdf54ec95954ec6fd5fb5d2cea24b Mon Sep 17 00:00:00 2001 From: Dariusz Ruminski Date: Thu, 12 Jan 2017 23:27:26 +0100 Subject: [PATCH 10/61] CS: apply is_null --- src/Symfony/Bridge/Twig/Command/DebugCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index 39b910d6b4f61..349a8b81b83c1 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -141,7 +141,7 @@ private function getMetadata($type, $entity) } if ($type === 'functions' || $type === 'filters') { $cb = $entity->getCallable(); - if (is_null($cb)) { + if (null === $cb) { return; } if (is_array($cb)) { From 51bca66dfbe7a2903bb1505037370bc9098efcb2 Mon Sep 17 00:00:00 2001 From: Richard Bradley Date: Fri, 13 Jan 2017 16:26:16 +0000 Subject: [PATCH 11/61] #20411 fix Yaml parsing for very long quoted strings --- src/Symfony/Component/Yaml/Inline.php | 2 +- src/Symfony/Component/Yaml/Tests/InlineTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 624088fbba767..aa1833745a95b 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -21,7 +21,7 @@ */ class Inline { - const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\']*(?:\'\'[^\']*)*)\')'; + const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*+(?:\\\\.[^"\\\\]*+)*+)"|\'([^\']*+(?:\'\'[^\']*+)*+)\')'; private static $exceptionOnInvalidType = false; private static $objectSupport = false; diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 755dfce592df8..56966bacd333c 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -410,4 +410,14 @@ public function testNotSupportedMissingValue() { Inline::parse('{this, is not, supported}'); } + + public function testVeryLongQuotedStrings() + { + $longStringWithQuotes = str_repeat("x\r\n\\\"x\"x", 1000); + + $yamlString = Inline::dump(array('longStringWithQuotes' => $longStringWithQuotes)); + $arrayFromYaml = Inline::parse($yamlString); + + $this->assertEquals($longStringWithQuotes, $arrayFromYaml['longStringWithQuotes']); + } } From cb1a4b778f522c7ae85bcc977cbaceaafc62d3f1 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 14 Jan 2017 10:53:53 +0100 Subject: [PATCH 12/61] [TwigBundle] do not lose already set method calls --- .../Compiler/ExtensionPass.php | 2 +- .../Compiler/ExtensionPassTest.php | 41 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index 36cea3d0fed1a..ab9479e46166a 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -91,7 +91,7 @@ public function process(ContainerBuilder $container) $twigLoader = $container->getDefinition('twig.loader.native_filesystem'); if ($container->has('templating')) { $loader = $container->getDefinition('twig.loader.filesystem'); - $loader->setMethodCalls($twigLoader->getMethodCalls()); + $loader->setMethodCalls(array_merge($twigLoader->getMethodCalls(), $loader->getMethodCalls())); $twigLoader->clearTag('twig.loader'); } else { diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php new file mode 100644 index 0000000000000..587801d8db622 --- /dev/null +++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Compiler/ExtensionPassTest.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\TwigBundle\Tests\DependencyInjection\Compiler; + +use Symfony\Bundle\TwigBundle\DependencyInjection\Compiler\ExtensionPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; + +class ExtensionPassTest extends \PHPUnit_Framework_TestCase +{ + public function testProcessDoesNotDropExistingFileLoaderMethodCalls() + { + $container = new ContainerBuilder(); + $container->setParameter('kernel.debug', false); + + $container->register('twig.app_variable', '\Symfony\Bridge\Twig\AppVariable'); + $container->register('templating', '\Symfony\Bundle\TwigBundle\TwigEngine'); + + $nativeTwigLoader = new Definition('\Twig_Loader_Filesystem'); + $nativeTwigLoader->addMethodCall('addPath', array()); + $container->setDefinition('twig.loader.native_filesystem', $nativeTwigLoader); + + $filesystemLoader = new Definition('\Symfony\Bundle\TwigBundle\Loader\FilesystemLoader'); + $filesystemLoader->addMethodCall('addPath', array()); + $container->setDefinition('twig.loader.filesystem', $filesystemLoader); + + $extensionPass = new ExtensionPass(); + $extensionPass->process($container); + + $this->assertCount(2, $filesystemLoader->getMethodCalls()); + } +} From 677d8208747282e484be8dfc299ca962565addc2 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 30 Dec 2016 12:55:25 +0000 Subject: [PATCH 13/61] Fix the condition checking the minimum ICU version --- src/Symfony/Component/Intl/Util/IntlTestHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Intl/Util/IntlTestHelper.php b/src/Symfony/Component/Intl/Util/IntlTestHelper.php index 71fb4acdd72fa..c1e37a72ec8a4 100644 --- a/src/Symfony/Component/Intl/Util/IntlTestHelper.php +++ b/src/Symfony/Component/Intl/Util/IntlTestHelper.php @@ -41,7 +41,7 @@ public static function requireIntl(\PHPUnit_Framework_TestCase $testCase, $minim // * the intl extension is loaded with version Intl::getIcuStubVersion() // * the intl extension is not loaded - if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '!=', 1)) { + if (($minimumIcuVersion || defined('HHVM_VERSION_ID')) && IcuVersion::compare(Intl::getIcuVersion(), $minimumIcuVersion, '<', 1)) { $testCase->markTestSkipped('ICU version '.$minimumIcuVersion.' is required.'); } From d3b5d8efdf4b936006d52bc6f6d266af1691708e Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Fri, 30 Dec 2016 13:41:01 +0000 Subject: [PATCH 14/61] Fix tests with ICU 57.1 --- ...ntegerToLocalizedStringTransformerTest.php | 4 ++-- ...NumberToLocalizedStringTransformerTest.php | 8 +++---- .../Extension/Core/Type/DateTypeTest.php | 24 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php index b38296813c574..af6443ac84054 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php @@ -108,10 +108,10 @@ public function testReverseTransformEmpty() public function testReverseTransformWithGrouping() { - // Since we test against "de_AT", we need the full implementation + // Since we test against "de_DE", we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $transformer = new IntegerToLocalizedStringTransformer(null, true); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php index 90d9719a90b72..c619ca729fdf2 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php @@ -54,8 +54,8 @@ public function testTransform($from, $to, $locale) public function provideTransformationsWithGrouping() { return array( - array(1234.5, '1.234,5', 'de_AT'), - array(12345.912, '12.345,912', 'de_AT'), + array(1234.5, '1.234,5', 'de_DE'), + array(12345.912, '12.345,912', 'de_DE'), array(1234.5, '1 234,5', 'fr'), array(1234.5, '1 234,5', 'ru'), array(1234.5, '1 234,5', 'fi'), @@ -410,10 +410,10 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot() */ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep() { - // Since we test against "de_AT", we need the full implementation + // Since we test against "de_DE", we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $transformer = new NumberToLocalizedStringTransformer(null, true); diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index ea302d020eec3..2b1c9bc198583 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -69,10 +69,10 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat() public function testSubmitFromSingleTextDateTime() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -90,10 +90,10 @@ public function testSubmitFromSingleTextDateTime() public function testSubmitFromSingleTextString() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -111,10 +111,10 @@ public function testSubmitFromSingleTextString() public function testSubmitFromSingleTextTimestamp() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -134,10 +134,10 @@ public function testSubmitFromSingleTextTimestamp() public function testSubmitFromSingleTextRaw() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -398,10 +398,10 @@ public function testThrowExceptionIfDaysIsInvalid() public function testSetDataWithNegativeTimezoneOffsetStringInput() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, @@ -420,10 +420,10 @@ public function testSetDataWithNegativeTimezoneOffsetStringInput() public function testSetDataWithNegativeTimezoneOffsetDateTimeInput() { - // we test against "de_AT", so we need the full implementation + // we test against "de_DE", so we need the full implementation IntlTestHelper::requireFullIntl($this, false); - \Locale::setDefault('de_AT'); + \Locale::setDefault('de_DE'); $form = $this->factory->create('date', null, array( 'format' => \IntlDateFormatter::MEDIUM, From ce29ab1d9269c3f28bff069f06b04ba7b49d1b3c Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Tue, 17 Jan 2017 19:38:11 +0100 Subject: [PATCH 15/61] [FrameworkBundle] Fix third level headers for MarkdownDescriptor --- .../Console/Descriptor/MarkdownDescriptor.php | 4 ++-- .../Tests/Fixtures/Descriptor/builder_1_public.md | 9 +++------ .../Tests/Fixtures/Descriptor/builder_1_services.md | 12 ++++-------- .../Tests/Fixtures/Descriptor/builder_1_tag1.md | 3 +-- .../Tests/Fixtures/Descriptor/builder_1_tags.md | 6 ++---- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 8f1227e7e997a..2cefe9f03a2ac 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -233,7 +233,7 @@ protected function describeContainerDefinition(Definition $definition, array $op } } - $this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output); + $this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output); } /** @@ -244,7 +244,7 @@ protected function describeContainerAlias(Alias $alias, array $options = array() $output = '- Service: `'.$alias.'`' ."\n".'- Public: '.($alias->isPublic() ? 'yes' : 'no'); - $this->write(isset($options['id']) ? sprintf("%s\n%s\n\n%s\n", $options['id'], str_repeat('~', strlen($options['id'])), $output) : $output); + $this->write(isset($options['id']) ? sprintf("### %s\n\n%s\n", $options['id'], $output) : $output); } /** diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md index 1c3b958bd92ca..96fe55184014a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.md @@ -4,8 +4,7 @@ Public services Definitions ----------- -definition_1 -~~~~~~~~~~~~ +### definition_1 - Class: `Full\Qualified\Class1` - Scope: `container` @@ -21,14 +20,12 @@ definition_1 Aliases ------- -alias_1 -~~~~~~~ +### alias_1 - Service: `service_1` - Public: yes -alias_2 -~~~~~~~ +### alias_2 - Service: `service_2` - Public: no diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md index b3018b80b7f3b..12938a6e0e123 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.md @@ -4,8 +4,7 @@ Public and private services Definitions ----------- -definition_1 -~~~~~~~~~~~~ +### definition_1 - Class: `Full\Qualified\Class1` - Scope: `container` @@ -17,8 +16,7 @@ definition_1 - Factory Class: `Full\Qualified\FactoryClass` - Factory Method: `get` -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` @@ -41,14 +39,12 @@ definition_2 Aliases ------- -alias_1 -~~~~~~~ +### alias_1 - Service: `service_1` - Public: yes -alias_2 -~~~~~~~ +### alias_2 - Service: `service_2` - Public: no diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md index 56a2c390779aa..0b90618a476a2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.md @@ -4,8 +4,7 @@ Public and private services with tag `tag1` Definitions ----------- -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md index 6577037f9c00f..1a3ed9ca85302 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.md @@ -4,8 +4,7 @@ Container tags tag1 ---- -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` @@ -22,8 +21,7 @@ definition_2 tag2 ---- -definition_2 -~~~~~~~~~~~~ +### definition_2 - Class: `Full\Qualified\Class2` - Scope: `container` From 190c736d3c5eb5a039cb5fb35729ef07fc26fa5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 18 Jan 2017 13:05:57 +0100 Subject: [PATCH 16/61] [PropertyInfo] Exclude static methods form properties guessing --- .../Component/PropertyInfo/Extractor/ReflectionExtractor.php | 4 ++++ src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 7fefbde2536a1..86be3b3e1503b 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -68,6 +68,10 @@ public function getProperties($class, array $context = array()) } foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) { + if ($reflectionMethod->isStatic()) { + continue; + } + $propertyName = $this->getPropertyName($reflectionMethod->name); if (!$propertyName || isset($properties[$propertyName])) { continue; diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 41a513ac362e1..660cc3002a238 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -51,6 +51,10 @@ class Dummy extends ParentDummy */ public $B; + public static function getStatic() + { + } + /** * A. * From 3b4858fe88814d820327bba46a00859a983d089e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 18 Jan 2017 13:18:58 +0100 Subject: [PATCH 17/61] [PropertyInfo] Don't try to access a property thru a static method --- .../PropertyInfo/Extractor/PhpDocExtractor.php | 3 +++ .../PropertyInfo/Extractor/ReflectionExtractor.php | 6 ++++++ .../Tests/Extractors/PhpDocExtractorTest.php | 2 ++ .../Tests/Extractors/ReflectionExtractorTest.php | 2 ++ .../Component/PropertyInfo/Tests/Fixtures/Dummy.php | 11 +++++++++++ 5 files changed, 24 insertions(+) diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index e60a623985d05..73e8ad3748977 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -253,6 +253,9 @@ private function getDocBlockFromMethod($class, $ucFirstProperty, $type) try { $reflectionMethod = new \ReflectionMethod($class, $methodName); + if ($reflectionMethod->isStatic()) { + continue; + } if ( (self::ACCESSOR === $type && 0 === $reflectionMethod->getNumberOfRequiredParameters()) || diff --git a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php index 7fefbde2536a1..c228134b913b9 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php @@ -258,6 +258,9 @@ private function getAccessorMethod($class, $property) foreach (self::$accessorPrefixes as $prefix) { try { $reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty); + if ($reflectionMethod->isStatic()) { + continue; + } if (0 === $reflectionMethod->getNumberOfRequiredParameters()) { return array($reflectionMethod, $prefix); @@ -286,6 +289,9 @@ private function getMutatorMethod($class, $property) foreach (self::$mutatorPrefixes as $prefix) { try { $reflectionMethod = new \ReflectionMethod($class, $prefix.$ucProperty); + if ($reflectionMethod->isStatic()) { + continue; + } // Parameter can be optional to allow things like: method(array $foo = null) if ($reflectionMethod->getNumberOfParameters() >= 1) { diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php index 332d1c4f8c318..b223888ede1dc 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/PhpDocExtractorTest.php @@ -68,6 +68,8 @@ public function typesProvider() array('e', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_RESOURCE))), null, null), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime'))), null, null), array('donotexist', null, null, null), + array('staticGetter', null, null, null), + array('staticSetter', null, null, null), ); } } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php index 8a828c21d66be..713d9431b42a4 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Extractors/ReflectionExtractorTest.php @@ -72,6 +72,8 @@ public function typesProvider() array('e', null), array('f', array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_OBJECT, false, 'DateTime')))), array('donotexist', null), + array('staticGetter', null), + array('staticSetter', null), ); } diff --git a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php index 41a513ac362e1..f8e986fe044f3 100644 --- a/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php +++ b/src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php @@ -51,6 +51,17 @@ class Dummy extends ParentDummy */ public $B; + /** + * @return string + */ + public static function staticGetter() + { + } + + public static function staticSetter(\DateTime $d) + { + } + /** * A. * From 9edb457e44f234c4fee26ddd97ee5d7c7bb94bfc Mon Sep 17 00:00:00 2001 From: Arjan Keeman Date: Sun, 11 Dec 2016 19:52:52 +0100 Subject: [PATCH 18/61] [HttpKernel] Give higher priority to adding request formats --- .../HttpKernel/EventListener/AddRequestFormatsListener.php | 2 +- .../Tests/EventListener/AddRequestFormatsListenerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php index 14a5d435115d7..280844c18313e 100644 --- a/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php +++ b/src/Symfony/Component/HttpKernel/EventListener/AddRequestFormatsListener.php @@ -52,6 +52,6 @@ public function onKernelRequest(GetResponseEvent $event) */ public static function getSubscribedEvents() { - return array(KernelEvents::REQUEST => 'onKernelRequest'); + return array(KernelEvents::REQUEST => array('onKernelRequest', 1)); } } diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php index 0f3577cbdb14b..c5b2c51e40ecb 100644 --- a/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -45,7 +45,7 @@ public function testIsAnEventSubscriber() public function testRegisteredEvent() { $this->assertEquals( - array(KernelEvents::REQUEST => 'onKernelRequest'), + array(KernelEvents::REQUEST => array('onKernelRequest', 1)), AddRequestFormatsListener::getSubscribedEvents() ); } From c82aa84c26f47fc1f18bd318e0728bdc682618be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 19 Jan 2017 14:34:44 +0100 Subject: [PATCH 19/61] [DependencyInjection] minor: Fix a DocBlock --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 52cc53946b16d..9d2072dfbeeab 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -130,9 +130,9 @@ private function parseDefinitions($content, $file) /** * Parses a definition. * - * @param string $id - * @param array $service - * @param string $file + * @param string $id + * @param array|string $service + * @param string $file * * @throws InvalidArgumentException When tags are invalid */ From 34330e51368f328e1ab91521d9fbdfb5a73be26d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 19 Jan 2017 14:51:14 +0100 Subject: [PATCH 20/61] [DependencyInjection] Add some missing typehints in YamlFileLoader --- .../Component/DependencyInjection/Loader/YamlFileLoader.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 52cc53946b16d..61f921813b549 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -85,7 +85,7 @@ public function supports($resource, $type = null) * @param array $content * @param string $file */ - private function parseImports($content, $file) + private function parseImports(array $content, $file) { if (!isset($content['imports'])) { return; @@ -112,7 +112,7 @@ private function parseImports($content, $file) * @param array $content * @param string $file */ - private function parseDefinitions($content, $file) + private function parseDefinitions(array $content, $file) { if (!isset($content['services'])) { return; @@ -420,7 +420,7 @@ private function resolveServices($value) * * @param array $content */ - private function loadFromExtensions($content) + private function loadFromExtensions(array $content) { foreach ($content as $namespace => $values) { if (in_array($namespace, array('imports', 'parameters', 'services'))) { From d3fa8a1859b85490356b4c559b900a5256341331 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Thu, 19 Jan 2017 10:44:03 +0100 Subject: [PATCH 21/61] Avoid setting request attributes from signature arguments in AnnotationClassLoader --- .../Component/Routing/Loader/AnnotationClassLoader.php | 5 ----- .../Routing/Tests/Loader/AnnotationClassLoaderTest.php | 7 +++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index f175d341e7564..339529e5190e7 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -138,11 +138,6 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl } $defaults = array_replace($globals['defaults'], $annot->getDefaults()); - foreach ($method->getParameters() as $param) { - if (!isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) { - $defaults[$param->getName()] = $param->getDefaultValue(); - } - } $requirements = array_replace($globals['requirements'], $annot->getRequirements()); $options = array_replace($globals['options'], $annot->getOptions()); $schemes = array_merge($globals['schemes'], $annot->getSchemes()); diff --git a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php index 83bf7108fb28b..44229633b5cbc 100644 --- a/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/src/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -136,11 +136,10 @@ public function testLoad($className, $routeData = array(), $methodArgs = array() array_intersect_assoc($routeData['options'], $route->getOptions()), '->load preserves options annotation' ); - $defaults = array_replace($methodArgs, $routeData['defaults']); $this->assertCount( - count($defaults), - array_intersect_assoc($defaults, $route->getDefaults()), - '->load preserves defaults annotation and merges them with default arguments in method signature' + count($routeData['defaults']), + $route->getDefaults(), + '->load preserves defaults annotation' ); $this->assertEquals($routeData['schemes'], $route->getSchemes(), '->load preserves schemes annotation'); $this->assertEquals($routeData['methods'], $route->getMethods(), '->load preserves methods annotation'); From 5176f978bfe992f40f743273da5a4271c5aa42b8 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 20 Jan 2017 07:16:44 -0800 Subject: [PATCH 22/61] fixed CS --- .php_cs.dist | 2 +- .../Bridge/PhpUnit/DeprecationErrorHandler.php | 4 ++-- .../Tests/LazyProxy/Fixtures/php/lazy_service.php | 9 --------- .../Fixtures/php/lazy_service_with_hints.php | 13 ++----------- .../Twig/Tests/Extension/DumpExtensionTest.php | 2 +- .../DependencyInjection/MainConfiguration.php | 4 ++-- .../Tests/Fixtures/Namespaced/WithStrictTypes.php | 2 +- .../ClassNotFoundFatalErrorHandler.php | 2 +- src/Symfony/Component/DomCrawler/Crawler.php | 2 +- .../Component/Process/Tests/SignalListener.php | 2 +- .../Component/VarDumper/Dumper/AbstractDumper.php | 4 ++-- 11 files changed, 14 insertions(+), 32 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index bbb62c2d3cdce..e2e173ad0545e 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -12,7 +12,7 @@ return PhpCsFixer\Config::create() ->setRiskyAllowed(true) ->setFinder( PhpCsFixer\Finder::create() - ->in(__DIR__) + ->in(__DIR__.'/src') ->exclude(array( // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code 'src/Symfony/Component/DependencyInjection/Tests/Fixtures', diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 575eaa2e213b2..04abda4b9fa59 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -109,7 +109,7 @@ public static function register($mode = false) return "\x1B[{$color}m{$str}\x1B[0m"; }; } else { - $colorize = function ($str) {return $str;}; + $colorize = function ($str) { return $str; }; } register_shutdown_function(function () use ($getMode, &$deprecations, $deprecationHandler, $colorize) { $mode = $getMode(); @@ -117,7 +117,7 @@ public static function register($mode = false) restore_error_handler(); if ('weak' === $mode) { - $colorize = function ($str) {return $str;}; + $colorize = function ($str) { return $str; }; } if ($currErrorHandler !== $deprecationHandler) { echo "\n", $colorize('THE ERROR HANDLER HAS CHANGED!', true), "\n"; diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php index fd58c19d818db..8971f655f4e3a 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php @@ -125,9 +125,6 @@ public function __unset($name) unset($this->valueHolder5157dd96e88c0->$name); } - /** - * - */ public function __clone() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array()); @@ -135,9 +132,6 @@ public function __clone() $this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0; } - /** - * - */ public function __sleep() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array()); @@ -145,9 +139,6 @@ public function __sleep() return array('valueHolder5157dd96e88c0'); } - /** - * - */ public function __wakeup() { } diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php index f57c4c6360ba3..06432127750fd 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service_with_hints.php @@ -120,9 +120,6 @@ public function __unset($name) unset($this->valueHolder5157dd96e88c0->$name); } - /** - * - */ public function __clone() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__clone', array()); @@ -130,9 +127,6 @@ public function __clone() $this->valueHolder5157dd96e88c0 = clone $this->valueHolder5157dd96e88c0; } - /** - * - */ public function __sleep() { $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, '__sleep', array()); @@ -140,9 +134,6 @@ public function __sleep() return array('valueHolder5157dd96e88c0'); } - /** - * - */ public function __wakeup() { } @@ -166,7 +157,7 @@ public function getProxyInitializer() /** * {@inheritdoc} */ - public function initializeProxy() : bool + public function initializeProxy(): bool { return $this->initializer5157dd96e8924 && $this->initializer5157dd96e8924->__invoke($this->valueHolder5157dd96e88c0, $this, 'initializeProxy', array()); } @@ -174,7 +165,7 @@ public function initializeProxy() : bool /** * {@inheritdoc} */ - public function isProxyInitialized() : bool + public function isProxyInitialized(): bool { return null !== $this->valueHolder5157dd96e88c0; } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php index 0800ba8ea2608..604b0caaecc8b 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php @@ -32,7 +32,7 @@ public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped) $dumped = null; $exception = null; - $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) {$dumped = $var;}); + $prevDumper = VarDumper::setHandler(function ($var) use (&$dumped) { $dumped = $var; }); try { $this->assertEquals($expectedOutput, $twig->render('template')); diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index a3e5e233f9d71..df6380224cd20 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -390,11 +390,11 @@ private function addProvidersSection(ArrayNodeDefinition $rootNode) $providerNodeBuilder ->validate() - ->ifTrue(function ($v) {return count($v) > 1;}) + ->ifTrue(function ($v) { return count($v) > 1; }) ->thenInvalid('You cannot set multiple provider types for the same provider') ->end() ->validate() - ->ifTrue(function ($v) {return count($v) === 0;}) + ->ifTrue(function ($v) { return count($v) === 0; }) ->thenInvalid('You must set a provider definition for the provider.') ->end() ; diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php index 3c7870592b3cb..846611e38bbc4 100644 --- a/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/WithStrictTypes.php @@ -4,7 +4,7 @@ * foo */ -declare (strict_types = 1); +declare(strict_types=1); namespace Namespaced; diff --git a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index abfe90d79262a..612bfcaf7f966 100644 --- a/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/src/Symfony/Component/Debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -179,7 +179,7 @@ private function convertFileToClass($path, $file, $prefix) ); if ($prefix) { - $candidates = array_filter($candidates, function ($candidate) use ($prefix) {return 0 === strpos($candidate, $prefix);}); + $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); }); } // We cannot use the autoloader here as most of them use require; but if the class diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index ea2051614f192..ed9b0b02398f5 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -156,7 +156,7 @@ public function addHtmlContent($content, $charset = 'UTF-8') $dom = new \DOMDocument('1.0', $charset); $dom->validateOnParse = true; - set_error_handler(function () {throw new \Exception();}); + set_error_handler(function () { throw new \Exception(); }); try { // Convert charset to HTML-entities to work around bugs in DOMDocument::loadHTML() diff --git a/src/Symfony/Component/Process/Tests/SignalListener.php b/src/Symfony/Component/Process/Tests/SignalListener.php index 03536577c40f2..9e30ce3bbbbc6 100644 --- a/src/Symfony/Component/Process/Tests/SignalListener.php +++ b/src/Symfony/Component/Process/Tests/SignalListener.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -pcntl_signal(SIGUSR1, function () {echo 'SIGUSR1'; exit;}); +pcntl_signal(SIGUSR1, function () { echo 'SIGUSR1'; exit; }); echo 'Caught '; diff --git a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php index 22c60b6e51c72..bed08bf47e0ab 100644 --- a/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php @@ -90,7 +90,7 @@ public function setCharset($charset) } $this->charsetConverter = 'fallback'; $supported = true; - set_error_handler(function () use (&$supported) {$supported = false;}); + set_error_handler(function () use (&$supported) { $supported = false; }); if (function_exists('mb_encoding_aliases') && mb_encoding_aliases($charset)) { $this->charset = $charset; @@ -193,7 +193,7 @@ protected function utf8Encode($s) } if ('iconv' === $this->charsetConverter) { $valid = true; - set_error_handler(function () use (&$valid) {$valid = false;}); + set_error_handler(function () use (&$valid) { $valid = false; }); $c = iconv($this->charset, 'UTF-8', $s); restore_error_handler(); if ($valid) { From afbf22746a257418de2a65bf2e84db81b32b7ba7 Mon Sep 17 00:00:00 2001 From: Peter Breuls Date: Wed, 18 Jan 2017 19:17:11 +0100 Subject: [PATCH 23/61] [Validator] Improved error message for missing upload_tmp_dir --- .../Validator/Resources/translations/validators.en.xlf | 2 +- .../Validator/Resources/translations/validators.nl.xlf | 2 +- .../Validator/Resources/translations/validators.pl.xlf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf index e666c793c98b4..2883213ee33e0 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.en.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - No temporary folder was configured in php.ini. + No temporary folder was configured in php.ini, or the configured folder does not exist. Cannot write temporary file to disk. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf index 8cc972cc5f529..e138975667d5e 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.nl.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Er is geen tijdelijke map geconfigureerd in php.ini. + Er is geen tijdelijke map geconfigureerd in php.ini, of de gespecificeerde map bestaat niet. Cannot write temporary file to disk. diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index 87bb76b8b00d4..affbc38e813e9 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Nie skonfigurowano folderu tymczasowego w php.ini. + Nie skonfigurowano folderu tymczasowego w php.ini, lub skonfigurowany folder nie istnieje. Cannot write temporary file to disk. From 6830d9f4c904d74020d2619fae990670edb3c3de Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:33:48 -0800 Subject: [PATCH 24/61] fixed typo --- .../DeprecationErrorHandler/default.phpt | 6 +- .../Tests/DeprecationErrorHandler/weak.phpt | 2 +- .../Extension/TranslationExtensionTest.php | 12 ++-- .../Resources/views/Form/attributes.html.php | 2 +- .../views/Form/button_widget.html.php | 6 +- .../views/Form/choice_options.html.php | 2 +- .../views/Form/choice_widget_options.html.php | 2 +- .../views/Form/container_attributes.html.php | 2 +- .../views/Form/email_widget.html.php | 2 +- .../Resources/views/Form/form_label.html.php | 18 +++-- .../Resources/views/Form/form_start.html.php | 4 +- .../Resources/views/Form/hidden_row.html.php | 2 +- .../views/Form/hidden_widget.html.php | 2 +- .../views/Form/integer_widget.html.php | 2 +- .../views/Form/money_widget.html.php | 2 +- .../views/Form/number_widget.html.php | 2 +- .../views/Form/password_widget.html.php | 2 +- .../views/Form/repeated_row.html.php | 2 +- .../views/Form/reset_widget.html.php | 2 +- .../views/Form/search_widget.html.php | 2 +- .../views/Form/submit_widget.html.php | 2 +- .../Resources/views/Form/url_widget.html.php | 2 +- .../Custom/_name_c_entry_label.html.php | 4 +- .../Debug/Resources/ext/tests/001.phpt | 4 +- .../Debug/Resources/ext/tests/002.phpt | 4 +- .../Debug/Resources/ext/tests/002_1.phpt | 4 +- .../Debug/Resources/ext/tests/003.phpt | 4 +- .../Debug/Tests/DebugClassLoaderTest.php | 2 +- .../Compiler/CheckCircularReferencesPass.php | 1 - .../DependencyInjection/Container.php | 4 +- .../DependencyInjection/Definition.php | 2 +- .../Tests/Fixtures/containers/container14.php | 2 +- .../Tests/Fixtures/php/services1-1.php | 1 + .../Tests/Fixtures/php/services8.php | 2 +- .../Tests/Fixtures/php/services9.php | 2 +- .../Tests/Fixtures/php/services9_compiled.php | 4 +- .../DataCollector/DumpDataCollector.php | 2 +- .../Component/Process/Pipes/AbstractPipes.php | 2 +- .../Component/Process/Pipes/WindowsPipes.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 68 +++++++----------- .../Tests/Fixtures/dumper/url_matcher2.php | 72 +++++++------------ .../Tests/Fixtures/dumper/url_matcher3.php | 5 +- .../Tests/Fixtures/templates/foo.php | 2 +- .../Translation/Tests/fixtures/resources.php | 2 +- .../Component/VarDumper/Dumper/CliDumper.php | 4 +- src/Symfony/Component/Yaml/Escaper.php | 4 +- 46 files changed, 134 insertions(+), 149 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index fac5c53ae7486..49a14479475a0 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -31,14 +31,14 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } public function testNonLegacyBar() { @trigger_error('silenced bar deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt index 9e78d96e70efb..d697843280f4b 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt @@ -23,7 +23,7 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index e96bd4f9a3bef..e066d537352c4 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -87,17 +87,17 @@ public function getTransTests() // transchoice array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), + 'There is no apples', array('count' => 0), ), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5)), + 'There is 5 apples', array('count' => 5), ), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'), ), array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5)), + 'There is 5 apples (Symfony)', array('count' => 5), ), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0)), + 'There is no apples', array('count' => 0), ), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples'), + 'There is 5 apples', ), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php index eb421be817691..28474797a5538 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php @@ -1 +1 @@ -block($form, 'widget_attributes') ?> +block($form, 'widget_attributes'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php index 9dac32fc994c0..32d8eeb619141 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php @@ -1,4 +1,6 @@ - $name, '%id%' => $id)) - : $view['form']->humanize($name); } ?> + : $view['form']->humanize($name); +} ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php index 211ae73f1c3d1..2463438d5aad5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php @@ -1 +1 @@ -block($form, 'choice_widget_options') ?> +block($form, 'choice_widget_options'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php index f1c6ad3b56f21..fc9846375f851 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php @@ -1,6 +1,6 @@ +$translatorHelper = $view['translator']; // outside of the loop for performance reasons!?> $choice): ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php index 302bbfcd479d9..fb6c0f2b5ed8b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php @@ -1 +1 @@ -block($form, 'widget_container_attributes') ?> +block($form, 'widget_container_attributes'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php index 0b30c5bb7ae54..7dfd085d86a6a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php index 7a51b2ce7b4ff..1b10546d979f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php @@ -1,8 +1,16 @@ - - - + + $name, '%id%' => $id)) - : $view['form']->humanize($name); } ?> - + : $view['form']->humanize($name); +} ?> + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php index e7b23d394daec..c81836eeb7e30 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php @@ -1,6 +1,8 @@ -
$v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?> enctype="multipart/form-data"> + $v) { + printf(' %s="%s"', $view->escape($k), $view->escape($v)); +} ?> enctype="multipart/form-data"> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php index 3239d8f415b12..800a8facf87f3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php @@ -1 +1 @@ -widget($form) ?> +widget($form); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php index a43f7de475e7a..8763fa6d4b79a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php index 5fceb49a38953..9efb26a18ffa0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php index 644d284915371..ea12cd4a4881a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple'), $money_pattern) ?> +block($form, 'form_widget_simple'), $money_pattern); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php index bf4a4c478502b..6f2d12e19d22e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php index ec96cfb46b24c..decefacf91800 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php index d4af23d712320..04cc29bcca3e0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php @@ -1 +1 @@ -block($form, 'form_rows') ?> +block($form, 'form_rows'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php index e8fa18e488df8..0f66b4b6aecf9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?> +block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php index 48a33f4aa2dbc..73ff6908d78b8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php index 6bf71f5a1e1c9..027bdc9857369 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?> +block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php index 9e26318497b3c..80329fff87d85 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?> +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php index 05240035c023d..80a9c5f611a36 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php @@ -1,2 +1,4 @@ -humanize($name); } ?> +humanize($name); +} ?> diff --git a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt index 15e183a70615c..873e2569ec5a3 100644 --- a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt +++ b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt @@ -1,7 +1,9 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- getId(); if (empty($this->checkedNodes[$id])) { - // don't check circular dependencies for lazy services if (!$node->getValue() || !$node->getValue()->isLazy()) { $searchKey = array_search($id, $this->currentPath); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index f6c953f550993..2421b82a7ea3a 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -219,7 +219,7 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) */ public function has($id) { - for ($i = 2;;) { + for ($i = 2; ;) { if ('service_container' === $id || isset($this->aliases[$id]) || isset($this->services[$id]) @@ -258,7 +258,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE // available services. Service IDs are case insensitive, however since // this method can be called thousands of times during a request, avoid // calling strtolower() unless necessary. - for ($i = 2;;) { + for ($i = 2; ;) { if ('service_container' === $id) { return $this; } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 72fba5acc7ce6..4f2ee304adad2 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -158,7 +158,7 @@ public function setDecoratedService($id, $renamedId = null) } /** - * Gets the service that decorates this service. + * Gets the service that this service is decorating. * * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php index 56ea6c1ed23d4..191afb8cddc1f 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php @@ -4,7 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; -/** +/* * This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer * and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped. */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index f15771172ef19..0fede650233e5 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -1,4 +1,5 @@ array( 0 => true, 1 => false, - 2 => NULL, + 2 => null, 3 => 0, 4 => 1000.3, 5 => 'true', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index ce8930b8ddeba..c173b83906785 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -248,7 +248,7 @@ protected function getMethodCall1Service() if ($this->has('foobaz')) { $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); return $instance; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 559560fa6da60..8991bd006e4f3 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -253,8 +253,8 @@ protected function getMethodCall1Service() $this->services['method_call1'] = $instance = new \Bar\FooClass(); $instance->setBar($this->get('foo')); - $instance->setBar(NULL); - $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); + $instance->setBar(null); + $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); return $instance; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 538d73c783ba3..3f20c4343981f 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -298,7 +298,7 @@ private function htmlEncode($s) { $html = ''; - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); + $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line; }, $this->charset); $dumper->setDumpHeader(''); $dumper->setDumpBoundaries('', ''); diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index 1a94755bd71c1..951bbcba7e071 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -109,7 +109,7 @@ protected function write() } if ($input) { - for (;;) { + for (; ;) { $data = fread($input, self::CHUNK_SIZE); if (!isset($data[0])) { break; diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index 87a781ea9204a..7712cd453d662 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -55,7 +55,7 @@ public function __construct($disableOutput, $input) $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); - for ($i = 0;; ++$i) { + for ($i = 0; ; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); if (file_exists($file) && !unlink($file)) { diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 4ea0b8a1a3e7c..4b243286bcc6f 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); } not_bar: @@ -51,10 +51,9 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); } not_barhead: - } if (0 === strpos($pathinfo, '/test')) { @@ -73,12 +72,11 @@ public function match($pathinfo) if ($pathinfo === '/test/baz3/') { return array('_route' => 'baz3'); } - } // baz4 if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); } // baz5 @@ -88,7 +86,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); } not_baz5: @@ -99,20 +97,19 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); } not_bazbaz6: - } // foofoo if ($pathinfo === '/foofoo') { - return array ( 'def' => 'test', '_route' => 'foofoo',); + return array('def' => 'test', '_route' => 'foofoo'); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); } // space @@ -124,40 +121,37 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); } - } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); } - } - } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); } // overridden2 @@ -169,17 +163,16 @@ public function match($pathinfo) if ($pathinfo === '/multi/hey/') { return array('_route' => 'hey'); } - } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); } if (0 === strpos($pathinfo, '/aba')) { @@ -190,9 +183,8 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); } - } $host = $this->context->getHost(); @@ -207,7 +199,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } - } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -215,7 +206,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } - } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -223,7 +213,6 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -231,7 +220,6 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } - } // route6 @@ -243,47 +231,43 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); } - } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); } - } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } - } if (0 === strpos($pathinfo, '/a')) { @@ -295,16 +279,14 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); } - } - } throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index f9d3fa2d8257b..81e7e727395d5 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); } not_bar: @@ -51,10 +51,9 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); } not_barhead: - } if (0 === strpos($pathinfo, '/test')) { @@ -77,7 +76,6 @@ public function match($pathinfo) return array('_route' => 'baz3'); } - } // baz4 @@ -86,7 +84,7 @@ public function match($pathinfo) return $this->redirect($pathinfo.'/', 'baz4'); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); } // baz5 @@ -96,7 +94,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); } not_baz5: @@ -107,20 +105,19 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); } not_bazbaz6: - } // foofoo if ($pathinfo === '/foofoo') { - return array ( 'def' => 'test', '_route' => 'foofoo',); + return array('def' => 'test', '_route' => 'foofoo'); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); } // space @@ -132,40 +129,37 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); } - } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); } - } - } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); } // overridden2 @@ -181,17 +175,16 @@ public function match($pathinfo) return array('_route' => 'hey'); } - } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); } if (0 === strpos($pathinfo, '/aba')) { @@ -202,9 +195,8 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); } - } $host = $this->context->getHost(); @@ -219,7 +211,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } - } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -227,7 +218,6 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } - } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -235,7 +225,6 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -243,7 +232,6 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } - } // route6 @@ -255,47 +243,43 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); } - } - } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); } - } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } - } if (0 === strpos($pathinfo, '/a')) { @@ -307,21 +291,19 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); } - } - } // secure if ($pathinfo === '/secure') { - $requiredSchemes = array ( 'https' => 0,); + $requiredSchemes = array('https' => 0); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); } @@ -331,7 +313,7 @@ public function match($pathinfo) // nonsecure if ($pathinfo === '/nonsecure') { - $requiredSchemes = array ( 'http' => 0,); + $requiredSchemes = array('http' => 0); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php index d9da7b02d4b43..984b2743f122c 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -35,13 +35,12 @@ public function match($pathinfo) // dynamic if (preg_match('#^/rootprefix/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array()); } - } // with-condition - if ($pathinfo === '/with-condition' && ($context->getMethod() == "GET")) { + if ($pathinfo === '/with-condition' && ($context->getMethod() == 'GET')) { return array('_route' => 'with-condition'); } diff --git a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php index 7561c34f1a211..6f5639a3d53e0 100644 --- a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php +++ b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php @@ -1 +1 @@ - + 'bar', ); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 59ba119e42914..822736abd5561 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -125,9 +125,9 @@ public function dumpScalar(Cursor $cursor, $type, $value) $style = 'num'; switch (true) { - case INF === $value: $value = 'INF'; break; + case INF === $value: $value = 'INF'; break; case -INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; + case is_nan($value): $value = 'NAN'; break; default: $value = (string) $value; if (false === strpos($value, $this->decimalPoint)) { diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index de93d7986e0a5..e5d022fd379dc 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -31,13 +31,13 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", ); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P'); + '\\N', '\\_', '\\L', '\\P', ); /** * Determines if a PHP value would require double quoting in YAML. From 735d0a6ce7083d259c75bfee108bdf0dd23a8bbb Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:37:26 -0800 Subject: [PATCH 25/61] Revert "fixed typo" This reverts commit 6830d9f4c904d74020d2619fae990670edb3c3de. --- .../DeprecationErrorHandler/default.phpt | 6 +- .../Tests/DeprecationErrorHandler/weak.phpt | 2 +- .../Extension/TranslationExtensionTest.php | 12 ++-- .../Resources/views/Form/attributes.html.php | 2 +- .../views/Form/button_widget.html.php | 6 +- .../views/Form/choice_options.html.php | 2 +- .../views/Form/choice_widget_options.html.php | 2 +- .../views/Form/container_attributes.html.php | 2 +- .../views/Form/email_widget.html.php | 2 +- .../Resources/views/Form/form_label.html.php | 18 ++--- .../Resources/views/Form/form_start.html.php | 4 +- .../Resources/views/Form/hidden_row.html.php | 2 +- .../views/Form/hidden_widget.html.php | 2 +- .../views/Form/integer_widget.html.php | 2 +- .../views/Form/money_widget.html.php | 2 +- .../views/Form/number_widget.html.php | 2 +- .../views/Form/password_widget.html.php | 2 +- .../views/Form/repeated_row.html.php | 2 +- .../views/Form/reset_widget.html.php | 2 +- .../views/Form/search_widget.html.php | 2 +- .../views/Form/submit_widget.html.php | 2 +- .../Resources/views/Form/url_widget.html.php | 2 +- .../Custom/_name_c_entry_label.html.php | 4 +- .../Debug/Resources/ext/tests/001.phpt | 4 +- .../Debug/Resources/ext/tests/002.phpt | 4 +- .../Debug/Resources/ext/tests/002_1.phpt | 4 +- .../Debug/Resources/ext/tests/003.phpt | 4 +- .../Debug/Tests/DebugClassLoaderTest.php | 2 +- .../Compiler/CheckCircularReferencesPass.php | 1 + .../DependencyInjection/Container.php | 4 +- .../DependencyInjection/Definition.php | 2 +- .../Tests/Fixtures/containers/container14.php | 2 +- .../Tests/Fixtures/php/services1-1.php | 1 - .../Tests/Fixtures/php/services8.php | 2 +- .../Tests/Fixtures/php/services9.php | 2 +- .../Tests/Fixtures/php/services9_compiled.php | 4 +- .../DataCollector/DumpDataCollector.php | 2 +- .../Component/Process/Pipes/AbstractPipes.php | 2 +- .../Component/Process/Pipes/WindowsPipes.php | 2 +- .../Tests/Fixtures/dumper/url_matcher1.php | 68 +++++++++++------- .../Tests/Fixtures/dumper/url_matcher2.php | 72 ++++++++++++------- .../Tests/Fixtures/dumper/url_matcher3.php | 5 +- .../Tests/Fixtures/templates/foo.php | 2 +- .../Translation/Tests/fixtures/resources.php | 2 +- .../Component/VarDumper/Dumper/CliDumper.php | 4 +- src/Symfony/Component/Yaml/Escaper.php | 4 +- 46 files changed, 149 insertions(+), 134 deletions(-) diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt index 49a14479475a0..fac5c53ae7486 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/default.phpt @@ -31,14 +31,14 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } public function testNonLegacyBar() { @trigger_error('silenced bar deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced bar deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt index d697843280f4b..9e78d96e70efb 100644 --- a/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt +++ b/src/Symfony/Bridge/PhpUnit/Tests/DeprecationErrorHandler/weak.phpt @@ -23,7 +23,7 @@ class FooTestCase public function testLegacyFoo() { @trigger_error('silenced foo deprecation', E_USER_DEPRECATED); - @trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); + trigger_error('unsilenced foo deprecation', E_USER_DEPRECATED); } } diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php index e066d537352c4..e96bd4f9a3bef 100644 --- a/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php +++ b/src/Symfony/Bridge/Twig/Tests/Extension/TranslationExtensionTest.php @@ -87,17 +87,17 @@ public function getTransTests() // transchoice array('{% transchoice count from "messages" %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0), ), + 'There is no apples', array('count' => 0)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', array('count' => 5), ), + 'There is 5 apples', array('count' => 5)), array('{% transchoice count %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony'), ), + 'There is 5 apples (Symfony)', array('count' => 5, 'name' => 'Symfony')), array('{% transchoice count with { \'%name%\': \'Symfony\' } %}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples (%name%){% endtranschoice %}', - 'There is 5 apples (Symfony)', array('count' => 5), ), + 'There is 5 apples (Symfony)', array('count' => 5)), array('{% transchoice count into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is no apples', array('count' => 0), ), + 'There is no apples', array('count' => 0)), array('{% transchoice 5 into "fr"%}{0} There is no apples|{1} There is one apple|]1,Inf] There is %count% apples{% endtranschoice %}', - 'There is 5 apples', ), + 'There is 5 apples'), // trans filter array('{{ "Hello"|trans }}', 'Hello'), diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php index 28474797a5538..eb421be817691 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/attributes.html.php @@ -1 +1 @@ -block($form, 'widget_attributes'); +block($form, 'widget_attributes') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php index 32d8eeb619141..9dac32fc994c0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/button_widget.html.php @@ -1,6 +1,4 @@ - $name, '%id%' => $id)) - : $view['form']->humanize($name); -} ?> + : $view['form']->humanize($name); } ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php index 2463438d5aad5..211ae73f1c3d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_options.html.php @@ -1 +1 @@ -block($form, 'choice_widget_options'); +block($form, 'choice_widget_options') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php index fc9846375f851..f1c6ad3b56f21 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_options.html.php @@ -1,6 +1,6 @@ +$translatorHelper = $view['translator']; // outside of the loop for performance reasons! ?> $choice): ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php index fb6c0f2b5ed8b..302bbfcd479d9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/container_attributes.html.php @@ -1 +1 @@ -block($form, 'widget_container_attributes'); +block($form, 'widget_container_attributes') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php index 7dfd085d86a6a..0b30c5bb7ae54 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/email_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'email')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php index 1b10546d979f3..7a51b2ce7b4ff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_label.html.php @@ -1,16 +1,8 @@ - - - + + $name, '%id%' => $id)) - : $view['form']->humanize($name); -} ?> - + : $view['form']->humanize($name); } ?> + diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php index c81836eeb7e30..e7b23d394daec 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_start.html.php @@ -1,8 +1,6 @@ - $v) { - printf(' %s="%s"', $view->escape($k), $view->escape($v)); -} ?> enctype="multipart/form-data"> + $v) { printf(' %s="%s"', $view->escape($k), $view->escape($v)); } ?> enctype="multipart/form-data"> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php index 800a8facf87f3..3239d8f415b12 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_row.html.php @@ -1 +1 @@ -widget($form); +widget($form) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php index 8763fa6d4b79a..a43f7de475e7a 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/hidden_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'hidden')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php index 9efb26a18ffa0..5fceb49a38953 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/integer_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'number')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php index ea12cd4a4881a..644d284915371 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/money_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple'), $money_pattern); +block($form, 'form_widget_simple'), $money_pattern) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php index 6f2d12e19d22e..bf4a4c478502b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/number_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'text')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php index decefacf91800..ec96cfb46b24c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/password_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'password')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php index 04cc29bcca3e0..d4af23d712320 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/repeated_row.html.php @@ -1 +1 @@ -block($form, 'form_rows'); +block($form, 'form_rows') ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php index 0f66b4b6aecf9..e8fa18e488df8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/reset_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')); +block($form, 'button_widget', array('type' => isset($type) ? $type : 'reset')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php index 73ff6908d78b8..48a33f4aa2dbc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/search_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'search')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php index 027bdc9857369..6bf71f5a1e1c9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/submit_widget.html.php @@ -1 +1 @@ -block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')); +block($form, 'button_widget', array('type' => isset($type) ? $type : 'submit')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php index 80329fff87d85..9e26318497b3c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/url_widget.html.php @@ -1 +1 @@ -block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')); +block($form, 'form_widget_simple', array('type' => isset($type) ? $type : 'url')) ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php index 80a9c5f611a36..05240035c023d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_c_entry_label.html.php @@ -1,4 +1,2 @@ -humanize($name); -} ?> +humanize($name); } ?> diff --git a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt index 873e2569ec5a3..15e183a70615c 100644 --- a/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt +++ b/src/Symfony/Component/Debug/Resources/ext/tests/001.phpt @@ -1,9 +1,7 @@ --TEST-- Test symfony_zval_info API --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- getId(); if (empty($this->checkedNodes[$id])) { + // don't check circular dependencies for lazy services if (!$node->getValue() || !$node->getValue()->isLazy()) { $searchKey = array_search($id, $this->currentPath); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 2421b82a7ea3a..f6c953f550993 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -219,7 +219,7 @@ public function set($id, $service, $scope = self::SCOPE_CONTAINER) */ public function has($id) { - for ($i = 2; ;) { + for ($i = 2;;) { if ('service_container' === $id || isset($this->aliases[$id]) || isset($this->services[$id]) @@ -258,7 +258,7 @@ public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE // available services. Service IDs are case insensitive, however since // this method can be called thousands of times during a request, avoid // calling strtolower() unless necessary. - for ($i = 2; ;) { + for ($i = 2;;) { if ('service_container' === $id) { return $this; } diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 4f2ee304adad2..72fba5acc7ce6 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -158,7 +158,7 @@ public function setDecoratedService($id, $renamedId = null) } /** - * Gets the service that this service is decorating. + * Gets the service that decorates this service. * * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php index 191afb8cddc1f..56ea6c1ed23d4 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php @@ -4,7 +4,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; -/* +/** * This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer * and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped. */ diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php index 0fede650233e5..f15771172ef19 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php @@ -1,5 +1,4 @@ array( 0 => true, 1 => false, - 2 => null, + 2 => NULL, 3 => 0, 4 => 1000.3, 5 => 'true', diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index c173b83906785..ce8930b8ddeba 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -248,7 +248,7 @@ protected function getMethodCall1Service() if ($this->has('foobaz')) { $instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE)); } - $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); + $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); return $instance; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php index 8991bd006e4f3..559560fa6da60 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php @@ -253,8 +253,8 @@ protected function getMethodCall1Service() $this->services['method_call1'] = $instance = new \Bar\FooClass(); $instance->setBar($this->get('foo')); - $instance->setBar(null); - $instance->setBar(($this->get('foo')->foo().(($this->hasParameter('foo')) ? ($this->getParameter('foo')) : ('default')))); + $instance->setBar(NULL); + $instance->setBar(($this->get("foo")->foo() . (($this->hasParameter("foo")) ? ($this->getParameter("foo")) : ("default")))); return $instance; } diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 3f20c4343981f..538d73c783ba3 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -298,7 +298,7 @@ private function htmlEncode($s) { $html = ''; - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line; }, $this->charset); + $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); $dumper->setDumpHeader(''); $dumper->setDumpBoundaries('', ''); diff --git a/src/Symfony/Component/Process/Pipes/AbstractPipes.php b/src/Symfony/Component/Process/Pipes/AbstractPipes.php index 951bbcba7e071..1a94755bd71c1 100644 --- a/src/Symfony/Component/Process/Pipes/AbstractPipes.php +++ b/src/Symfony/Component/Process/Pipes/AbstractPipes.php @@ -109,7 +109,7 @@ protected function write() } if ($input) { - for (; ;) { + for (;;) { $data = fread($input, self::CHUNK_SIZE); if (!isset($data[0])) { break; diff --git a/src/Symfony/Component/Process/Pipes/WindowsPipes.php b/src/Symfony/Component/Process/Pipes/WindowsPipes.php index 7712cd453d662..87a781ea9204a 100644 --- a/src/Symfony/Component/Process/Pipes/WindowsPipes.php +++ b/src/Symfony/Component/Process/Pipes/WindowsPipes.php @@ -55,7 +55,7 @@ public function __construct($disableOutput, $input) $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); - for ($i = 0; ; ++$i) { + for ($i = 0;; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); if (file_exists($file) && !unlink($file)) { diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 4b243286bcc6f..4ea0b8a1a3e7c 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); } not_bar: @@ -51,9 +51,10 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); } not_barhead: + } if (0 === strpos($pathinfo, '/test')) { @@ -72,11 +73,12 @@ public function match($pathinfo) if ($pathinfo === '/test/baz3/') { return array('_route' => 'baz3'); } + } // baz4 if (preg_match('#^/test/(?P[^/]++)/$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); } // baz5 @@ -86,7 +88,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); } not_baz5: @@ -97,19 +99,20 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); } not_bazbaz6: + } // foofoo if ($pathinfo === '/foofoo') { - return array('def' => 'test', '_route' => 'foofoo'); + return array ( 'def' => 'test', '_route' => 'foofoo',); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); } // space @@ -121,37 +124,40 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); } + } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); } + } + } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); } // overridden2 @@ -163,16 +169,17 @@ public function match($pathinfo) if ($pathinfo === '/multi/hey/') { return array('_route' => 'hey'); } + } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); } if (0 === strpos($pathinfo, '/aba')) { @@ -183,8 +190,9 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); } + } $host = $this->context->getHost(); @@ -199,6 +207,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } + } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -206,6 +215,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } + } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -213,6 +223,7 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -220,6 +231,7 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } + } // route6 @@ -231,43 +243,47 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); } + } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); } + } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } + } if (0 === strpos($pathinfo, '/a')) { @@ -279,14 +295,16 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); } + } + } throw 0 < count($allow) ? new MethodNotAllowedException(array_unique($allow)) : new ResourceNotFoundException(); diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index 81e7e727395d5..f9d3fa2d8257b 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -29,7 +29,7 @@ public function match($pathinfo) // foo if (0 === strpos($pathinfo, '/foo') && preg_match('#^/foo/(?Pbaz|symfony)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array('def' => 'test')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo')), array ( 'def' => 'test',)); } if (0 === strpos($pathinfo, '/bar')) { @@ -40,7 +40,7 @@ public function match($pathinfo) goto not_bar; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar')), array ()); } not_bar: @@ -51,9 +51,10 @@ public function match($pathinfo) goto not_barhead; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'barhead')), array ()); } not_barhead: + } if (0 === strpos($pathinfo, '/test')) { @@ -76,6 +77,7 @@ public function match($pathinfo) return array('_route' => 'baz3'); } + } // baz4 @@ -84,7 +86,7 @@ public function match($pathinfo) return $this->redirect($pathinfo.'/', 'baz4'); } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz4')), array ()); } // baz5 @@ -94,7 +96,7 @@ public function match($pathinfo) goto not_baz5; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz5')), array ()); } not_baz5: @@ -105,19 +107,20 @@ public function match($pathinfo) goto not_bazbaz6; } - return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'baz.baz6')), array ()); } not_bazbaz6: + } // foofoo if ($pathinfo === '/foofoo') { - return array('def' => 'test', '_route' => 'foofoo'); + return array ( 'def' => 'test', '_route' => 'foofoo',); } // quoter if (preg_match('#^/(?P[\']+)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'quoter')), array ()); } // space @@ -129,37 +132,40 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo1')), array ()); } // bar1 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar1')), array ()); } + } // overridden if (preg_match('#^/a/(?P.*)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'overridden')), array ()); } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo2')), array ()); } // bar2 if (preg_match('#^/a/b\'b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar2')), array ()); } + } + } if (0 === strpos($pathinfo, '/multi')) { // helloWorld if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?P[^/]++))?$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array('who' => 'World!')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'helloWorld')), array ( 'who' => 'World!',)); } // overridden2 @@ -175,16 +181,17 @@ public function match($pathinfo) return array('_route' => 'hey'); } + } // foo3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo3')), array ()); } // bar3 if (preg_match('#^/(?P<_locale>[^/]++)/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'bar3')), array ()); } if (0 === strpos($pathinfo, '/aba')) { @@ -195,8 +202,9 @@ public function match($pathinfo) // foo4 if (preg_match('#^/aba/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'foo4')), array ()); } + } $host = $this->context->getHost(); @@ -211,6 +219,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route2') { return array('_route' => 'route2'); } + } if (preg_match('#^b\\.example\\.com$#si', $host, $hostMatches)) { @@ -218,6 +227,7 @@ public function match($pathinfo) if ($pathinfo === '/c2/route3') { return array('_route' => 'route3'); } + } if (preg_match('#^a\\.example\\.com$#si', $host, $hostMatches)) { @@ -225,6 +235,7 @@ public function match($pathinfo) if ($pathinfo === '/route4') { return array('_route' => 'route4'); } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { @@ -232,6 +243,7 @@ public function match($pathinfo) if ($pathinfo === '/route5') { return array('_route' => 'route5'); } + } // route6 @@ -243,43 +255,47 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/route1')) { // route11 if ($pathinfo === '/route11') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array()); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route11')), array ()); } // route12 if ($pathinfo === '/route12') { - return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, array('_route' => 'route12')), array ( 'var1' => 'val',)); } // route13 if (0 === strpos($pathinfo, '/route13') && preg_match('#^/route13/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array()); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route13')), array ()); } // route14 if (0 === strpos($pathinfo, '/route14') && preg_match('#^/route14/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($hostMatches, $matches, array('_route' => 'route14')), array ( 'var1' => 'val',)); } + } + } if (preg_match('#^c\\.example\\.com$#si', $host, $hostMatches)) { // route15 if (0 === strpos($pathinfo, '/route15') && preg_match('#^/route15/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route15')), array ()); } + } if (0 === strpos($pathinfo, '/route1')) { // route16 if (0 === strpos($pathinfo, '/route16') && preg_match('#^/route16/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array('var1' => 'val')); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'route16')), array ( 'var1' => 'val',)); } // route17 if ($pathinfo === '/route17') { return array('_route' => 'route17'); } + } if (0 === strpos($pathinfo, '/a')) { @@ -291,19 +307,21 @@ public function match($pathinfo) if (0 === strpos($pathinfo, '/a/b')) { // b if (preg_match('#^/a/b/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'b')), array ()); } // c if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'c')), array ()); } + } + } // secure if ($pathinfo === '/secure') { - $requiredSchemes = array('https' => 0); + $requiredSchemes = array ( 'https' => 0,); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'secure', key($requiredSchemes)); } @@ -313,7 +331,7 @@ public function match($pathinfo) // nonsecure if ($pathinfo === '/nonsecure') { - $requiredSchemes = array('http' => 0); + $requiredSchemes = array ( 'http' => 0,); if (!isset($requiredSchemes[$this->context->getScheme()])) { return $this->redirect($pathinfo, 'nonsecure', key($requiredSchemes)); } diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php index 984b2743f122c..d9da7b02d4b43 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -35,12 +35,13 @@ public function match($pathinfo) // dynamic if (preg_match('#^/rootprefix/(?P[^/]++)$#s', $pathinfo, $matches)) { - return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array()); + return $this->mergeDefaults(array_replace($matches, array('_route' => 'dynamic')), array ()); } + } // with-condition - if ($pathinfo === '/with-condition' && ($context->getMethod() == 'GET')) { + if ($pathinfo === '/with-condition' && ($context->getMethod() == "GET")) { return array('_route' => 'with-condition'); } diff --git a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php index 6f5639a3d53e0..7561c34f1a211 100644 --- a/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php +++ b/src/Symfony/Component/Templating/Tests/Fixtures/templates/foo.php @@ -1 +1 @@ - diff --git a/src/Symfony/Component/Translation/Tests/fixtures/resources.php b/src/Symfony/Component/Translation/Tests/fixtures/resources.php index 0cc2bec1d52b5..c2913985391cb 100644 --- a/src/Symfony/Component/Translation/Tests/fixtures/resources.php +++ b/src/Symfony/Component/Translation/Tests/fixtures/resources.php @@ -1,5 +1,5 @@ 'bar', ); diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index 822736abd5561..59ba119e42914 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -125,9 +125,9 @@ public function dumpScalar(Cursor $cursor, $type, $value) $style = 'num'; switch (true) { - case INF === $value: $value = 'INF'; break; + case INF === $value: $value = 'INF'; break; case -INF === $value: $value = '-INF'; break; - case is_nan($value): $value = 'NAN'; break; + case is_nan($value): $value = 'NAN'; break; default: $value = (string) $value; if (false === strpos($value, $this->decimalPoint)) { diff --git a/src/Symfony/Component/Yaml/Escaper.php b/src/Symfony/Component/Yaml/Escaper.php index e5d022fd379dc..de93d7986e0a5 100644 --- a/src/Symfony/Component/Yaml/Escaper.php +++ b/src/Symfony/Component/Yaml/Escaper.php @@ -31,13 +31,13 @@ class Escaper "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", - "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9", ); + "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); private static $escaped = array('\\\\', '\\"', '\\\\', '\\"', '\\0', '\\x01', '\\x02', '\\x03', '\\x04', '\\x05', '\\x06', '\\a', '\\b', '\\t', '\\n', '\\v', '\\f', '\\r', '\\x0e', '\\x0f', '\\x10', '\\x11', '\\x12', '\\x13', '\\x14', '\\x15', '\\x16', '\\x17', '\\x18', '\\x19', '\\x1a', '\\e', '\\x1c', '\\x1d', '\\x1e', '\\x1f', - '\\N', '\\_', '\\L', '\\P', ); + '\\N', '\\_', '\\L', '\\P'); /** * Determines if a PHP value would require double quoting in YAML. From d103b6142025bf180166ed5d5a19609c0ea38a7c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:37:56 -0800 Subject: [PATCH 26/61] fixed typo --- src/Symfony/Component/DependencyInjection/Definition.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 72fba5acc7ce6..4f2ee304adad2 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -158,7 +158,7 @@ public function setDecoratedService($id, $renamedId = null) } /** - * Gets the service that decorates this service. + * Gets the service that this service is decorating. * * @return null|array An array composed of the decorated service id and the new id for it, null if no service is decorated */ From 2ff6f445bc465b1fc9a57680702e825c4d309511 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:45:58 -0800 Subject: [PATCH 27/61] fixed CS fixer config --- .php_cs.dist | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index e2e173ad0545e..f6b07d11dd6f3 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -15,24 +15,24 @@ return PhpCsFixer\Config::create() ->in(__DIR__.'/src') ->exclude(array( // directories containing files with content that is autogenerated by `var_export`, which breaks CS in output code - 'src/Symfony/Component/DependencyInjection/Tests/Fixtures', - 'src/Symfony/Component/Routing/Tests/Fixtures/dumper', + 'Symfony/Component/DependencyInjection/Tests/Fixtures', + 'Symfony/Component/Routing/Tests/Fixtures/dumper', // fixture templates - 'src/Symfony/Component/Templating/Tests/Fixtures/templates', - 'src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', + 'Symfony/Component/Templating/Tests/Fixtures/templates', + 'Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom', // resource templates - 'src/Symfony/Bundle/FrameworkBundle/Resources/views/Form', + 'Symfony/Bundle/FrameworkBundle/Resources/views/Form', )) // file content autogenerated by `var_export` - ->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php') + ->notPath('Symfony/Component/Translation/Tests/fixtures/resources.php') // autogenerated xmls - ->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_1.xml') - ->notPath('src/Symfony/Component/Console/Tests/Fixtures/application_2.xml') + ->notPath('Symfony/Component/Console/Tests/Fixtures/application_1.xml') + ->notPath('Symfony/Component/Console/Tests/Fixtures/application_2.xml') // yml - ->notPath('src/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') + ->notPath('Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml') // test template - ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') + ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php') // explicit heredoc test - ->notPath('src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') + ->notPath('Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php') ) ; From b6507c8c1ced3bcb06858414d9fc212c0d1e882a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:52:33 -0800 Subject: [PATCH 28/61] fixed CS --- .php_cs.dist | 1 + .../Compiler/CheckCircularReferencesPass.php | 1 - .../Component/HttpKernel/DataCollector/DumpDataCollector.php | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.php_cs.dist b/.php_cs.dist index f6b07d11dd6f3..140fd3265011c 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -8,6 +8,7 @@ return PhpCsFixer\Config::create() 'no_unreachable_default_argument_value' => false, 'braces' => array('allow_single_line_closure' => true), 'heredoc_to_nowdoc' => false, + 'phpdoc_annotation_without_dot' => false, )) ->setRiskyAllowed(true) ->setFinder( diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php index 156bcc0c3ab7b..f39a89af2be71 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php @@ -60,7 +60,6 @@ private function checkOutEdges(array $edges) $id = $node->getId(); if (empty($this->checkedNodes[$id])) { - // don't check circular dependencies for lazy services if (!$node->getValue() || !$node->getValue()->isLazy()) { $searchKey = array_search($id, $this->currentPath); diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php index 538d73c783ba3..78fc74f2d3f4a 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/DumpDataCollector.php @@ -298,7 +298,7 @@ private function htmlEncode($s) { $html = ''; - $dumper = new HtmlDumper(function ($line) use (&$html) {$html .= $line;}, $this->charset); + $dumper = new HtmlDumper(function ($line) use (&$html) { $html .= $line; }, $this->charset); $dumper->setDumpHeader(''); $dumper->setDumpBoundaries('', ''); From 4a46c6ff13ef6b1d217edb5ceb8590dc1bc9881d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 21 Jan 2017 08:59:38 -0800 Subject: [PATCH 29/61] fixed CS --- src/Symfony/Component/Form/Extension/Core/Type/DateType.php | 2 +- src/Symfony/Component/Form/Extension/Core/Type/TimeType.php | 2 +- src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php | 2 +- .../Component/Serializer/Tests/Encoder/JsonDecodeTest.php | 2 +- .../Component/Serializer/Tests/Encoder/JsonEncodeTest.php | 2 +- .../Component/Translation/Tests/Dumper/FileDumperTest.php | 2 +- src/Symfony/Component/Translation/Util/ArrayConverter.php | 2 +- src/Symfony/Component/Validator/Constraints/BicValidator.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index 209ece5cae3ed..cd21538b26823 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -221,7 +221,7 @@ public function configureOptions(OptionsResolver $resolver) array('year' => $default, 'month' => $default, 'day' => $default), $choiceTranslationDomain ); - }; + } return array( 'year' => $choiceTranslationDomain, diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 8aae516a5e2e4..6af08fb32bb0d 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -222,7 +222,7 @@ public function configureOptions(OptionsResolver $resolver) array('hour' => $default, 'minute' => $default, 'second' => $default), $choiceTranslationDomain ); - }; + } return array( 'hour' => $choiceTranslationDomain, diff --git a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php index 942318af605d8..031c8ac05e26a 100644 --- a/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php +++ b/src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php @@ -44,7 +44,7 @@ class PropertyInfoExtractor implements PropertyInfoExtractorInterface * @param PropertyDescriptionExtractorInterface[] $descriptionExtractors * @param PropertyAccessExtractorInterface[] $accessExtractors */ - public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array()) + public function __construct(array $listExtractors = array(), array $typeExtractors = array(), array $descriptionExtractors = array(), array $accessExtractors = array()) { $this->listExtractors = $listExtractors; $this->typeExtractors = $typeExtractors; diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php index c87ab21b510a2..7818aeaf55df8 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonDecodeTest.php @@ -61,7 +61,7 @@ public function decodeProvider() */ public function testDecodeWithException($value) { - $this->decode->decode($value, JsonEncoder::FORMAT); + $this->decode->decode($value, JsonEncoder::FORMAT); } public function decodeProviderException() diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php index d255b21d22e7f..291c0f0965c80 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/JsonEncodeTest.php @@ -54,6 +54,6 @@ public function encodeProvider() */ public function testEncodeWithError() { - $this->encode->encode("\xB1\x31", JsonEncoder::FORMAT); + $this->encode->encode("\xB1\x31", JsonEncoder::FORMAT); } } diff --git a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php index e98443246b20a..75aba4d5d2765 100644 --- a/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php +++ b/src/Symfony/Component/Translation/Tests/Dumper/FileDumperTest.php @@ -26,7 +26,7 @@ public function testDump() $dumper = new ConcreteFileDumper(); $dumper->dump($catalogue, array('path' => $tempDir)); - $this->assertTrue(file_exists($tempDir.'/messages.en.concrete')); + $this->assertFileExists($tempDir.'/messages.en.concrete'); } public function testDumpBackupsFileIfExisting() diff --git a/src/Symfony/Component/Translation/Util/ArrayConverter.php b/src/Symfony/Component/Translation/Util/ArrayConverter.php index 60a55e9d3709c..9c0a420a8592f 100644 --- a/src/Symfony/Component/Translation/Util/ArrayConverter.php +++ b/src/Symfony/Component/Translation/Util/ArrayConverter.php @@ -62,7 +62,7 @@ private static function &getElementByPath(array &$tree, array $parts) * $tree['foo'] was string before we found array {bar: test2}. * Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2'; */ - $elem = &$elem[ implode('.', array_slice($parts, $i)) ]; + $elem = &$elem[implode('.', array_slice($parts, $i))]; break; } $parentOfElem = &$elem; diff --git a/src/Symfony/Component/Validator/Constraints/BicValidator.php b/src/Symfony/Component/Validator/Constraints/BicValidator.php index f476713c74d14..d2188071fabf1 100644 --- a/src/Symfony/Component/Validator/Constraints/BicValidator.php +++ b/src/Symfony/Component/Validator/Constraints/BicValidator.php @@ -17,7 +17,7 @@ /** * @author Michael Hirschler * - * @link https://en.wikipedia.org/wiki/ISO_9362#Structure + * @see https://en.wikipedia.org/wiki/ISO_9362#Structure */ class BicValidator extends ConstraintValidator { From f920e61d3502b9f3d2d5ed8c1df14428c2b46fdf Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 22 Jan 2017 08:38:04 +0100 Subject: [PATCH 30/61] update German translation --- .../Validator/Resources/translations/validators.de.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf index 105f2fb2a1941..8948f8e423a42 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.de.xlf @@ -192,7 +192,7 @@ No temporary folder was configured in php.ini. - Es wurde kein temporärer Ordner in der php.ini konfiguriert. + Es wurde kein temporärer Ordner in der php.ini konfiguriert oder der temporäre Ordner existiert nicht. Cannot write temporary file to disk. From 1d298f0417652ce5dac2e0e4756d5c244be57046 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Mon, 23 Jan 2017 17:37:56 +0100 Subject: [PATCH 31/61] [Routing] Fix BC break in AnnotationClassLoader defaults attributes handling --- composer.json | 3 +- .../Functional/AnnotatedControllerTest.php | 39 ++++++++++++++ .../Controller/AnnotatedController.php | 51 +++++++++++++++++++ .../app/AnnotatedController/bundles.php | 20 ++++++++ .../app/AnnotatedController/config.yml | 2 + .../app/AnnotatedController/routing.yml | 4 ++ .../Bundle/FrameworkBundle/composer.json | 5 +- .../Routing/Loader/AnnotationClassLoader.php | 5 ++ 8 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml diff --git a/composer.json b/composer.json index 34dfa896e3b45..2d7b451159758 100644 --- a/composer.json +++ b/composer.json @@ -79,7 +79,8 @@ "ircmaxell/password-compat": "~1.0", "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "symfony/phpunit-bridge": "~3.2", - "egulias/email-validator": "~1.2,>=1.2.1" + "egulias/email-validator": "~1.2,>=1.2.1", + "sensio/framework-extra-bundle": "^3.0.2" }, "autoload": { "psr-4": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php new file mode 100644 index 0000000000000..2fdbef8839496 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/AnnotatedControllerTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; + +class AnnotatedControllerTest extends WebTestCase +{ + /** + * @dataProvider getRoutes + */ + public function testAnnotatedController($path, $expectedValue) + { + $client = $this->createClient(array('test_case' => 'AnnotatedController', 'root_config' => 'config.yml')); + $client->request('GET', '/annotated'.$path); + + $this->assertSame(200, $client->getResponse()->getStatusCode()); + $this->assertSame($expectedValue, $client->getResponse()->getContent()); + } + + public function getRoutes() + { + return array( + array('/null_request', 'Symfony\Component\HttpFoundation\Request'), + array('/null_argument', ''), + array('/null_argument_with_route_param', ''), + array('/null_argument_with_route_param/value', 'value'), + array('/argument_with_route_param_and_default', 'value'), + array('/argument_with_route_param_and_default/custom', 'custom'), + ); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php new file mode 100644 index 0000000000000..98a3ace982e33 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Controller/AnnotatedController.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\Controller; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Annotation\Route; + +class AnnotatedController +{ + /** + * @Route("/null_request", name="null_request") + */ + public function requestDefaultNullAction(Request $request = null) + { + return new Response($request ? get_class($request) : null); + } + + /** + * @Route("/null_argument", name="null_argument") + */ + public function argumentDefaultNullWithoutRouteParamAction($value = null) + { + return new Response($value); + } + + /** + * @Route("/null_argument_with_route_param/{value}", name="null_argument_with_route_param") + */ + public function argumentDefaultNullWithRouteParamAction($value = null) + { + return new Response($value); + } + + /** + * @Route("/argument_with_route_param_and_default/{value}", defaults={"value": "value"}, name="argument_with_route_param_and_default") + */ + public function argumentWithoutDefaultWithRouteParamAndDefaultAction($value) + { + return new Response($value); + } +} diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php new file mode 100644 index 0000000000000..f3290d7728541 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/bundles.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\TestBundle; +use Symfony\Bundle\FrameworkBundle\FrameworkBundle; +use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle; + +return array( + new FrameworkBundle(), + new TestBundle(), + new SensioFrameworkExtraBundle(), +); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml new file mode 100644 index 0000000000000..377d3e7852064 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../config/default.yml } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml new file mode 100644 index 0000000000000..ebd18a0a4c282 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AnnotatedController/routing.yml @@ -0,0 +1,4 @@ +annotated_controller: + prefix: /annotated + resource: "@TestBundle/Controller/AnnotatedController.php" + type: annotation diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json index 63c43e003506b..5f0c6ce2e1462 100644 --- a/src/Symfony/Bundle/FrameworkBundle/composer.json +++ b/src/Symfony/Bundle/FrameworkBundle/composer.json @@ -25,7 +25,7 @@ "symfony/http-foundation": "~2.7", "symfony/http-kernel": "~2.7.23|~2.8.16", "symfony/filesystem": "~2.3", - "symfony/routing": "~2.6,>2.6.4", + "symfony/routing": "~2.7.24|~2.8.17", "symfony/security-core": "~2.6.13|~2.7.9|~2.8", "symfony/security-csrf": "~2.6", "symfony/stopwatch": "~2.3", @@ -45,7 +45,8 @@ "symfony/expression-language": "~2.6", "symfony/process": "~2.0,>=2.0.5", "symfony/validator": "~2.5", - "symfony/yaml": "~2.0,>=2.0.5" + "symfony/yaml": "~2.0,>=2.0.5", + "sensio/framework-extra-bundle": "^3.0.2" }, "suggest": { "symfony/console": "For using the console commands", diff --git a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 339529e5190e7..62ad9c3f9fae0 100644 --- a/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/src/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -138,6 +138,11 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl } $defaults = array_replace($globals['defaults'], $annot->getDefaults()); + foreach ($method->getParameters() as $param) { + if (false !== strpos($globals['path'].$annot->getPath(), sprintf('{%s}', $param->getName())) && !isset($defaults[$param->getName()]) && $param->isDefaultValueAvailable()) { + $defaults[$param->getName()] = $param->getDefaultValue(); + } + } $requirements = array_replace($globals['requirements'], $annot->getRequirements()); $options = array_replace($globals['options'], $annot->getOptions()); $schemes = array_merge($globals['schemes'], $annot->getSchemes()); From c56f547c7d9d81829bf85bfb4826992558e08556 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 24 Jan 2017 14:02:12 +0100 Subject: [PATCH 32/61] fix test --- src/Symfony/Component/VarDumper/Tests/CliDumperTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php index 58dbffaa63bd5..90045958ae38b 100644 --- a/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php +++ b/src/Symfony/Component/VarDumper/Tests/CliDumperTest.php @@ -289,7 +289,7 @@ public function testThrowingCaster() %sTemplate.php:%d: """ try {\\n \$this->display(\$context);\\n - } catch (Exception \$e) {\\n + } catch (%s \$e) {\\n """ } } From 83cad14612b39ee53a6e72f947770f68b6fc8d56 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 24 Jan 2017 11:10:56 +0100 Subject: [PATCH 33/61] [Debug] Remove $context arg from handleError(), preparing for PHP 7.2 --- src/Symfony/Component/Debug/ErrorHandler.php | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 8c664c54f9104..1e415604c9cc5 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -349,12 +349,10 @@ private function reRegister($prev) /** * Handles errors by filtering then logging them according to the configured bit fields. * - * @param int $type One of the E_* constants + * @param int $type One of the E_* constants * @param string $message * @param string $file * @param int $line - * @param array $context - * @param array $backtrace * * @return bool Returns false when no handling happens so that the PHP engine can handle the error itself * @@ -362,7 +360,7 @@ private function reRegister($prev) * * @internal */ - public function handleError($type, $message, $file, $line, array $context, array $backtrace = null) + public function handleError($type, $message, $file, $line) { $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; $log = $this->loggedErrors & $type; @@ -372,8 +370,17 @@ public function handleError($type, $message, $file, $line, array $context, array if (!$type || (!$log && !$throw)) { return $type && $log; } + $scope = $this->scopedErrors & $type; - if (isset($context['GLOBALS']) && ($this->scopedErrors & $type)) { + if (4 < $numArgs = func_num_args()) { + $context = $scope ? func_get_arg(4) : array(); + $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM + } else { + $context = array(); + $backtrace = null; + } + + if (isset($context['GLOBALS']) && $scope) { $e = $context; // Whatever the signature of the method, unset($e['GLOBALS'], $context); // $context is always a reference in 5.3 $context = $e; @@ -389,7 +396,7 @@ public function handleError($type, $message, $file, $line, array $context, array } if ($throw) { - if (($this->scopedErrors & $type) && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { + if ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) { // Checking for class existence is a work around for https://bugs.php.net/42098 $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context); } else { @@ -420,7 +427,7 @@ public function handleError($type, $message, $file, $line, array $context, array $e = compact('type', 'file', 'line', 'level'); if ($type & $level) { - if ($this->scopedErrors & $type) { + if ($scope) { $e['scope_vars'] = $context; if ($trace) { $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT); From 2555f3151d2d8fd452d30ad5815b0e8c0bfd3372 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 25 Jan 2017 13:11:45 +0100 Subject: [PATCH 34/61] [Debug] Workaround "null" $context --- src/Symfony/Component/Debug/ErrorHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Debug/ErrorHandler.php b/src/Symfony/Component/Debug/ErrorHandler.php index 1e415604c9cc5..78dfba19b1f2c 100644 --- a/src/Symfony/Component/Debug/ErrorHandler.php +++ b/src/Symfony/Component/Debug/ErrorHandler.php @@ -373,7 +373,7 @@ public function handleError($type, $message, $file, $line) $scope = $this->scopedErrors & $type; if (4 < $numArgs = func_num_args()) { - $context = $scope ? func_get_arg(4) : array(); + $context = $scope ? (func_get_arg(4) ?: array()) : array(); $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM } else { $context = array(); From 89e27240ab9a95ddc3d26280e7d480ea50d77b35 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 25 Jan 2017 13:10:29 +0100 Subject: [PATCH 35/61] [DI] Fix defaults overriding empty strings in AutowirePass --- .../Compiler/AutowirePass.php | 6 ++++-- .../Tests/Compiler/AutowirePassTest.php | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php index cd5b61b29052b..09a237caad099 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @@ -95,8 +95,10 @@ private function completeDefinition($id, Definition $definition) throw new RuntimeException(sprintf('Unable to autowire argument index %d ($%s) for the service "%s". If this is an object, give it a type-hint. Otherwise, specify this argument\'s value explicitly.', $index, $parameter->name, $id)); } - // specifically pass the default value - $arguments[$index] = $parameter->getDefaultValue(); + if (!array_key_exists($index, $arguments)) { + // specifically pass the default value + $arguments[$index] = $parameter->getDefaultValue(); + } continue; } diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php index c9445c01dc1b1..2d34cbff1d7c0 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php @@ -443,6 +443,22 @@ public function testIgnoreServiceWithClassNotExisting() $this->assertTrue($container->hasDefinition('bar')); } + + public function testEmptyStringIsKept() + { + $container = new ContainerBuilder(); + + $container->register('a', __NAMESPACE__.'\A'); + $container->register('lille', __NAMESPACE__.'\Lille'); + $container->register('foo', __NAMESPACE__.'\MultipleArgumentsOptionalScalar') + ->setAutowired(true) + ->setArguments(array('', '')); + + $pass = new AutowirePass(); + $pass->process($container); + + $this->assertEquals(array(new Reference('a'), '', new Reference('lille')), $container->getDefinition('foo')->getArguments()); + } } class Foo From be52b390315e62787179b30a5d95f82519744309 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Fri, 20 Jan 2017 15:18:09 +0100 Subject: [PATCH 36/61] [PropertyAccess] Handle interfaces in the invalid argument exception --- .../PropertyAccess/PropertyAccessor.php | 2 +- .../Tests/Fixtures/TypeHinted.php | 21 +++++++++++++++++++ .../Tests/PropertyAccessorTest.php | 11 ++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index da0c5da93cdef..d7ccc46438675 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -246,7 +246,7 @@ public static function handleError($type, $message, $file, $line, $context) private static function throwInvalidArgumentException($message, $trace, $i) { if (isset($trace[$i]['file']) && __FILE__ === $trace[$i]['file']) { - $pos = strpos($message, $delim = 'must be of the type ') ?: strpos($message, $delim = 'must be an instance of '); + $pos = strpos($message, $delim = 'must be of the type ') ?: (strpos($message, $delim = 'must be an instance of ') ?: strpos($message, $delim = 'must implement interface ')); $pos += strlen($delim); $type = $trace[$i]['args'][0]; $type = is_object($type) ? get_class($type) : gettype($type); diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php index ca4c5745ae06c..ce0f3d89aaa30 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php +++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TypeHinted.php @@ -18,6 +18,11 @@ class TypeHinted { private $date; + /** + * @var \Countable + */ + private $countable; + public function setDate(\DateTime $date) { $this->date = $date; @@ -27,4 +32,20 @@ public function getDate() { return $this->date; } + + /** + * @return \Countable + */ + public function getCountable() + { + return $this->countable; + } + + /** + * @param \Countable $countable + */ + public function setCountable(\Countable $countable) + { + $this->countable = $countable; + } } diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php index 3f1ef1c040a6a..a7e142e878e86 100644 --- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php +++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php @@ -554,4 +554,15 @@ public function testArrayNotBeeingOverwritten() $this->assertSame('baz', $this->propertyAccessor->getValue($object, 'publicAccessor[value2]')); $this->assertSame(array('value1' => 'foo', 'value2' => 'baz'), $object->getPublicAccessor()); } + + /** + * @expectedException \Symfony\Component\PropertyAccess\Exception\InvalidArgumentException + * @expectedExceptionMessage Expected argument of type "Countable", "string" given + */ + public function testThrowTypeErrorWithInterface() + { + $object = new TypeHinted(); + + $this->propertyAccessor->setValue($object, 'countable', 'This is a string, \Countable expected.'); + } } From 428814b25ddd7b0bfbf56d0f4cc3879c3e9bc793 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 26 Jan 2017 11:48:39 +0100 Subject: [PATCH 37/61] clarify exception when no args are configured --- .../Component/DependencyInjection/Definition.php | 4 ++++ .../DependencyInjection/Tests/DefinitionTest.php | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 4f2ee304adad2..49e4e1b0e29c4 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -302,6 +302,10 @@ public function addArgument($argument) */ public function replaceArgument($index, $argument) { + if (0 === count($this->arguments)) { + throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.'); + } + if ($index < 0 || $index > count($this->arguments) - 1) { throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1)); } diff --git a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php index 3439a5912384a..0d3cb8a000bfd 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php @@ -232,6 +232,7 @@ public function testGetArgumentShouldCheckBounds() /** * @expectedException \OutOfBoundsException + * @expectedExceptionMessage The index "1" is not in the range [0, 0]. */ public function testReplaceArgumentShouldCheckBounds() { @@ -241,6 +242,16 @@ public function testReplaceArgumentShouldCheckBounds() $def->replaceArgument(1, 'bar'); } + /** + * @expectedException \OutOfBoundsException + * @expectedExceptionMessage Cannot replace arguments if none have been configured yet. + */ + public function testReplaceArgumentWithoutExistingArgumentsShouldCheckBounds() + { + $def = new Definition('stdClass'); + $def->replaceArgument(0, 'bar'); + } + public function testSetGetProperties() { $def = new Definition('stdClass'); From 1e3421d6f03325ef805f5d11c714982b70d6c06f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 27 Jan 2017 10:10:43 +0100 Subject: [PATCH 38/61] always check for all fields to be mapped --- .../Constraints/UniqueEntityValidatorTest.php | 17 +++++++++++++++++ .../Constraints/UniqueEntityValidator.php | 14 +++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php index 348b46ddaa75e..39a251c33d7bb 100644 --- a/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php +++ b/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php @@ -244,6 +244,23 @@ public function testValidateUniquenessWithIgnoreNull() ->assertRaised(); } + /** + * @expectedException \Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testAllConfiguredFieldsAreCheckedOfBeingMappedByDoctrineWithIgnoreNullEnabled() + { + $constraint = new UniqueEntity(array( + 'message' => 'myMessage', + 'fields' => array('name', 'name2'), + 'em' => self::EM_NAME, + 'ignoreNull' => true, + )); + + $entity1 = new SingleIntIdEntity(1, null); + + $this->validator->validate($entity1, $constraint); + } + public function testValidateUniquenessWithValidCustomErrorPath() { $constraint = new UniqueEntity(array( diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index f4c8671abae9a..61aef64ed8059 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -85,12 +85,14 @@ public function validate($entity, Constraint $constraint) throw new ConstraintDefinitionException(sprintf('The field "%s" is not mapped by Doctrine, so it cannot be validated for uniqueness.', $fieldName)); } - $criteria[$fieldName] = $class->reflFields[$fieldName]->getValue($entity); + $fieldValue = $class->reflFields[$fieldName]->getValue($entity); - if ($constraint->ignoreNull && null === $criteria[$fieldName]) { - return; + if ($constraint->ignoreNull && null === $fieldValue) { + continue; } + $criteria[$fieldName] = $fieldValue; + if (null !== $criteria[$fieldName] && $class->hasAssociation($fieldName)) { /* Ensure the Proxy is initialized before using reflection to * read its identifiers. This is necessary because the wrapped @@ -100,6 +102,12 @@ public function validate($entity, Constraint $constraint) } } + // skip validation if there are no criteria (this can happen when the + // "ignoreNull" option is enabled and fields to be checked are null + if (empty($criteria)) { + return; + } + $repository = $em->getRepository(get_class($entity)); $result = $repository->{$constraint->repositoryMethod}($criteria); From bd0c206a32d6c4951c8bf02c23a1f3a1842797e6 Mon Sep 17 00:00:00 2001 From: Alessandro Lai Date: Fri, 27 Jan 2017 15:42:16 +0100 Subject: [PATCH 39/61] Add missing pieces in the upgrade guide to 3.0 --- UPGRADE-3.0.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 467c13e6448ca..7e48c1f98748e 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -1,6 +1,35 @@ UPGRADE FROM 2.x to 3.0 ======================= +# Table of Contents + +- [ClassLoader](#classloader) +- [Config](#config) +- [Console](#console) +- [DependencyInjection](#dependencyinjection) +- [DoctrineBridge](#doctrinebridge) +- [DomCrawler](#domcrawler) +- [EventDispatcher](#eventdispatcher) +- [Form](#form) +- [FrameworkBundle](#frameworkbundle) +- [HttpFoundation](#httpfoundation) +- [HttpKernel](#httpkernel) +- [Locale](#locale) +- [Monolog Bridge](#monolog-bridge) +- [Process](#process) +- [PropertyAccess](#propertyaccess) +- [Routing](#routing) +- [Security](#security) +- [SecurityBundle](#securitybundle) +- [Serializer](#serializer) +- [Swiftmailer Bridge](#swiftmailer-bridge) +- [Translator](#translator) +- [Twig Bridge](#twig-bridge) +- [TwigBundle](#twigbundle) +- [Validator](#validator) +- [WebProfiler](#webprofiler) +- [Yaml](#yaml) + ### ClassLoader * The `UniversalClassLoader` class has been removed in favor of @@ -1131,3 +1160,10 @@ UPGRADE FROM 2.x to 3.0 * `Process::setStdin()` and `Process::getStdin()` have been removed. Use `Process::setInput()` and `Process::getInput()` that works the same way. * `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types. + +### Monolog Bridge + + * `Symfony\Bridge\Monolog\Logger::emerg()` was removed. Use `emergency()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::crit()` was removed. Use `critical()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::err()` was removed. Use `error()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::warn()` was removed. Use `warning()` which is PSR-3 compatible. From 50373f3530e302f04508d4567f02cb968cad26a4 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Fri, 27 Jan 2017 19:52:37 +0100 Subject: [PATCH 40/61] [Console] Fix TableCell issues with decoration --- .../Component/Console/Helper/Table.php | 2 +- .../Console/Tests/Helper/TableTest.php | 45 +++++++++++++++---- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index 904c04b6822a7..289d1a11da457 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -518,7 +518,7 @@ private function getColumnWidth($column) foreach ($row as $i => $cell) { if ($cell instanceof TableCell) { - $textLength = strlen($cell); + $textLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell); if ($textLength > 0) { $contentColumns = str_split($cell, ceil($textLength / $cell->getColspan())); foreach ($contentColumns as $position => $content) { diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index a691405c6b30f..583777b3ca7f8 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -35,9 +35,9 @@ protected function tearDown() /** * @dataProvider testRenderProvider */ - public function testRender($headers, $rows, $style, $expected) + public function testRender($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->setRows($rows) @@ -51,9 +51,9 @@ public function testRender($headers, $rows, $style, $expected) /** * @dataProvider testRenderProvider */ - public function testRenderAddRows($headers, $rows, $style, $expected) + public function testRenderAddRows($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->addRows($rows) @@ -67,9 +67,9 @@ public function testRenderAddRows($headers, $rows, $style, $expected) /** * @dataProvider testRenderProvider */ - public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected) + public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $decorated = false) { - $table = new Table($output = $this->getOutputStream()); + $table = new Table($output = $this->getOutputStream($decorated)); $table ->setHeaders($headers) ->setStyle($style) @@ -485,6 +485,35 @@ public function testRenderProvider() TABLE ), + 'Coslpan and table cells with comment style' => array( + array( + new TableCell('Long Title', array('colspan' => 3)), + ), + array( + array( + new TableCell('9971-5-0210-0', array('colspan' => 3)), + ), + new TableSeparator(), + array( + 'Dante Alighieri', + 'J. R. R. Tolkien', + 'J. R. R', + ), + ), + 'default', + <<stream, StreamOutput::VERBOSITY_NORMAL, false); + return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); } protected function getOutputContent(StreamOutput $output) From 4b5930ca442a68434432de28bc6d1a83224a55e1 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Jan 2017 16:19:36 -0800 Subject: [PATCH 41/61] fixed composer.json --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index cdb4f684f4ace..d661f1b03e6ef 100644 --- a/composer.json +++ b/composer.json @@ -87,11 +87,11 @@ "ocramius/proxy-manager": "~0.4|~1.0|~2.0", "symfony/phpunit-bridge": "~3.2", "egulias/email-validator": "~1.2,>=1.2.1", - "phpdocumentor/reflection": "^1.0.7" + "phpdocumentor/reflection": "^1.0.7", + "sensio/framework-extra-bundle": "^3.0.2" }, "conflict": { "phpdocumentor/reflection": "<1.0.7", - "sensio/framework-extra-bundle": "^3.0.2" }, "autoload": { "psr-4": { From 137a7748d6b45ebd5b1e6b9e794e8cd4e746713f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Fri, 27 Jan 2017 17:00:17 -0800 Subject: [PATCH 42/61] fixed typo --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d661f1b03e6ef..e1e29ddbbfe0d 100644 --- a/composer.json +++ b/composer.json @@ -91,7 +91,7 @@ "sensio/framework-extra-bundle": "^3.0.2" }, "conflict": { - "phpdocumentor/reflection": "<1.0.7", + "phpdocumentor/reflection": "<1.0.7" }, "autoload": { "psr-4": { From c7593457816db80980b9f6234dd74edbfe3a0b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Thu, 19 Jan 2017 10:04:09 +0100 Subject: [PATCH 43/61] [FrameworkBundle] Remove useless checks in descriptors --- .../Console/Descriptor/JsonDescriptor.php | 35 +++++----------- .../Console/Descriptor/MarkdownDescriptor.php | 24 ++++------- .../Console/Descriptor/TextDescriptor.php | 23 +++------- .../Console/Descriptor/XmlDescriptor.php | 42 +++++++------------ 4 files changed, 38 insertions(+), 86 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php index d22ebcd181785..a6167b9a48aa9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/JsonDescriptor.php @@ -217,29 +217,18 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = 'public' => $definition->isPublic(), 'synthetic' => $definition->isSynthetic(), 'lazy' => $definition->isLazy(), + 'shared' => $definition->isShared(), + 'synchronized' => $definition->isSynchronized(false), + 'abstract' => $definition->isAbstract(), + 'autowire' => $definition->isAutowired(), + 'autowiring_types' => array(), + 'file' => $definition->getFile(), ); - if (method_exists($definition, 'isShared')) { - $data['shared'] = $definition->isShared(); + foreach ($definition->getAutowiringTypes() as $autowiringType) { + $data['autowiring_types'][] = $autowiringType; } - if (method_exists($definition, 'isSynchronized')) { - $data['synchronized'] = $definition->isSynchronized(false); - } - - $data['abstract'] = $definition->isAbstract(); - - if (method_exists($definition, 'isAutowired')) { - $data['autowire'] = $definition->isAutowired(); - - $data['autowiring_types'] = array(); - foreach ($definition->getAutowiringTypes() as $autowiringType) { - $data['autowiring_types'][] = $autowiringType; - } - } - - $data['file'] = $definition->getFile(); - if ($definition->getFactoryClass(false)) { $data['factory_class'] = $definition->getFactoryClass(false); } @@ -269,11 +258,9 @@ private function getContainerDefinitionData(Definition $definition, $omitTags = if (!$omitTags) { $data['tags'] = array(); - if (count($definition->getTags())) { - foreach ($definition->getTags() as $tagName => $tagData) { - foreach ($tagData as $parameters) { - $data['tags'][] = array('name' => $tagName, 'parameters' => $parameters); - } + foreach ($definition->getTags() as $tagName => $tagData) { + foreach ($tagData as $parameters) { + $data['tags'][] = array('name' => $tagName, 'parameters' => $parameters); } } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php index 4795331d0f653..d9d3278842eff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/MarkdownDescriptor.php @@ -183,24 +183,14 @@ protected function describeContainerDefinition(Definition $definition, array $op ."\n".'- Public: '.($definition->isPublic() ? 'yes' : 'no') ."\n".'- Synthetic: '.($definition->isSynthetic() ? 'yes' : 'no') ."\n".'- Lazy: '.($definition->isLazy() ? 'yes' : 'no') + ."\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no') + ."\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no') + ."\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no') + ."\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no') ; - if (method_exists($definition, 'isShared')) { - $output .= "\n".'- Shared: '.($definition->isShared() ? 'yes' : 'no'); - } - - if (method_exists($definition, 'isSynchronized')) { - $output .= "\n".'- Synchronized: '.($definition->isSynchronized(false) ? 'yes' : 'no'); - } - - $output .= "\n".'- Abstract: '.($definition->isAbstract() ? 'yes' : 'no'); - - if (method_exists($definition, 'isAutowired')) { - $output .= "\n".'- Autowired: '.($definition->isAutowired() ? 'yes' : 'no'); - - foreach ($definition->getAutowiringTypes() as $autowiringType) { - $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; - } + foreach ($definition->getAutowiringTypes() as $autowiringType) { + $output .= "\n".'- Autowiring Type: `'.$autowiringType.'`'; } if ($definition->getFile()) { @@ -371,7 +361,7 @@ protected function describeCallable($callable, array $options = array()) */ private function formatRouterConfig(array $array) { - if (!count($array)) { + if (!$array) { return 'NONE'; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php index 4aa00a85dbb17..1b35f8c565fff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php @@ -255,8 +255,7 @@ protected function describeContainerDefinition(Definition $definition, array $op $tableRows[] = array('Service ID', isset($options['id']) ? $options['id'] : '-'); $tableRows[] = array('Class', $definition->getClass() ?: '-'); - $tags = $definition->getTags(); - if (count($tags)) { + if ($tags = $definition->getTags()) { $tagInformation = ''; foreach ($tags as $tagName => $tagData) { foreach ($tagData as $tagParameters) { @@ -281,24 +280,12 @@ protected function describeContainerDefinition(Definition $definition, array $op $tableRows[] = array('Public', $definition->isPublic() ? 'yes' : 'no'); $tableRows[] = array('Synthetic', $definition->isSynthetic() ? 'yes' : 'no'); $tableRows[] = array('Lazy', $definition->isLazy() ? 'yes' : 'no'); - - if (method_exists($definition, 'isSynchronized')) { - $tableRows[] = array('Synchronized', $definition->isSynchronized(false) ? 'yes' : 'no'); - } + $tableRows[] = array('Synchronized', $definition->isSynchronized(false) ? 'yes' : 'no'); $tableRows[] = array('Abstract', $definition->isAbstract() ? 'yes' : 'no'); + $tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no'); - if (method_exists($definition, 'isAutowired')) { - $tableRows[] = array('Autowired', $definition->isAutowired() ? 'yes' : 'no'); - - $autowiringTypes = $definition->getAutowiringTypes(); - if (count($autowiringTypes)) { - $autowiringTypesInformation = implode(', ', $autowiringTypes); - } else { - $autowiringTypesInformation = '-'; - } - - $tableRows[] = array('Autowiring Types', $autowiringTypesInformation); - } + $autowiringTypes = $definition->getAutowiringTypes(); + $tableRows[] = array('Autowiring Types', $autowiringTypes ? implode(', ', $autowiringTypes) : '-'); if ($definition->getFile()) { $tableRows[] = array('Required File', $definition->getFile() ? $definition->getFile() : '-'); diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php index 62fb688e3c06f..0f0533573d4c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/XmlDescriptor.php @@ -187,7 +187,7 @@ private function getRouteDocument(Route $route, $name = null) $methodXML->appendChild(new \DOMText($method)); } - if (count($route->getDefaults())) { + if ($route->getDefaults()) { $routeXML->appendChild($defaultsXML = $dom->createElement('defaults')); foreach ($route->getDefaults() as $attribute => $value) { $defaultsXML->appendChild($defaultXML = $dom->createElement('default')); @@ -198,7 +198,7 @@ private function getRouteDocument(Route $route, $name = null) $requirements = $route->getRequirements(); unset($requirements['_scheme'], $requirements['_method']); - if (count($requirements)) { + if ($requirements) { $routeXML->appendChild($requirementsXML = $dom->createElement('requirements')); foreach ($requirements as $attribute => $pattern) { $requirementsXML->appendChild($requirementXML = $dom->createElement('requirement')); @@ -207,7 +207,7 @@ private function getRouteDocument(Route $route, $name = null) } } - if (count($route->getOptions())) { + if ($route->getOptions()) { $routeXML->appendChild($optionsXML = $dom->createElement('options')); foreach ($route->getOptions() as $name => $value) { $optionsXML->appendChild($optionXML = $dom->createElement('option')); @@ -331,18 +331,16 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu $serviceXML->setAttribute('class', $definition->getClass()); - if (method_exists($definition, 'getFactoryMethod')) { - if ($definition->getFactoryClass(false)) { - $serviceXML->setAttribute('factory-class', $definition->getFactoryClass(false)); - } + if ($definition->getFactoryClass(false)) { + $serviceXML->setAttribute('factory-class', $definition->getFactoryClass(false)); + } - if ($definition->getFactoryService(false)) { - $serviceXML->setAttribute('factory-service', $definition->getFactoryService(false)); - } + if ($definition->getFactoryService(false)) { + $serviceXML->setAttribute('factory-service', $definition->getFactoryService(false)); + } - if ($definition->getFactoryMethod(false)) { - $serviceXML->setAttribute('factory-method', $definition->getFactoryMethod(false)); - } + if ($definition->getFactoryMethod(false)) { + $serviceXML->setAttribute('factory-method', $definition->getFactoryMethod(false)); } if ($factory = $definition->getFactory()) { @@ -366,24 +364,14 @@ private function getContainerDefinitionDocument(Definition $definition, $id = nu $serviceXML->setAttribute('public', $definition->isPublic() ? 'true' : 'false'); $serviceXML->setAttribute('synthetic', $definition->isSynthetic() ? 'true' : 'false'); $serviceXML->setAttribute('lazy', $definition->isLazy() ? 'true' : 'false'); - if (method_exists($definition, 'isShared')) { - $serviceXML->setAttribute('shared', $definition->isShared() ? 'true' : 'false'); - } - if (method_exists($definition, 'isSynchronized')) { - $serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false'); - } + $serviceXML->setAttribute('shared', $definition->isShared() ? 'true' : 'false'); + $serviceXML->setAttribute('synchronized', $definition->isSynchronized(false) ? 'true' : 'false'); $serviceXML->setAttribute('abstract', $definition->isAbstract() ? 'true' : 'false'); - - if (method_exists($definition, 'isAutowired')) { - $serviceXML->setAttribute('autowired', $definition->isAutowired() ? 'true' : 'false'); - } - + $serviceXML->setAttribute('autowired', $definition->isAutowired() ? 'true' : 'false'); $serviceXML->setAttribute('file', $definition->getFile()); if (!$omitTags) { - $tags = $definition->getTags(); - - if (count($tags) > 0) { + if ($tags = $definition->getTags()) { $serviceXML->appendChild($tagsXML = $dom->createElement('tags')); foreach ($tags as $tagName => $tagData) { foreach ($tagData as $parameters) { From 2bc4d3b2c17d53a1f8db6945109811373151250c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Sat, 28 Jan 2017 17:23:55 +0100 Subject: [PATCH 44/61] [TwigBundle] Fix the name of the cache warming test class --- .../Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php index b51e619a9d285..5c4126cfe7233 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/Functional/CacheWarmingTest.php @@ -17,7 +17,7 @@ use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\TwigBundle\TwigBundle; -class NewCacheWamingTest extends \PHPUnit_Framework_TestCase +class CacheWarmingTest extends \PHPUnit_Framework_TestCase { public function testCacheIsProperlyWarmedWhenTemplatingIsAvailable() { From f19788dd2ec1581beefec8c5d25a75f0e8c083c5 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 30 Jan 2017 15:00:07 +0100 Subject: [PATCH 45/61] ignore invalid cookies expires date format --- src/Symfony/Component/BrowserKit/Cookie.php | 2 -- src/Symfony/Component/BrowserKit/Tests/CookieTest.php | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php index 7e855bf351dad..42f184d532e02 100644 --- a/src/Symfony/Component/BrowserKit/Cookie.php +++ b/src/Symfony/Component/BrowserKit/Cookie.php @@ -213,8 +213,6 @@ private static function parseDate($dateValue) if (false !== $date = date_create($dateValue, new \DateTimeZone('GMT'))) { return $date->format('U'); } - - throw new \InvalidArgumentException(sprintf('Could not parse date "%s".', $dateValue)); } /** diff --git a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php index 5a724333d350f..4722de6d7b04c 100644 --- a/src/Symfony/Component/BrowserKit/Tests/CookieTest.php +++ b/src/Symfony/Component/BrowserKit/Tests/CookieTest.php @@ -88,10 +88,11 @@ public function testFromStringThrowsAnExceptionIfCookieIsNotValid() Cookie::fromString('foo'); } - public function testFromStringThrowsAnExceptionIfCookieDateIsNotValid() + public function testFromStringIgnoresInvalidExpiresDate() { - $this->setExpectedException('InvalidArgumentException'); - Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + $cookie = Cookie::fromString('foo=bar; expires=Flursday July 31st 2020, 08:49:37 GMT'); + + $this->assertFalse($cookie->isExpired()); } public function testFromStringThrowsAnExceptionIfUrlIsNotValid() From 5cd7931c24ad9ad0794440c106271a5bb8d4551b Mon Sep 17 00:00:00 2001 From: Josip Kruslin Date: Sun, 29 Jan 2017 12:09:34 +0100 Subject: [PATCH 46/61] [validator] Updated croatian translation --- .../Resources/translations/validators.hr.xlf | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index a11e825ccadad..8c62d899fdaec 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -278,6 +278,42 @@ This value should not be identical to {{ compared_value_type }} {{ compared_value }}. Ova vrijednost ne bi trebala biti {{ compared_value_type }} {{ compared_value }}. + + The image ratio is too big ({{ ratio }}). Allowed maximum ratio is {{ max_ratio }}. + Omjer slike je prevelik ({{ ratio }}). Dozvoljeni maksimalni omjer je {{ max_ratio }}. + + + The image ratio is too small ({{ ratio }}). Minimum ratio expected is {{ min_ratio }}. + Omjer slike je premali ({{ ratio }}). Minimalni očekivani omjer je {{ min_ratio }}. + + + The image is square ({{ width }}x{{ height }}px). Square images are not allowed. + Slika je kvadratnog oblika ({{ width }}x{{ height }}px). Kvadratne slike nisu dozvoljene. + + + The image is landscape oriented ({{ width }}x{{ height }}px). Landscape oriented images are not allowed. + Slika je orijentirana horizontalno ({{ width }}x{{ height }}px). Horizontalno orijentirane slike nisu dozvoljene. + + + The image is portrait oriented ({{ width }}x{{ height }}px). Portrait oriented images are not allowed. + Slika je orijentirana vertikalno ({{ width }}x{{ height }}px). Vertikalno orijentirane slike nisu dozvoljene. + + + An empty file is not allowed. + Prazna datoteka nije dozvoljena. + + + The host could not be resolved. + Poslužitelj nije mogao biti razriješen. + + + This value does not match the expected {{ charset }} charset. + Znakovne oznake vrijednosti ne odgovaraju očekivanom {{ charset }} skupu. + + + This is not a valid Business Identifier Code (BIC). + Ovo nije validan poslovni identifikacijski broj (BIC). + From 0425e0549bbea67714b48218b615516253db065c Mon Sep 17 00:00:00 2001 From: Guilhem N Date: Sat, 21 Jan 2017 21:06:56 +0100 Subject: [PATCH 47/61] [FrameworkBundle] Execute the PhpDocExtractor earlier --- .../Resources/config/property_info.xml | 2 +- .../Tests/Functional/PropertyInfoTest.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml index 33a0a661f8991..8f6a7c9e31bed 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/property_info.xml @@ -15,7 +15,7 @@ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php new file mode 100644 index 0000000000000..899de60ca0b1c --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\FrameworkBundle\Tests\Functional; + +use Symfony\Component\PropertyInfo\Type; + +class PropertyInfoTest extends WebTestCase +{ + public function testPhpDocPriority() + { + static::bootKernel(array('test_case' => 'Serializer')); + $container = static::$kernel->getContainer(); + + $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes(Dummy::class, 'codes')); + } +} + +class Dummy +{ + /** + * @param int[] $codes + */ + public function setCodes(array $codes) + { + } +} From ee4b3e2712c5eeb456f9697b8c9e27309c3d8b18 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Tue, 31 Jan 2017 16:58:35 +0100 Subject: [PATCH 48/61] [Console] Fix too strict test --- .../Component/Console/Tests/Helper/ProcessHelperTest.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php index 1dcddf8badd49..b0d7f9c2f6f4c 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProcessHelperTest.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Helper\ProcessHelper; use Symfony\Component\Process\Process; +use Symfony\Component\Process\ProcessBuilder; class ProcessHelperTest extends \PHPUnit_Framework_TestCase { @@ -83,9 +84,9 @@ public function provideCommandsAndOutput() EOT; $errorMessage = 'An error occurred'; - if ('\\' === DIRECTORY_SEPARATOR) { - $successOutputProcessDebug = str_replace("'", '"', $successOutputProcessDebug); - } + $args = new ProcessBuilder(array('php', '-r', 'echo 42;')); + $args = $args->getProcess()->getCommandLine(); + $successOutputProcessDebug = str_replace("'php' '-r' 'echo 42;'", $args, $successOutputProcessDebug); return array( array('', 'php -r "echo 42;"', StreamOutput::VERBOSITY_VERBOSE, null), From 24243ace895933b2342f4f1bb85befa23ce05893 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 1 Feb 2017 10:44:58 +0100 Subject: [PATCH 49/61] add missing functional Serializer test case --- .../Tests/Functional/PropertyInfoTest.php | 2 +- .../Tests/Functional/app/Serializer/bundles.php | 16 ++++++++++++++++ .../Tests/Functional/app/Serializer/config.yml | 6 ++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php index 899de60ca0b1c..c02a6b84e519c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/PropertyInfoTest.php @@ -20,7 +20,7 @@ public function testPhpDocPriority() static::bootKernel(array('test_case' => 'Serializer')); $container = static::$kernel->getContainer(); - $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes(Dummy::class, 'codes')); + $this->assertEquals(array(new Type(Type::BUILTIN_TYPE_ARRAY, false, null, true, new Type(Type::BUILTIN_TYPE_INT), new Type(Type::BUILTIN_TYPE_INT))), $container->get('property_info')->getTypes('Symfony\Bundle\FrameworkBundle\Tests\Functional\Dummy', 'codes')); } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php new file mode 100644 index 0000000000000..144db90236034 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/bundles.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Bundle\FrameworkBundle\FrameworkBundle; + +return array( + new FrameworkBundle(), +); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml new file mode 100644 index 0000000000000..cac135c315d00 --- /dev/null +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Serializer/config.yml @@ -0,0 +1,6 @@ +imports: + - { resource: ../config/default.yml } + +framework: + serializer: { enabled: true } + property_info: { enabled: true } From 89e0088c577a0891b7c623e369644afd41246f46 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 1 Feb 2017 13:47:47 +0100 Subject: [PATCH 50/61] Enable dump() in autoload-dev --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 2d7b451159758..c88ca4563c73e 100644 --- a/composer.json +++ b/composer.json @@ -101,6 +101,9 @@ "**/Tests/" ] }, + "autoload-dev": { + "files": [ "src/Symfony/Component/VarDumper/Resources/functions/dump.php" ] + }, "minimum-stability": "dev", "extra": { "branch-alias": { From 08dd70b507837e9071e245d95c2c50e3dab9849a Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Wed, 1 Feb 2017 19:43:31 +0100 Subject: [PATCH 51/61] [FrameworkBundle][Console] JsonDescriptor: Respect original output --- .../Tests/Fixtures/Descriptor/builder_1_public.json | 4 +--- .../Fixtures/Descriptor/builder_1_services.json | 8 ++------ .../Tests/Fixtures/Descriptor/builder_1_tag1.json | 12 +++--------- .../Tests/Fixtures/Descriptor/definition_1.json | 4 +--- .../Tests/Fixtures/Descriptor/definition_2.json | 4 +--- .../Tests/Fixtures/Descriptor/route_2.json | 4 +--- .../Fixtures/Descriptor/route_collection_1.json | 4 +--- 7 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json index 047f4e8c16a48..5c2038df42c91 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json @@ -11,9 +11,7 @@ "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [ - - ] + "tags": [] } }, "aliases": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json index 3397fd67acd6e..6dc56b3e2335b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json @@ -11,9 +11,7 @@ "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [ - - ] + "tags": [] }, "definition_2": { "class": "Full\\Qualified\\Class2", @@ -42,9 +40,7 @@ }, { "name": "tag2", - "parameters": [ - - ] + "parameters": [] } ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json index 53bf114e81e04..af2c1044d0ed0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json @@ -27,17 +27,11 @@ }, { "name": "tag2", - "parameters": [ - - ] + "parameters": [] } ] } }, - "aliases": [ - - ], - "services": [ - - ] + "aliases": [], + "services": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json index 8de781dfc45a5..c15b4a6d29060 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json @@ -9,7 +9,5 @@ "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [ - - ] + "tags": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json index 9d58434c17e1b..62bcac9031f60 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json @@ -25,9 +25,7 @@ }, { "name": "tag2", - "parameters": [ - - ] + "parameters": [] } ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json index d34b3a77aec6e..58caf26d537e7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_2.json @@ -6,9 +6,7 @@ "scheme": "http|https", "method": "PUT|POST", "class": "Symfony\\Component\\Routing\\Route", - "defaults": [ - - ], + "defaults": [], "requirements": "NO CUSTOM", "options": { "compiler_class": "Symfony\\Component\\Routing\\RouteCompiler", diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json index 7170953f5fee7..350bffdb3a9c7 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/route_collection_1.json @@ -27,9 +27,7 @@ "scheme": "http|https", "method": "PUT|POST", "class": "Symfony\\Component\\Routing\\Route", - "defaults": [ - - ], + "defaults": [], "requirements": "NO CUSTOM", "options": { "compiler_class": "Symfony\\Component\\Routing\\RouteCompiler", From 8e6cfa0cefb5aa575206371cee9a86e0f129b136 Mon Sep 17 00:00:00 2001 From: Pavel Batanov Date: Thu, 2 Feb 2017 08:03:53 +0300 Subject: [PATCH 52/61] Fix phpDoc typo --- src/Symfony/Component/PropertyAccess/PropertyAccess.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccess.php b/src/Symfony/Component/PropertyAccess/PropertyAccess.php index 21b926e8282d4..8d36db2666539 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccess.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccess.php @@ -31,7 +31,7 @@ public static function createPropertyAccessor() /** * Creates a property accessor builder. * - * @return PropertyAccessor + * @return PropertyAccessorBuilder */ public static function createPropertyAccessorBuilder() { From b46276e9b240acd510a04db7fea27dca921e679a Mon Sep 17 00:00:00 2001 From: Pascal Hofmann Date: Wed, 1 Feb 2017 16:02:20 +0100 Subject: [PATCH 53/61] Add HEADER_FORWARDED to setTrustedHeaderName docs --- src/Symfony/Component/HttpFoundation/Request.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index e63ee755bb87f..697bc6c3c3e13 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -596,6 +596,7 @@ public static function getTrustedHosts() * * Request::HEADER_CLIENT_HOST: defaults to X-Forwarded-Host (see getHost()) * * Request::HEADER_CLIENT_PORT: defaults to X-Forwarded-Port (see getPort()) * * Request::HEADER_CLIENT_PROTO: defaults to X-Forwarded-Proto (see getScheme() and isSecure()) + * * Request::HEADER_FORWARDED: defaults to Forwarded (see RFC 7239) * * Setting an empty value allows to disable the trusted header for the given key. * From 3779f3fbb98db5fd1647fa8e2af84a05adb1c7a0 Mon Sep 17 00:00:00 2001 From: GuillaumeVerdon Date: Wed, 1 Feb 2017 10:32:26 +0100 Subject: [PATCH 54/61] [Process] Non ASCII characters disappearing during the escapeshellarg --- src/Symfony/Component/Process/ProcessUtils.php | 2 +- src/Symfony/Component/Process/Tests/ProcessUtilsTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Process/ProcessUtils.php b/src/Symfony/Component/Process/ProcessUtils.php index 0bd2f6b772f6f..c0fd9c12dba5a 100644 --- a/src/Symfony/Component/Process/ProcessUtils.php +++ b/src/Symfony/Component/Process/ProcessUtils.php @@ -71,7 +71,7 @@ public static function escapeArgument($argument) return $escapedArgument; } - return escapeshellarg($argument); + return "'".str_replace("'", "'\\''", $argument)."'"; } /** diff --git a/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php b/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php index e6564cde5ba6d..0f554b6151801 100644 --- a/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php +++ b/src/Symfony/Component/Process/Tests/ProcessUtilsTest.php @@ -43,6 +43,7 @@ public function dataArguments() array("'<|>\" \"'\\''f'", '<|>" "\'f'), array("''", ''), array("'with\\trailingbs\\'", 'with\trailingbs\\'), + array("'withNonAsciiAccentLikeéÉèÈàÀöä'", 'withNonAsciiAccentLikeéÉèÈàÀöä'), ); } } From bf71776e20dc85dd148904a1c319dbf9d6f8ec59 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Thu, 2 Feb 2017 18:43:33 +0100 Subject: [PATCH 55/61] [FrameworkBundle][Console] JsonDescriptor: Respect original output --- .../Fixtures/Descriptor/builder_1_public.json | 6 +- .../Descriptor/builder_1_services.json | 12 ++-- .../Fixtures/Descriptor/builder_1_tag1.json | 6 +- .../Fixtures/Descriptor/builder_1_tags.json | 12 ++-- .../Fixtures/Descriptor/definition_1.json | 6 +- .../Fixtures/Descriptor/definition_2.json | 6 +- ...acy_synchronized_service_definition_1.json | 28 ++++---- ...acy_synchronized_service_definition_2.json | 64 +++++++++---------- 8 files changed, 70 insertions(+), 70 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json index 571afc2d16f6e..4ce716e640d2e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_public.json @@ -9,12 +9,12 @@ "shared": true, "synchronized": false, "abstract": true, + "autowire": false, + "autowiring_types": [], "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "tags": [] } }, "aliases": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json index df9c767c2c7ea..e979c42f041cc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_services.json @@ -9,12 +9,12 @@ "shared": true, "synchronized": false, "abstract": true, + "autowire": false, + "autowiring_types": [], "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "tags": [] }, "definition_2": { "class": "Full\\Qualified\\Class2", @@ -25,6 +25,8 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", "factory_method": "get", @@ -46,9 +48,7 @@ "name": "tag2", "parameters": [] } - ], - "autowire": false, - "autowiring_types": [] + ] } }, "aliases": { diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json index 766f6be6d1114..e0aa26b6708c6 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tag1.json @@ -9,6 +9,8 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", "factory_method": "get", @@ -30,9 +32,7 @@ "name": "tag2", "parameters": [] } - ], - "autowire": false, - "autowiring_types": [] + ] } }, "aliases": [], diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json index b1b1fa81485a9..736b099f7d430 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/builder_1_tags.json @@ -9,11 +9,11 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", - "factory_method": "get", - "autowire": false, - "autowiring_types": [] + "factory_method": "get" } ], "tag2": [ @@ -26,11 +26,11 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", - "factory_method": "get", - "autowire": false, - "autowiring_types": [] + "factory_method": "get" } ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json index d25bf1d7f4b81..0056b4353abf3 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_1.json @@ -7,10 +7,10 @@ "shared": true, "synchronized": false, "abstract": true, + "autowire": false, + "autowiring_types": [], "file": null, "factory_class": "Full\\Qualified\\FactoryClass", "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "tags": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json index 127614f071ec0..1b465f270e2e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/definition_2.json @@ -7,6 +7,8 @@ "shared": true, "synchronized": false, "abstract": false, + "autowire": false, + "autowiring_types": [], "file": "\/path\/to\/file", "factory_service": "factory.service", "factory_method": "get", @@ -28,7 +30,5 @@ "name": "tag2", "parameters": [] } - ], - "autowire": false, - "autowiring_types": [] + ] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json index 06292f2c2f89f..730b81f3a87d0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_1.json @@ -1,16 +1,16 @@ { - "class": "Full\\Qualified\\Class1", - "scope": "container", - "public": true, - "synthetic": false, - "lazy": true, - "shared": true, - "synchronized": true, - "abstract": true, - "file": null, - "factory_class": "Full\\Qualified\\FactoryClass", - "factory_method": "get", - "tags": [], - "autowire": false, - "autowiring_types": [] + "class": "Full\\Qualified\\Class1", + "scope": "container", + "public": true, + "synthetic": false, + "lazy": true, + "shared": true, + "synchronized": true, + "abstract": true, + "autowire": false, + "autowiring_types": [], + "file": null, + "factory_class": "Full\\Qualified\\FactoryClass", + "factory_method": "get", + "tags": [] } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json index 9e98bdd2183aa..1b465f270e2e9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Descriptor/legacy_synchronized_service_definition_2.json @@ -1,34 +1,34 @@ { - "class": "Full\\Qualified\\Class2", - "scope": "container", - "public": false, - "synthetic": true, - "lazy": false, - "shared": true, - "synchronized": false, - "abstract": false, - "file": "\/path\/to\/file", - "factory_service": "factory.service", - "factory_method": "get", - "tags": [ - { - "name": "tag1", - "parameters": { - "attr1": "val1", - "attr2": "val2" - } - }, - { - "name": "tag1", - "parameters": { - "attr3": "val3" - } - }, - { - "name": "tag2", - "parameters": [] - } - ], - "autowire": false, - "autowiring_types": [] + "class": "Full\\Qualified\\Class2", + "scope": "container", + "public": false, + "synthetic": true, + "lazy": false, + "shared": true, + "synchronized": false, + "abstract": false, + "autowire": false, + "autowiring_types": [], + "file": "\/path\/to\/file", + "factory_service": "factory.service", + "factory_method": "get", + "tags": [ + { + "name": "tag1", + "parameters": { + "attr1": "val1", + "attr2": "val2" + } + }, + { + "name": "tag1", + "parameters": { + "attr3": "val3" + } + }, + { + "name": "tag2", + "parameters": [] + } + ] } From 78c0ec5c136e7a7a4b905256910f71e9312207f7 Mon Sep 17 00:00:00 2001 From: Robin Lehrmann Date: Fri, 20 Jan 2017 14:40:15 +0100 Subject: [PATCH 56/61] [FrameworkBundle] fixed custom domain for translations in php templates --- .../Resources/views/translation.html.php | 16 +++++ .../Tests/Translation/PhpExtractorTest.php | 37 ++++++---- .../Translation/PhpExtractor.php | 67 +++++++++++++++++-- 3 files changed, 102 insertions(+), 18 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php index c0ae6ec5c6604..cb3c763f8f3c8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Fixtures/Resources/views/translation.html.php @@ -31,3 +31,19 @@ 10, array('%count%' => 10) ) ?> + +trans('other-domain-test-no-params-short-array', [], 'not_messages'); ?> + +trans('other-domain-test-no-params-long-array', array(), 'not_messages'); ?> + +trans('other-domain-test-params-short-array', ['foo' => 'bar'], 'not_messages'); ?> + +trans('other-domain-test-params-long-array', array('foo' => 'bar'), 'not_messages'); ?> + +transChoice('other-domain-test-trans-choice-short-array-%count%', 10, ['%count%' => 10], 'not_messages'); ?> + +transChoice('other-domain-test-trans-choice-long-array-%count%', 10, array('%count%' => 10), 'not_messages'); ?> + +trans('typecast', ['a' => (int) '123'], 'not_messages'); ?> +transChoice('msg1', 10 + 1, [], 'not_messages'); ?> +transChoice('msg2', intval(4.5), [], 'not_messages'); ?> diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php index 420d2f2d71dd3..e8c56ee4d5e52 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Translation/PhpExtractorTest.php @@ -39,18 +39,31 @@ public function testExtraction($resource) nowdoc key with whitespace and nonescaped \$\n sequences EOF; // Assert - $expectedCatalogue = array('messages' => array( - 'single-quoted key' => 'prefixsingle-quoted key', - 'double-quoted key' => 'prefixdouble-quoted key', - 'heredoc key' => 'prefixheredoc key', - 'nowdoc key' => 'prefixnowdoc key', - "double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences", - 'single-quoted key with whitespace and nonescaped \$\n\' sequences' => 'prefixsingle-quoted key with whitespace and nonescaped \$\n\' sequences', - 'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"', - $expectedHeredoc => 'prefix'.$expectedHeredoc, - $expectedNowdoc => 'prefix'.$expectedNowdoc, - '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', - )); + $expectedCatalogue = array( + 'messages' => array( + 'single-quoted key' => 'prefixsingle-quoted key', + 'double-quoted key' => 'prefixdouble-quoted key', + 'heredoc key' => 'prefixheredoc key', + 'nowdoc key' => 'prefixnowdoc key', + "double-quoted key with whitespace and escaped \$\n\" sequences" => "prefixdouble-quoted key with whitespace and escaped \$\n\" sequences", + 'single-quoted key with whitespace and nonescaped \$\n\' sequences' => 'prefixsingle-quoted key with whitespace and nonescaped \$\n\' sequences', + 'single-quoted key with "quote mark at the end"' => 'prefixsingle-quoted key with "quote mark at the end"', + $expectedHeredoc => 'prefix'.$expectedHeredoc, + $expectedNowdoc => 'prefix'.$expectedNowdoc, + '{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples' => 'prefix{0} There is no apples|{1} There is one apple|]1,Inf[ There are %count% apples', + ), + 'not_messages' => array( + 'other-domain-test-no-params-short-array' => 'prefixother-domain-test-no-params-short-array', + 'other-domain-test-no-params-long-array' => 'prefixother-domain-test-no-params-long-array', + 'other-domain-test-params-short-array' => 'prefixother-domain-test-params-short-array', + 'other-domain-test-params-long-array' => 'prefixother-domain-test-params-long-array', + 'other-domain-test-trans-choice-short-array-%count%' => 'prefixother-domain-test-trans-choice-short-array-%count%', + 'other-domain-test-trans-choice-long-array-%count%' => 'prefixother-domain-test-trans-choice-long-array-%count%', + 'typecast' => 'prefixtypecast', + 'msg1' => 'prefixmsg1', + 'msg2' => 'prefixmsg2', + ), + ); $actualCatalogue = $catalogue->all(); $this->assertEquals($expectedCatalogue, $actualCatalogue); diff --git a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php index cf7f3c5769bf2..97c94fdd14bf9 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php +++ b/src/Symfony/Bundle/FrameworkBundle/Translation/PhpExtractor.php @@ -24,6 +24,8 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface { const MESSAGE_TOKEN = 300; + const METHOD_ARGUMENTS_TOKEN = 1000; + const DOMAIN_TOKEN = 1001; /** * Prefix for new found message. @@ -38,6 +40,28 @@ class PhpExtractor extends AbstractFileExtractor implements ExtractorInterface * @var array */ protected $sequences = array( + array( + '->', + 'trans', + '(', + self::MESSAGE_TOKEN, + ',', + self::METHOD_ARGUMENTS_TOKEN, + ',', + self::DOMAIN_TOKEN, + ), + array( + '->', + 'transChoice', + '(', + self::MESSAGE_TOKEN, + ',', + self::METHOD_ARGUMENTS_TOKEN, + ',', + self::METHOD_ARGUMENTS_TOKEN, + ',', + self::DOMAIN_TOKEN, + ), array( '->', 'trans', @@ -105,11 +129,32 @@ private function seekToNextRelevantToken(\Iterator $tokenIterator) } } + private function skipMethodArgument(\Iterator $tokenIterator) + { + $openBraces = 0; + + for (; $tokenIterator->valid(); $tokenIterator->next()) { + $t = $tokenIterator->current(); + + if ('[' === $t[0] || '(' === $t[0]) { + ++$openBraces; + } + + if (']' === $t[0] || ')' === $t[0]) { + --$openBraces; + } + + if ((0 === $openBraces && ',' === $t[0]) || (-1 === $openBraces && ')' === $t[0])) { + break; + } + } + } + /** * Extracts the message from the iterator while the tokens * match allowed message tokens. */ - private function getMessage(\Iterator $tokenIterator) + private function getValue(\Iterator $tokenIterator) { $message = ''; $docToken = ''; @@ -155,16 +200,26 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) for ($key = 0; $key < $tokenIterator->count(); ++$key) { foreach ($this->sequences as $sequence) { $message = ''; + $domain = 'messages'; $tokenIterator->seek($key); - foreach ($sequence as $item) { + foreach ($sequence as $sequenceKey => $item) { $this->seekToNextRelevantToken($tokenIterator); - if ($this->normalizeToken($tokenIterator->current()) == $item) { + if ($this->normalizeToken($tokenIterator->current()) === $item) { $tokenIterator->next(); continue; - } elseif (self::MESSAGE_TOKEN == $item) { - $message = $this->getMessage($tokenIterator); + } elseif (self::MESSAGE_TOKEN === $item) { + $message = $this->getValue($tokenIterator); + + if (count($sequence) === ($sequenceKey + 1)) { + break; + } + } elseif (self::METHOD_ARGUMENTS_TOKEN === $item) { + $this->skipMethodArgument($tokenIterator); + } elseif (self::DOMAIN_TOKEN === $item) { + $domain = $this->getValue($tokenIterator); + break; } else { break; @@ -172,7 +227,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) } if ($message) { - $catalog->set($message, $this->prefix.$message); + $catalog->set($message, $this->prefix.$message, $domain); break; } } From 1e5707fed398ea972268823fcc2cb04e0847de39 Mon Sep 17 00:00:00 2001 From: Jay Klehr Date: Thu, 26 Jan 2017 23:50:33 -0700 Subject: [PATCH 57/61] Casting TableCell value to string. --- .../Component/Console/Helper/TableCell.php | 4 +++ .../Console/Tests/Helper/TableTest.php | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/Symfony/Component/Console/Helper/TableCell.php b/src/Symfony/Component/Console/Helper/TableCell.php index aa0d3180799ff..1b34774f26516 100644 --- a/src/Symfony/Component/Console/Helper/TableCell.php +++ b/src/Symfony/Component/Console/Helper/TableCell.php @@ -35,6 +35,10 @@ class TableCell */ public function __construct($value = '', array $options = array()) { + if (is_numeric($value) && !is_string($value)) { + $value = (string) $value; + } + $this->value = $value; // check option names diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index a691405c6b30f..4f37b8e21d110 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -509,6 +509,42 @@ public function testRenderMultiByte() | 1234 | +------+ +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testTableCellWithNumericIntValue() + { + $table = new Table($output = $this->getOutputStream()); + + $table->setRows(array(array(new TableCell(12345)))); + $table->render(); + + $expected = +<<<'TABLE' ++-------+ +| 12345 | ++-------+ + +TABLE; + + $this->assertEquals($expected, $this->getOutputContent($output)); + } + + public function testTableCellWithNumericFloatValue() + { + $table = new Table($output = $this->getOutputStream()); + + $table->setRows(array(array(new TableCell(12345.01)))); + $table->render(); + + $expected = +<<<'TABLE' ++----------+ +| 12345.01 | ++----------+ + TABLE; $this->assertEquals($expected, $this->getOutputContent($output)); From ad8f18963ee92c0908806834c0cc466fcd8bd825 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 4 Feb 2017 08:36:32 -0800 Subject: [PATCH 58/61] fixed test name --- .../Component/Form/Tests/Extension/Core/Type/DateTypeTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 282f43ee67358..aee6da34781fe 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -367,7 +367,7 @@ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException * @expectedExceptionMessage The "format" option should contain the letters "y", "M" or "d". Its current value is "wrong". */ - public function testThrowExceptionIfFormatDoesNotContainYearMonthOrDay() + public function testThrowExceptionIfFormatMissesYearMonthAndDayWithSingleTextWidget() { $this->factory->create('date', null, array( 'widget' => 'single_text', From 57f67e834bcef115a94f0910768c4fe2576d1cfc Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 4 Feb 2017 19:24:41 +0100 Subject: [PATCH 59/61] Remove 3.1 from PR template --- .github/PULL_REQUEST_TEMPLATE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 216a2ba4e5625..c9c3b75340557 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,6 +1,6 @@ | Q | A | ------------- | --- -| Branch? | master / 2.7, 2.8, 3.1 or 3.2 +| Branch? | master / 2.7, 2.8 or 3.2 | Bug fix? | yes/no | New feature? | yes/no | BC breaks? | yes/no From 1f5ebab161ea61dafcd4c74634404e1c82a1da65 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2017 13:47:30 +0100 Subject: [PATCH 60/61] updated CHANGELOG for 2.8.17 --- CHANGELOG-2.8.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 070264f0c3ea0..abd09dc175e2b 100644 --- a/CHANGELOG-2.8.md +++ b/CHANGELOG-2.8.md @@ -7,6 +7,27 @@ in 2.8 minor versions. To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.8.0...v2.8.1 +* 2.8.17 (2017-02-06) + + * bug #20844 [Config] Fix checking cache for non existing meta file (hason) + * bug #21063 [Form] Fixed DateType format option for single text widget (HeahDude) + * bug #21430 Casting TableCell value to string. (jaydiablo) + * bug #21359 [FrameworkBundle] fixed custom domain for translations in php templates (robinlehrmann) + * bug #21485 [Process] Non ASCII characters disappearing during the escapeshellarg (GuillaumeVerdon) + * bug #21370 [FrameworkBundle] Execute the PhpDocExtractor earlier (GuilhemN) + * bug #21462 [BrowserKit] ignore invalid cookies expires date format (xabbuh) + * bug #21438 [Console] Fix TableCell issues with decoration (ogizanagi) + * bug #21431 [DoctrineBridge] always check for all fields to be mapped (xabbuh) + * bug #21360 [PropertyAccess] Handle interfaces in the invalid argument exception (fancyweb) + * bug #21403 [DI] Fix defaults overriding empty strings in AutowirePass (nicolas-grekas) + * bug #21401 [Debug] Workaround "null" $context (nicolas-grekas) + * bug #21333 [HttpKernel] Fix ArgumentValueResolver for arguments default null (chalasr) + * bug #20871 [HttpKernel] Give higher priority to adding request formats (akeeman) + * bug #21332 [PropertyInfo] Don't try to access a property thru a static method (dunglas) + * bug #21331 [PropertyInfo] Exclude static methods form properties guessing (dunglas) + * bug #21285 [TwigBundle] do not lose already set method calls (xabbuh) + * bug #21279 #20411 fix Yaml parsing for very long quoted strings (RichardBradley) + * 2.8.16 (2017-01-12) * bug #21218 [Form] DateTimeToLocalizedStringTransformer does not use timezone when using date only (magnetik) From 4ddbaecea64544af351b379da6b6e0d9f45089ca Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2017 13:47:36 +0100 Subject: [PATCH 61/61] updated VERSION for 2.8.17 --- src/Symfony/Component/HttpKernel/Kernel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 27439d33399e1..ed22e35df5b5c 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,12 +59,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.17-DEV'; + const VERSION = '2.8.17'; const VERSION_ID = 20817; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; const RELEASE_VERSION = 17; - const EXTRA_VERSION = 'DEV'; + const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; const END_OF_LIFE = '11/2019';