diff --git a/appveyor.yml b/.appveyor.yml similarity index 99% rename from appveyor.yml rename to .appveyor.yml index 8d335c600d716..8fb89ca158094 100644 --- a/appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ build: false -clone_depth: 1 +clone_depth: 2 clone_folder: c:\projects\symfony cache: diff --git a/.editorconfig b/.editorconfig index 153cf3ef5bd04..d769b46a4b6ff 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,8 +3,17 @@ root = true ; Unix-style newlines [*] +charset = utf-8 end_of_line = LF +insert_final_newline = true +trim_trailing_whitespace = true -[*.php] +[*.{php,html,twig}] indent_style = space indent_size = 4 + +[*.md] +max_line_length = 80 + +[COMMIT_EDITMSG] +max_line_length = 0 diff --git a/.github/build-packages.php b/.github/build-packages.php index b67a699609d66..b09cea2fe230a 100644 --- a/.github/build-packages.php +++ b/.github/build-packages.php @@ -6,9 +6,14 @@ } chdir(dirname(__DIR__)); +$json = ltrim(file_get_contents('composer.json')); +if ($json !== $package = preg_replace('/\n "repositories": \[\n.*?\n \],/s', '', $json)) { + file_put_contents('composer.json', $package); +} + $dirs = $_SERVER['argv']; array_shift($dirs); -$mergeBase = trim(shell_exec(sprintf('git merge-base %s HEAD', array_shift($dirs)))); +$mergeBase = trim(shell_exec(sprintf('git merge-base "%s" HEAD', array_shift($dirs)))); $packages = array(); $flags = \PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0; @@ -49,7 +54,7 @@ $packages[$package->name][$package->version] = $package; - $versions = file_get_contents('https://packagist.org/p/'.$package->name.'.json'); + $versions = @file_get_contents('https://repo.packagist.org/p/'.$package->name.'.json') ?: sprintf('{"packages":{"%s":{"dev-master":%s}}}', $package->name, file_get_contents($dir.'/composer.json')); $versions = json_decode($versions)->packages->{$package->name}; if ($package->version === str_replace('-dev', '.x-dev', $versions->{'dev-master'}->extra->{'branch-alias'}->{'dev-master'})) { @@ -74,8 +79,6 @@ 'type' => 'composer', 'url' => 'file://'.str_replace(DIRECTORY_SEPARATOR, '/', dirname(__DIR__)).'/', )); - if (false === strpos($json, "\n \"repositories\": [\n")) { - $json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1); - file_put_contents('composer.json', $json); - } + $json = rtrim(json_encode(array('repositories' => $package->repositories), $flags), "\n}").','.substr($json, 1); + file_put_contents('composer.json', $json); } diff --git a/.github/rm-invalid-lowest-lock-files.php b/.github/rm-invalid-lowest-lock-files.php index c71463262171a..3105942a09030 100644 --- a/.github/rm-invalid-lowest-lock-files.php +++ b/.github/rm-invalid-lowest-lock-files.php @@ -79,7 +79,7 @@ function getContentHash(array $composerJson) continue 2; } - if (isset($composerJsons[$name][2]['repositories']) && !isset($lockedJson[$key]['repositories'])) { + if (isset($composerJsons[$name][2]['repositories']) && !isset($lockedJson['repositories'])) { // the locked package has been patched locally but the lock references a commit, // which means the referencing package itself is not modified continue; diff --git a/.travis.yml b/.travis.yml index 6896ac7a16e7f..8ee26e5249af2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ dist: trusty sudo: false git: - depth: 1 + depth: 2 addons: apt_packages: @@ -221,7 +221,11 @@ install: ([[ $deps ]] && cd src/Symfony/Component/HttpFoundation; composer config platform.ext-mongodb 1.5.0; composer require --dev --no-update mongodb/mongodb) fi tfold 'composer update' $COMPOSER_UP - tfold 'phpunit install' ./phpunit install + if [[ $TRAVIS_PHP_VERSION = 5.* || $TRAVIS_PHP_VERSION = hhvm* ]]; then + tfold 'phpunit install' 'composer global remove symfony/flex && ./phpunit install && composer global require --no-progress --no-scripts --no-plugins symfony/flex dev-master' + else + tfold 'phpunit install' ./phpunit install + fi if [[ $deps = high ]]; then echo "$COMPONENTS" | parallel --gnu -j10% "tfold {} 'cd {} && $COMPOSER_UP && $PHPUNIT_X$LEGACY'" elif [[ $deps = low ]]; then diff --git a/CHANGELOG-2.8.md b/CHANGELOG-2.8.md index 7921dc3bcfa9b..1e7eae64e3ea0 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.46 (2018-09-30) + + * bug #28376 [TwigBundle] Fixed caching of templates in src/Resources//views on cache warmup (yceruto) + * bug #28565 [HttpFoundation][Security] forward locale and format to subrequests (nicolas-grekas) + * bug #28545 [Console] Send the right exit code to console.terminate listeners (mpdude) + * bug #28466 [Form] fail reverse transforming invalid RFC 3339 dates (xabbuh) + * bug #28540 [Intl] parse numbers terminated with decimal separator (xabbuh) + * bug #28548 [Console] Fixed boxed table style with colspan (ro0NL) + * bug #28433 [HttpFoundation] Allow reuse of Session between requests if ID did not change (tgalopin) + * bug #28508 [Form] forward false label option to nested types (xabbuh) + * bug #28464 [Form] forward the invalid_message option in date types (xabbuh) + * bug #28499 [Ldap] Use shut up operator on connection errors at ldap_start_tls (Andras Debreczeni) + * bug #28372 [Form] Fix DateTimeType html5 input format (franzwilding, mcfedr) + * bug #28396 [Intl] Blacklist Eurozone and United Nations in Region Data Generator (gregurco) + * bug #28393 [Console] fixed corrupt error output for unknown multibyte short option (downace) + * bug #28401 [Console] Fix SymfonyQuestionHelper::askQuestion() with choice value as default (chalasr) + * bug #28377 fix fopen flags (SpacePossum) + * bug #27970 [FileValidator] Format file size in validation message according to binaryFormat option (jfredon) + * bug #28029 [TwigBundle] remove cache warmers when Twig cache is disabled (xabbuh) + * bug #28344 [HttpKernel][FrameworkBundle] Fix escaping of serialized payloads passed to test clients (nicolas-grekas) + * 2.8.45 (2018-08-27) * bug #28278 [HttpFoundation] Fix unprepared BinaryFileResponse sends empty file (wackymole) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 629d8b80c98a3..66d9da5983a99 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -12,8 +12,8 @@ Symfony is the result of the work of many people who made the code better - Christophe Coevoet (stof) - Jordi Boggiano (seldaek) - Victor Berchet (victor) - - Kévin Dunglas (dunglas) - Robin Chalas (chalas_r) + - Kévin Dunglas (dunglas) - Johannes S (johannes) - Jakub Zalas (jakubzalas) - Maxime Steinhausser (ogizanagi) @@ -23,54 +23,54 @@ Symfony is the result of the work of many people who made the code better - Grégoire Pineau (lyrixx) - Hugo Hamon (hhamon) - Abdellatif Ait boudad (aitboudad) - - Romain Neutron (romain) - Roland Franssen (ro0) + - Romain Neutron (romain) - Pascal Borreli (pborreli) - Wouter De Jong (wouterj) - Joseph Bielawski (stloyd) - Karma Dordrak (drak) - Lukas Kahwe Smith (lsmith) + - Samuel ROZE (sroze) - Martin Hasoň (hason) - Jeremy Mikola (jmikola) - - Samuel ROZE (sroze) - Jean-François Simon (jfsimon) - Benjamin Eberlei (beberlei) - Igor Wiedler (igorw) - Jules Pietri (heah) - Eriksen Costa (eriksencosta) - - Guilhem Niot (energetick) - Yonel Ceruto (yonelceruto) + - Guilhem Niot (energetick) - Sarah Khalil (saro0h) - Jonathan Wage (jwage) - Hamza Amrouche (simperfit) - Diego Saint Esteben (dosten) - Iltar van der Berg (kjarli) + - Tobias Nyholm (tobias) - Alexandre Salomé (alexandresalome) - William Durand (couac) - ornicar - Francis Besset (francisbesset) + - Dany Maillard (maidmaid) - stealth35 ‏ (stealth35) - Alexander Mols (asm89) - Bulat Shakirzyanov (avalanche123) - - Dany Maillard (maidmaid) - - Peter Rehm (rpet) - Matthias Pigulla (mpdude) + - Peter Rehm (rpet) - Saša Stamenković (umpirsky) - - Kevin Bond (kbond) - - Tobias Nyholm (tobias) - Pierre du Plessis (pierredup) + - Kevin Bond (kbond) - Henrik Bjørnskov (henrikbjorn) - Miha Vrhovnik + - Jérémy DERUSSÉ (jderusse) - Diego Saint Esteben (dii3g0) - Alexander M. Turek (derrabus) - - Jérémy DERUSSÉ (jderusse) - Konstantin Kudryashov (everzet) - Bilal Amarni (bamarni) - Florin Patan (florinpatan) - Gábor Egyed (1ed) - Mathieu Piot (mpiot) - - Michel Weimerskirch (mweimerskirch) - Titouan Galopin (tgalopin) + - Michel Weimerskirch (mweimerskirch) - Andrej Hudec (pulzarraider) - Eric Clemmons (ericclemmons) - Jáchym Toušek (enumag) @@ -78,11 +78,11 @@ Symfony is the result of the work of many people who made the code better - David Maicher (dmaicher) - Konstantin Myakshin (koc) - Christian Raue + - Issei Murasawa (issei_m) - Arnout Boks (aboks) - Deni - Henrik Westphal (snc) - Dariusz Górecki (canni) - - Issei Murasawa (issei_m) - Douglas Greenshields (shieldo) - Vladimir Reznichenko (kalessil) - Lee McDermott @@ -92,6 +92,7 @@ Symfony is the result of the work of many people who made the code better - Daniel Holmes (dholmes) - Dariusz Ruminski - Toni Uebernickel (havvg) + - Grégoire Paris (greg0ire) - Bart van den Burg (burgov) - Jordan Alliot (jalliot) - Jérôme Tamarelle (gromnan) @@ -99,14 +100,13 @@ Symfony is the result of the work of many people who made the code better - Fran Moreno (franmomu) - Antoine Hérault (herzult) - Paráda József (paradajozsef) - - Grégoire Paris (greg0ire) - Arnaud Le Blanc (arnaud-lb) - Maxime STEINHAUSSER - Michal Piotrowski (eventhorizon) + - gadelat (gadelat) - Tim Nagel (merk) - Brice BERNARD (brikou) - Valentin Udaltsov (vudaltsov) - - gadelat (gadelat) - Baptiste Clavié (talus) - marc.weistroff - lenar @@ -121,8 +121,8 @@ Symfony is the result of the work of many people who made the code better - Joshua Thijssen - David Buchmann (dbu) - excelwebzone - - Fabien Pennequin (fabienpennequin) - Gordon Franke (gimler) + - Fabien Pennequin (fabienpennequin) - Eric GELOEN (gelo) - Sebastiaan Stok (sstok) - Lars Strojny (lstrojny) @@ -132,6 +132,7 @@ Symfony is the result of the work of many people who made the code better - Théo FIDRY (theofidry) - Robert Schönthal (digitalkaoz) - Florian Lonqueu-Brochard (florianlb) + - Chris Wilkinson (thewilkybarkid) - Stefano Sala (stefano.sala) - Jérôme Vasseur (jvasseur) - Evgeniy (ewgraf) @@ -142,7 +143,6 @@ Symfony is the result of the work of many people who made the code better - Sebastian Hörl (blogsh) - Daniel Gomes (danielcsgomes) - Hidenori Goto (hidenorigoto) - - Chris Wilkinson (thewilkybarkid) - Arnaud Kleinpeter (nanocom) - Jannik Zschiesche (apfelbox) - Guilherme Blanco (guilhermeblanco) @@ -168,10 +168,12 @@ Symfony is the result of the work of many people who made the code better - Matthieu Ouellette-Vachon (maoueh) - Michał Pipa (michal.pipa) - Dawid Nowak + - Gabriel Ostrolucký - Amal Raghav (kertz) - Jonathan Ingram (jonathaningram) - Artur Kotyrba - GDIBass + - SpacePossum - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent) - James Halsall (jaitsu) - Matthieu Napoli (mnapoli) @@ -185,17 +187,17 @@ Symfony is the result of the work of many people who made the code better - Dorian Villet (gnutix) - Sergey Linnik (linniksa) - Richard Miller (mr_r_miller) - - Gabriel Ostrolucký - Mario A. Alvarez Garcia (nomack84) - Dennis Benkert (denderello) - DQNEO - - SpacePossum - Benjamin Dulau (dbenjamin) + - Florent Mata (fmata) - Mathieu Lemoine (lemoinem) - Thomas Calvet (fancyweb) - Christian Schmidt - Andreas Hucks (meandmymonkey) - Noel Guilbert (noel) + - Yanick Witschi (toflar) - Marek Štípek (maryo) - Stepan Anchugov (kix) - bronze1man @@ -222,7 +224,6 @@ Symfony is the result of the work of many people who made the code better - Michele Orselli (orso) - Tom Van Looy (tvlooy) - Sven Paulus (subsven) - - Yanick Witschi (toflar) - Rui Marinho (ruimarinho) - Alessandro Chitolina - Eugene Wissner @@ -233,6 +234,7 @@ Symfony is the result of the work of many people who made the code better - Nikolay Labinskiy (e-moe) - Marcel Beerta (mazen) - Albert Casademont (acasademont) + - Pavel Batanov (scaytrase) - Loïc Faugeron - Hidde Wieringa (hiddewie) - Marco Pivetta (ocramius) @@ -253,7 +255,6 @@ Symfony is the result of the work of many people who made the code better - Ruben Gonzalez (rubenrua) - Adam Prager (padam87) - Benoît Burnichon (bburnichon) - - Florent Mata (fmata) - Roman Marintšenko (inori) - Xavier Montaña Carreras (xmontana) - Mickaël Andrieu (mickaelandrieu) @@ -284,12 +285,12 @@ Symfony is the result of the work of many people who made the code better - Diego Agulló (aeoris) - Andreas Schempp (aschempp) - jdhoek - - Pavel Batanov (scaytrase) - Massimiliano Arione (garak) - Bob den Otter (bopp) - Nikita Konstantinov - Wodor Wodorski - Thomas Lallement (raziel057) + - mcfedr (mcfedr) - Giorgio Premi - Christian Schmidt - Beau Simensen (simensen) @@ -313,6 +314,7 @@ Symfony is the result of the work of many people who made the code better - Gary PEGEOT (gary-p) - Manuel Kiessling (manuelkiessling) - Atsuhiro KUBO (iteman) + - rudy onfroy (ronfroy) - Andrew Moore (finewolf) - Bertrand Zuchuat (garfield-fr) - Gabor Toth (tgabi333) @@ -435,6 +437,7 @@ Symfony is the result of the work of many people who made the code better - Jan Schumann - Niklas Fiekas - Markus Bachmann (baachi) + - Jan Schädlich - lancergr - Zan Baldwin - Mihai Stancu @@ -453,6 +456,7 @@ Symfony is the result of the work of many people who made the code better - Boris Vujicic (boris.vujicic) - Chris Sedlmayr (catchamonkey) - Mateusz Sip (mateusz_sip) + - Remon van de Kamp - Seb Koelen - Christoph Mewes (xrstf) - Vitaliy Tverdokhlib (vitaliytv) @@ -471,6 +475,7 @@ Symfony is the result of the work of many people who made the code better - Zander Baldwin - Adam Harvey - Anton Bakai + - Rhodri Pugh (rodnaph) - Alex Bakhturin - insekticid - Alexander Obuhovich (aik099) @@ -501,12 +506,14 @@ Symfony is the result of the work of many people who made the code better - Roy Van Ginneken (rvanginneken) - ondrowan - Barry vd. Heuvel (barryvdh) + - Sébastien Alfaiate (seb33300) - Evan S Kaufman (evanskaufman) - mcben - Jérôme Vieilledent (lolautruche) - Maks Slesarenko - Filip Procházka (fprochazka) - mmoreram + - Smaine Milianni (ismail1432) - Markus Lanthaler (lanthaler) - Remi Collet - Vicent Soria Durá (vicentgodella) @@ -522,6 +529,7 @@ Symfony is the result of the work of many people who made the code better - Erik Trapman (eriktrapman) - De Cock Xavier (xdecock) - Almog Baku (almogbaku) + - George Mponos (gmponos) - Scott Arciszewski - Xavier HAUSHERR - Norbert Orzechowicz (norzechowicz) @@ -594,6 +602,7 @@ Symfony is the result of the work of many people who made the code better - Nahuel Cuesta (ncuesta) - Chris Boden (cboden) - Christophe Villeger (seragan) + - Julien Fredon - Bob van de Vijver (bobvandevijver) - Stefan Gehrig (sgehrig) - Hany el-Kerdany @@ -607,6 +616,7 @@ Symfony is the result of the work of many people who made the code better - Javier López (loalf) - Reinier Kip - Geoffrey Brier (geoffrey-brier) + - Vlad Gregurco (vgregurco) - Vladimir Tsykun - Dustin Dobervich (dustin10) - dantleech @@ -618,7 +628,6 @@ Symfony is the result of the work of many people who made the code better - Kamil Kokot (pamil) - Max Grigorian (maxakawizard) - DerManoMann - - mcfedr (mcfedr) - Rostyslav Kinash - Maciej Malarz (malarzm) - Pascal Luna (skalpa) @@ -697,7 +706,6 @@ Symfony is the result of the work of many people who made the code better - Indra Gunawan (guind) - Peter Ward - Davide Borsatto (davide.borsatto) - - Rhodri Pugh (rodnaph) - Julien DIDIER (juliendidier) - Dominik Ritter (dritter) - Sebastian Grodzicki (sgrodzicki) @@ -733,13 +741,11 @@ Symfony is the result of the work of many people who made the code better - Nykopol (nykopol) - Jordan Deitch - Casper Valdemar Poulsen - - Remon van de Kamp - Josiah (josiah) - Joschi Kuphal - John Bohn (jbohn) - Marc Morera (mmoreram) - Saif Eddin Gmati (azjezz) - - Smaine Milianni (ismail1432) - Andrew Hilobok (hilobok) - Noah Heck (myesain) - Christian Soronellas (theunic) @@ -752,7 +758,6 @@ Symfony is the result of the work of many people who made the code better - Benoit Lévêque (benoit_leveque) - Jeroen Fiege (fieg) - Krzysiek Łabuś - - George Mponos (gmponos) - Xavier Lacot (xavier) - possum - Denis Zunke (donalberto) @@ -914,14 +919,16 @@ Symfony is the result of the work of many people who made the code better - Pieter - Michael Tibben - Billie Thompson + - Ganesh Chandrasekaran - Sander Marechal + - Franz Wilding (killerpoke) - ProgMiner - Oleg Golovakhin (doc_tr) - Icode4Food (icode4food) - Radosław Benkel + - kevin.nadin - jean pasqualini (darkilliant) - Ross Motley (rossmotley) - - Julien Fredon - ttomor - Mei Gwilym (meigwilym) - Michael H. Arieli (excelwebzone) @@ -932,6 +939,8 @@ Symfony is the result of the work of many people who made the code better - Sander Coolen (scoolen) - Nicolas Le Goff (nlegoff) - Ben Oman + - Guilhem N (guilhemn) + - Chris de Kok - Andreas Kleemann - Manuele Menozzi - Anton Babenko (antonbabenko) @@ -1047,8 +1056,10 @@ Symfony is the result of the work of many people who made the code better - Alexander Cheprasov - Rodrigo Díez Villamuera (rodrigodiez) - e-ivanov + - Roberto Espinoza (respinoza) - Einenlum - Jochen Bayer (jocl) + - Patrick Carlo-Hickman - Alex Bowers - Jeremy Bush - wizhippo @@ -1228,6 +1239,7 @@ Symfony is the result of the work of many people who made the code better - caponica - Matt Daum (daum) - Alberto Pirovano (geezmo) + - Nicolas LEFEVRE (nicoweb) - Pete Mitchell (peterjmit) - Tom Corrigan (tomcorrigan) - Luis Galeas @@ -1273,6 +1285,7 @@ Symfony is the result of the work of many people who made the code better - Jon Gotlin (jongotlin) - Michael Dowling (mtdowling) - Karlos Presumido (oneko) + - Sylvain Fabre (sylfabre) - Thomas Counsell - BilgeXA - r1pp3rj4ck @@ -1318,6 +1331,7 @@ Symfony is the result of the work of many people who made the code better - Andrew (drew) - kor3k kor3k (kor3k) - Stelian Mocanita (stelian) + - Justin (wackymole) - Flavian (2much) - Gautier Deuette - mike @@ -1361,6 +1375,7 @@ Symfony is the result of the work of many people who made the code better - Jody Mickey (jwmickey) - Przemysław Piechota (kibao) - Leonid Terentyev (li0n) + - Martynas Sudintas (martiis) - ryunosuke - zenmate - victoria @@ -1385,7 +1400,6 @@ Symfony is the result of the work of many people who made the code better - Vasily Khayrulin (sirian) - Stefan Koopmanschap (skoop) - Stefan Hüsges (tronsha) - - Vlad Gregurco (vgregurco) - Jake Bishop (yakobeyak) - Dan Blows - Matt Wells @@ -1440,13 +1454,16 @@ Symfony is the result of the work of many people who made the code better - loru88 - Romain Dorgueil - Christopher Parotat + - me_shaon - 蝦米 - Grayson Koonce (breerly) - Karim Cassam Chenaï (ka) + - Maksym Slesarenko (maksym_slesarenko) - Michal Kurzeja (mkurzeja) - Nicolas Bastien (nicolas_bastien) - Denis (yethee) - Andrew Zhilin (zhil) + - Sjors Ottjes - Andy Stanberry - Felix Marezki - Normunds @@ -1458,6 +1475,7 @@ Symfony is the result of the work of many people who made the code better - Pavel.Batanov - avi123 - alsar + - downace - Aarón Nieves Fernández - Mike Meier - Kirill Saksin @@ -1484,7 +1502,6 @@ Symfony is the result of the work of many people who made the code better - Milos Colakovic (project2481) - Rénald Casagraude (rcasagraude) - Robin Duval (robin-duval) - - rudy onfroy (ronfroy) - Grinbergs Reinis (shima5) - Artem Lopata (bumz) - Nicole Cordes @@ -1517,6 +1534,7 @@ Symfony is the result of the work of many people who made the code better - Sam Ward - Walther Lalk - Adam + - Sören Bernstein - devel - taiiiraaa - Trevor Suarez @@ -1597,6 +1615,7 @@ Symfony is the result of the work of many people who made the code better - Marin Nicolae - Alessandro Loffredo - Ian Phillips + - Marco Lipparini - Haritz - Matthieu Prat - Ion Bazan @@ -1741,6 +1760,7 @@ Symfony is the result of the work of many people who made the code better - Antonio Angelino - Matt Fields - Niklas Keller + - Andras Debreczeni - Vladimir Sazhin - Tomas Kmieliauskas - Billie Thompson @@ -1772,6 +1792,7 @@ Symfony is the result of the work of many people who made the code better - n-aleha - Anatol Belski - Şəhriyar İmanov + - Alexis BOYER - Kaipi Yann - Sam Williams - Guillaume Aveline @@ -1897,6 +1918,7 @@ Symfony is the result of the work of many people who made the code better - Arash Tabriziyan (ghost098) - ibasaw (ibasaw) - Vladislav Krupenkin (ideea) + - Ilija Tovilo (ilijatovilo) - Peter Orosz (ill_logical) - Imangazaliev Muhammad (imangazaliev) - j0k (j0k) @@ -1944,7 +1966,6 @@ Symfony is the result of the work of many people who made the code better - Bart Ruysseveldt (ruyss) - Sascha Dens (saschadens) - scourgen hung (scourgen) - - Sébastien Alfaiate (seb33300) - Sebastian Busch (sebu) - Sepehr Lajevardi (sepehr) - André Filipe Gonçalves Neves (seven) diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php index b196e8918344c..6b0766fada05a 100644 --- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php +++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php @@ -530,10 +530,7 @@ private function getSingleIdentifierValue($entity) private function getIdentifierValues($entity) { if (!$this->em->contains($entity)) { - throw new RuntimeException( - 'Entities passed to the choice field must be managed. Maybe '. - 'persist them in the entity manager?' - ); + throw new RuntimeException('Entities passed to the choice field must be managed. Maybe persist them in the entity manager?'); } $this->em->initializeObject($entity); diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index f76872a5818c7..8fef469f2c042 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -237,11 +237,7 @@ public function configureOptions(OptionsResolver $resolver) $em = $registry->getManagerForClass($options['class']); if (null === $em) { - throw new RuntimeException(sprintf( - 'Class "%s" seems not to be a managed Doctrine entity. '. - 'Did you forget to map it?', - $options['class'] - )); + throw new RuntimeException(sprintf('Class "%s" seems not to be a managed Doctrine entity. Did you forget to map it?', $options['class'])); } return $em; diff --git a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php index e0dcaae6c2f6d..c3b7588e95049 100644 --- a/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php +++ b/src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php @@ -27,13 +27,14 @@ * and to do the conversion of the datetime column. * * In order to use this class, you need the following table in your database: - * CREATE TABLE `rememberme_token` ( - * `series` char(88) UNIQUE PRIMARY KEY NOT NULL, - * `value` char(88) NOT NULL, - * `lastUsed` datetime NOT NULL, - * `class` varchar(100) NOT NULL, - * `username` varchar(200) NOT NULL - * ); + * + * CREATE TABLE `rememberme_token` ( + * `series` char(88) UNIQUE PRIMARY KEY NOT NULL, + * `value` char(88) NOT NULL, + * `lastUsed` datetime NOT NULL, + * `class` varchar(100) NOT NULL, + * `username` varchar(200) NOT NULL + * ); */ class DoctrineTokenProvider implements TokenProviderInterface { diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php index 5f59dbe5e6e39..f95d1389ff83b 100644 --- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php +++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php @@ -72,7 +72,7 @@ public static function register($mode = 0) } $mode = $getMode(); - $trace = debug_backtrace(true); + $trace = debug_backtrace(); $group = 'other'; $i = \count($trace); diff --git a/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php b/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php index 7cdbb77b4349b..a4d7d6f690078 100644 --- a/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php +++ b/src/Symfony/Bridge/Twig/TokenParser/DumpTokenParser.php @@ -19,11 +19,10 @@ * Token Parser for the 'dump' tag. * * Dump variables with: - *
- *  {% dump %}
- *  {% dump foo %}
- *  {% dump foo, bar %}
- * 
+ * + * {% dump %} + * {% dump foo %} + * {% dump foo, bar %} * * @author Julien Galenski */ diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 6cd0832b13cd0..d8c7380d18e89 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -161,19 +161,19 @@ protected function doRequestInProcess($request) */ protected function getScript($request) { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); + $kernel = var_export(serialize($this->kernel), true); + $request = var_export(serialize($request), true); $r = new \ReflectionObject($this->kernel); $autoloader = \dirname($r->getFileName()).'/autoload.php'; if (is_file($autoloader)) { - $autoloader = str_replace("'", "\\'", $autoloader); + $autoloader = var_export($autoloader, true); } else { - $autoloader = ''; + $autoloader = 'false'; } - $path = str_replace("'", "\\'", $r->getFileName()); + $path = var_export($r->getFileName(), true); $profilerCode = ''; if ($this->profiler) { @@ -187,16 +187,16 @@ protected function getScript($request) error_reporting($errorReporting); -if ('$autoloader') { - require_once '$autoloader'; +if ($autoloader) { + require_once $autoloader; } -require_once '$path'; +require_once $path; -\$kernel = unserialize('$kernel'); +\$kernel = unserialize($kernel); \$kernel->boot(); $profilerCode -\$request = unserialize('$request'); +\$request = unserialize($request); EOF; return $code.$this->getHandleScript(); diff --git a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php index fec5b72a5b3be..869e5b4679e26 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php @@ -38,17 +38,17 @@ abstract protected function configureRoutes(RouteCollectionBuilder $routes); * * You can register extensions: * - * $c->loadFromExtension('framework', array( - * 'secret' => '%secret%' - * )); + * $c->loadFromExtension('framework', array( + * 'secret' => '%secret%' + * )); * * Or services: * - * $c->register('halloween', 'FooBundle\HalloweenProvider'); + * $c->register('halloween', 'FooBundle\HalloweenProvider'); * * Or parameters: * - * $c->setParameter('halloween', 'lot of fun'); + * $c->setParameter('halloween', 'lot of fun'); * * @param ContainerBuilder $c * @param LoaderInterface $loader diff --git a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 82c2f1b70de71..a6835b70bc60b 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -152,14 +152,7 @@ private function resolve($value) return (string) $resolved; } - throw new RuntimeException(sprintf( - 'The container parameter "%s", used in the route configuration value "%s", '. - 'must be a string or numeric, but it is of type %s.', - $match[1], - $value, - \gettype($resolved) - ) - ); + throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved))); }, $value); return str_replace('%%', '%', $escapedValue); diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php index fd9da17ef21d6..091b5d10f8221 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/FormHelper.php @@ -232,18 +232,14 @@ public function block(FormView $view, $blockName, array $variables = array()) * Use this helper for CSRF protection without the overhead of creating a * form. * - * - * echo $view['form']->csrfToken('rm_user_'.$user->getId()); - * + * echo $view['form']->csrfToken('rm_user_'.$user->getId()); * * Check the token in your action using the same intention. * - * - * $csrfProvider = $this->get('security.csrf.token_generator'); - * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { - * throw new \RuntimeException('CSRF attack detected.'); - * } - * + * $csrfProvider = $this->get('security.csrf.token_generator'); + * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { + * throw new \RuntimeException('CSRF attack detected.'); + * } * * @param string $intention The intention of the protected action * diff --git a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php index 5708ef716df7b..9692a138c3bdf 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php +++ b/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php @@ -23,7 +23,7 @@ abstract class WebTestCase extends KernelTestCase /** * Creates a Client. * - * @param array $options An array of options to pass to the createKernel class + * @param array $options An array of options to pass to the createKernel method * @param array $server An array of server parameters * * @return Client A Client instance diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php index 8970051c27512..df3642b553530 100644 --- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php +++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/GuardAuthenticationFactory.php @@ -94,10 +94,7 @@ private function determineEntryPoint($defaultEntryPointId, array $config) if ($defaultEntryPointId) { // explode if they've configured the entry_point, but there is already one if ($config['entry_point']) { - throw new \LogicException(sprintf( - 'The guard authentication provider cannot use the "%s" entry_point because another entry point is already configured by another provider! Either remove the other provider or move the entry_point configuration as a root key under your firewall (i.e. at the same level as "guard").', - $config['entry_point'] - )); + throw new \LogicException(sprintf('The guard authentication provider cannot use the "%s" entry_point because another entry point is already configured by another provider! Either remove the other provider or move the entry_point configuration as a root key under your firewall (i.e. at the same level as "guard").', $config['entry_point'])); } return $defaultEntryPointId; @@ -115,9 +112,6 @@ private function determineEntryPoint($defaultEntryPointId, array $config) } // we have multiple entry points - we must ask them to configure one - throw new \LogicException(sprintf( - 'Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)', - implode(', ', $authenticatorIds) - )); + throw new \LogicException(sprintf('Because you have multiple guard configurators, you need to set the "guard.entry_point" key to one of your configurators (%s)', implode(', ', $authenticatorIds))); } } diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index b91744781a1bb..4420a02b30bf2 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -49,10 +49,15 @@ public function process(ContainerBuilder $container) $coreThemePath = \dirname(\dirname($reflClass->getFileName())).'/Resources/views/Form'; $container->getDefinition('twig.loader.native_filesystem')->addMethodCall('addPath', array($coreThemePath)); - $paths = $container->getDefinition('twig.cache_warmer')->getArgument(2); + $paths = $container->getDefinition('twig.template_iterator')->getArgument(2); $paths[$coreThemePath] = null; - $container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths); $container->getDefinition('twig.template_iterator')->replaceArgument(2, $paths); + + if ($container->hasDefinition('twig.cache_warmer')) { + $paths = $container->getDefinition('twig.cache_warmer')->getArgument(2); + $paths[$coreThemePath] = null; + $container->getDefinition('twig.cache_warmer')->replaceArgument(2, $paths); + } } if ($container->has('fragment.handler')) { diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index f23147440ed2e..2b5f1d1a4ed39 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -132,6 +132,11 @@ public function load(array $configs, ContainerBuilder $container) $container->getDefinition('twig')->replaceArgument(1, $config); + if (false === $config['cache']) { + $container->removeDefinition('twig.cache_warmer'); + $container->removeDefinition('twig.template_cache_warmer'); + } + $this->addClassesToCompile(array( 'Twig_Environment', 'Twig_Extension', diff --git a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php index cc93e27b5577b..3c6a615382784 100644 --- a/src/Symfony/Bundle/TwigBundle/TemplateIterator.php +++ b/src/Symfony/Bundle/TwigBundle/TemplateIterator.php @@ -57,7 +57,7 @@ public function getIterator() $this->templates = array_merge( $this->templates, $this->findTemplatesInDirectory($bundle->getPath().'/Resources/views', $name), - $this->findTemplatesInDirectory($this->rootDir.'/'.$bundle->getName().'/views', $name) + $this->findTemplatesInDirectory($this->rootDir.'/Resources/'.$bundle->getName().'/views', $name) ); } diff --git a/src/Symfony/Bundle/TwigBundle/Tests/Fixtures/templates/Resources/BarBundle/views/base.html.twig b/src/Symfony/Bundle/TwigBundle/Tests/Fixtures/templates/Resources/BarBundle/views/base.html.twig new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php b/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php index 636d5796f874f..1b2835ccb2711 100644 --- a/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php +++ b/src/Symfony/Bundle/TwigBundle/Tests/TemplateIteratorTest.php @@ -31,6 +31,7 @@ public function testGetIterator() sort($sorted); $this->assertEquals( array( + '@Bar/base.html.twig', '@Bar/index.html.twig', '@Foo/index.html.twig', 'layout.html.twig', diff --git a/src/Symfony/Bundle/WebProfilerBundle/README.md b/src/Symfony/Bundle/WebProfilerBundle/README.md index 03780d5e5904e..48e6075636519 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/README.md +++ b/src/Symfony/Bundle/WebProfilerBundle/README.md @@ -1,6 +1,12 @@ WebProfilerBundle ================= +The Web profiler bundle is a **development tool** that gives detailed +information about the execution of any request. + +**Never** enable it on production servers as it will lead to major security +vulnerabilities in your project. + Resources --------- diff --git a/src/Symfony/Component/Config/Definition/ArrayNode.php b/src/Symfony/Component/Config/Definition/ArrayNode.php index 1ab4a3ae59e43..c8cb82c41ff9c 100644 --- a/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -219,15 +219,13 @@ public function addChild(NodeInterface $node) protected function finalizeValue($value) { if (false === $value) { - $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); - throw new UnsetKeyException($msg); + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); } foreach ($this->children as $name => $child) { if (!array_key_exists($name, $value)) { if ($child->isRequired()) { - $msg = sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath()); - $ex = new InvalidConfigurationException($msg); + $ex = new InvalidConfigurationException(sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -260,11 +258,7 @@ protected function finalizeValue($value) protected function validateType($value) { if (!\is_array($value) && (!$this->allowFalse || false !== $value)) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected array, but got %s', - $this->getPath(), - \gettype($value) - )); + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected array, but got %s', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } @@ -303,8 +297,7 @@ protected function normalizeValue($value) // if extra fields are present, throw exception if (\count($value) && !$this->ignoreExtraKeys) { - $msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()); - $ex = new InvalidConfigurationException($msg); + $ex = new InvalidConfigurationException(sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -363,13 +356,7 @@ protected function mergeValues($leftSide, $rightSide) // no conflict if (!array_key_exists($k, $leftSide)) { if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf( - 'You are not allowed to define new elements for path "%s". ' - .'Please define all elements for this path in one config file. ' - .'If you are trying to overwrite an element, make sure you redefine it ' - .'with the same name.', - $this->getPath() - )); + $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath())); $ex->setPath($this->getPath()); throw $ex; diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index 8885775e607dc..c78b6e762738c 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -205,12 +205,7 @@ public function getPath() final public function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { - throw new ForbiddenOverwriteException(sprintf( - 'Configuration path "%s" cannot be overwritten. You have to ' - .'define all options for this path, and any of its sub-paths in ' - .'one configuration section.', - $this->getPath() - )); + throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); } $this->validateType($leftSide); diff --git a/src/Symfony/Component/Config/Definition/BooleanNode.php b/src/Symfony/Component/Config/Definition/BooleanNode.php index 77e90cf7d624a..85f467b6bea92 100644 --- a/src/Symfony/Component/Config/Definition/BooleanNode.php +++ b/src/Symfony/Component/Config/Definition/BooleanNode.php @@ -26,11 +26,7 @@ class BooleanNode extends ScalarNode protected function validateType($value) { if (!\is_bool($value)) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected boolean, but got %s.', - $this->getPath(), - \gettype($value) - )); + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected boolean, but got %s.', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php index 27fadba6f8ab6..31e918af1ce47 100644 --- a/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php +++ b/src/Symfony/Component/Config/Definition/Builder/ArrayNodeDefinition.php @@ -411,27 +411,19 @@ protected function validateConcreteNode(ArrayNode $node) $path = $node->getPath(); if (null !== $this->key) { - throw new InvalidDefinitionException( - sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)); } if (true === $this->atLeastOne) { - throw new InvalidDefinitionException( - sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)); } if ($this->default) { - throw new InvalidDefinitionException( - sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)); } if (false !== $this->addDefaultChildren) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)); } } @@ -445,28 +437,20 @@ protected function validatePrototypeNode(PrototypedArrayNode $node) $path = $node->getPath(); if ($this->addDefaults) { - throw new InvalidDefinitionException( - sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path)); } if (false !== $this->addDefaultChildren) { if ($this->default) { - throw new InvalidDefinitionException( - sprintf('A default value and default children might not be used together at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path)); } if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)); } if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path)); } } } diff --git a/src/Symfony/Component/Config/Definition/EnumNode.php b/src/Symfony/Component/Config/Definition/EnumNode.php index 0cb40018b04fe..a214a854b7587 100644 --- a/src/Symfony/Component/Config/Definition/EnumNode.php +++ b/src/Symfony/Component/Config/Definition/EnumNode.php @@ -43,11 +43,7 @@ protected function finalizeValue($value) $value = parent::finalizeValue($value); if (!\in_array($value, $this->values, true)) { - $ex = new InvalidConfigurationException(sprintf( - 'The value %s is not allowed for path "%s". Permissible values: %s', - json_encode($value), - $this->getPath(), - implode(', ', array_map('json_encode', $this->values)))); + $ex = new InvalidConfigurationException(sprintf('The value %s is not allowed for path "%s". Permissible values: %s', json_encode($value), $this->getPath(), implode(', ', array_map('json_encode', $this->values)))); $ex->setPath($this->getPath()); throw $ex; diff --git a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php index 6af4a61e475d4..eddcb32a77871 100644 --- a/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php +++ b/src/Symfony/Component/Config/Definition/PrototypedArrayNode.php @@ -185,8 +185,7 @@ public function addChild(NodeInterface $node) protected function finalizeValue($value) { if (false === $value) { - $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); - throw new UnsetKeyException($msg); + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); } foreach ($value as $k => $v) { @@ -199,8 +198,7 @@ protected function finalizeValue($value) } if (\count($value) < $this->minNumberOfElements) { - $msg = sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements); - $ex = new InvalidConfigurationException($msg); + $ex = new InvalidConfigurationException(sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements)); $ex->setPath($this->getPath()); throw $ex; @@ -232,8 +230,7 @@ protected function normalizeValue($value) foreach ($value as $k => $v) { if (null !== $this->keyAttribute && \is_array($v)) { if (!isset($v[$this->keyAttribute]) && \is_int($k) && !$isAssoc) { - $msg = sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath()); - $ex = new InvalidConfigurationException($msg); + $ex = new InvalidConfigurationException(sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -262,8 +259,7 @@ protected function normalizeValue($value) } if (array_key_exists($k, $normalized)) { - $msg = sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath()); - $ex = new DuplicateKeyException($msg); + $ex = new DuplicateKeyException(sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -314,11 +310,7 @@ protected function mergeValues($leftSide, $rightSide) // no conflict if (!array_key_exists($k, $leftSide)) { if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf( - 'You are not allowed to define new elements for path "%s". '. - 'Please define all elements for this path in one config file.', - $this->getPath() - )); + $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file.', $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -342,27 +334,31 @@ protected function mergeValues($leftSide, $rightSide) * one is same as this->keyAttribute and the other is 'value', then the prototype will be different. * * For example, assume $this->keyAttribute is 'name' and the value array is as follows: - * array( + * * array( - * 'name' => 'name001', - * 'value' => 'value001' + * array( + * 'name' => 'name001', + * 'value' => 'value001' + * ) * ) - * ) * * Now, the key is 0 and the child node is: - * array( - * 'name' => 'name001', - * 'value' => 'value001' - * ) + * + * array( + * 'name' => 'name001', + * 'value' => 'value001' + * ) * * When normalizing the value array, the 'name' element will removed from the child node * and its value becomes the new key of the child node: - * array( - * 'name001' => array('value' => 'value001') - * ) + * + * array( + * 'name001' => array('value' => 'value001') + * ) * * Now only 'value' element is left in the child node which can be further simplified into a string: - * array('name001' => 'value001') + * + * array('name001' => 'value001') * * Now, the key becomes 'name001' and the child node becomes 'value001' and * the prototype of child node 'name001' should be a ScalarNode instead of an ArrayNode instance. diff --git a/src/Symfony/Component/Config/Definition/ScalarNode.php b/src/Symfony/Component/Config/Definition/ScalarNode.php index e63f3f227f702..53c1ed29c299d 100644 --- a/src/Symfony/Component/Config/Definition/ScalarNode.php +++ b/src/Symfony/Component/Config/Definition/ScalarNode.php @@ -33,11 +33,7 @@ class ScalarNode extends VariableNode protected function validateType($value) { if (!is_scalar($value) && null !== $value) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected scalar, but got %s.', - $this->getPath(), - \gettype($value) - )); + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected scalar, but got %s.', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/src/Symfony/Component/Config/Definition/VariableNode.php b/src/Symfony/Component/Config/Definition/VariableNode.php index 0cd84c72bf303..1a3442d9613db 100644 --- a/src/Symfony/Component/Config/Definition/VariableNode.php +++ b/src/Symfony/Component/Config/Definition/VariableNode.php @@ -82,11 +82,7 @@ protected function validateType($value) protected function finalizeValue($value) { if (!$this->allowEmptyValue && $this->isValueEmpty($value)) { - $ex = new InvalidConfigurationException(sprintf( - 'The path "%s" cannot contain an empty value, but got %s.', - $this->getPath(), - json_encode($value) - )); + $ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index d1a21049eea9b..fe62e8d86060b 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -129,15 +129,7 @@ public function run(InputInterface $input = null, OutputInterface $output = null $this->renderException($e, $output); } - $exitCode = $e->getCode(); - if (is_numeric($exitCode)) { - $exitCode = (int) $exitCode; - if (0 === $exitCode) { - $exitCode = 1; - } - } else { - $exitCode = 1; - } + $exitCode = $this->getExitCodeForThrowable($e); } if ($this->autoExit) { @@ -873,7 +865,8 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI if ($x !== $event->getException()) { $e = $event->getException(); } - $exitCode = $e->getCode(); + + $exitCode = $this->getExitCodeForThrowable($e); } $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode); @@ -1148,4 +1141,24 @@ private function init() $this->add($command); } } + + /** + * @param \Exception|\Throwable $throwable + * + * @return int + */ + private function getExitCodeForThrowable($throwable) + { + $exitCode = $throwable->getCode(); + if (is_numeric($exitCode)) { + $exitCode = (int) $exitCode; + if (0 === $exitCode) { + $exitCode = 1; + } + } else { + $exitCode = 1; + } + + return $exitCode; + } } diff --git a/src/Symfony/Component/Console/Command/Command.php b/src/Symfony/Component/Console/Command/Command.php index 1f4b845fcab65..70b4546fde41c 100644 --- a/src/Symfony/Component/Console/Command/Command.php +++ b/src/Symfony/Component/Console/Command/Command.php @@ -163,10 +163,14 @@ protected function interact(InputInterface $input, OutputInterface $output) } /** - * Initializes the command just after the input has been validated. + * Initializes the command after the input has been bound and before the input + * is validated. * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. + * + * @see InputInterface::bind() + * @see InputInterface::validate() */ protected function initialize(InputInterface $input, OutputInterface $output) { diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index 1f4e0cad1d1ec..b884d71343804 100644 --- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -90,11 +90,7 @@ public function setForeground($color = null) } if (!isset(static::$availableForegroundColors[$color])) { - throw new InvalidArgumentException(sprintf( - 'Invalid foreground color specified: "%s". Expected one of (%s)', - $color, - implode(', ', array_keys(static::$availableForegroundColors)) - )); + throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); } $this->foreground = static::$availableForegroundColors[$color]; @@ -116,11 +112,7 @@ public function setBackground($color = null) } if (!isset(static::$availableBackgroundColors[$color])) { - throw new InvalidArgumentException(sprintf( - 'Invalid background color specified: "%s". Expected one of (%s)', - $color, - implode(', ', array_keys(static::$availableBackgroundColors)) - )); + throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); } $this->background = static::$availableBackgroundColors[$color]; @@ -136,11 +128,7 @@ public function setBackground($color = null) public function setOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf( - 'Invalid option specified: "%s". Expected one of (%s)', - $option, - implode(', ', array_keys(static::$availableOptions)) - )); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); } if (!\in_array(static::$availableOptions[$option], $this->options)) { @@ -158,11 +146,7 @@ public function setOption($option) public function unsetOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf( - 'Invalid option specified: "%s". Expected one of (%s)', - $option, - implode(', ', array_keys(static::$availableOptions)) - )); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); } $pos = array_search(static::$availableOptions[$option], $this->options); diff --git a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php index 94596d4af5305..cfcdf44e3a98c 100644 --- a/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php +++ b/src/Symfony/Component/Console/Helper/SymfonyQuestionHelper.php @@ -82,7 +82,7 @@ protected function writePrompt(OutputInterface $output, Question $question) case $question instanceof ChoiceQuestion: $choices = $question->getChoices(); - $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($choices[$default])); + $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default)); break; diff --git a/src/Symfony/Component/Console/Helper/Table.php b/src/Symfony/Component/Console/Helper/Table.php index ce5a819e142e2..b5c0e91a3ccb0 100644 --- a/src/Symfony/Component/Console/Helper/Table.php +++ b/src/Symfony/Component/Console/Helper/Table.php @@ -224,15 +224,14 @@ public function setRow($column, array $row) * Renders table to output. * * Example: - * - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * + * + * +---------------+-----------------------+------------------+ + * | ISBN | Title | Author | + * +---------------+-----------------------+------------------+ + * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | + * +---------------+-----------------------+------------------+ */ public function render() { @@ -266,7 +265,9 @@ public function render() /** * Renders horizontal header separator. * - * Example: +-----+-----------+-------+ + * Example: + * + * +-----+-----------+-------+ */ private function renderRowSeparator() { @@ -297,7 +298,9 @@ private function renderColumnSeparator() /** * Renders table row. * - * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * Example: + * + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * * @param array $row * @param string $cellFormat @@ -567,7 +570,7 @@ private function calculateColumnsWidth($rows) $lengths[] = $this->getCellWidth($row, $column); } - $this->columnWidths[$column] = max($lengths) + \strlen($this->style->getCellRowContentFormat()) - 2; + $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2; } } @@ -578,7 +581,7 @@ private function calculateColumnsWidth($rows) */ private function getColumnSeparatorWidth() { - return \strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); + return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); } /** diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php index 741c734c723f2..2735fce693f7a 100644 --- a/src/Symfony/Component/Console/Input/ArgvInput.php +++ b/src/Symfony/Component/Console/Input/ArgvInput.php @@ -121,7 +121,8 @@ private function parseShortOptionSet($name) $len = \strlen($name); for ($i = 0; $i < $len; ++$i) { if (!$this->definition->hasShortcut($name[$i])) { - throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); + $encoding = mb_detect_encoding($name, null, true); + throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding))); } $option = $this->definition->getOptionForShortcut($name[$i]); diff --git a/src/Symfony/Component/Console/Input/InputArgument.php b/src/Symfony/Component/Console/Input/InputArgument.php index d4c5e35627ab3..2330cdc2ea565 100644 --- a/src/Symfony/Component/Console/Input/InputArgument.php +++ b/src/Symfony/Component/Console/Input/InputArgument.php @@ -86,7 +86,7 @@ public function isArray() /** * Sets the default value. * - * @param mixed $default The default value + * @param string|string[] $default The default value * * @throws LogicException When incorrect default value is given */ @@ -110,7 +110,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return mixed The default value + * @return string|string[] The default value */ public function getDefault() { diff --git a/src/Symfony/Component/Console/Input/InputDefinition.php b/src/Symfony/Component/Console/Input/InputDefinition.php index dc6e2701f1f18..72f784cebb8b8 100644 --- a/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/src/Symfony/Component/Console/Input/InputDefinition.php @@ -23,8 +23,8 @@ * Usage: * * $definition = new InputDefinition(array( - * new InputArgument('name', InputArgument::REQUIRED), - * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), + * new InputArgument('name', InputArgument::REQUIRED), + * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), * )); * * @author Fabien Potencier diff --git a/src/Symfony/Component/Console/Input/InputInterface.php b/src/Symfony/Component/Console/Input/InputInterface.php index 805ee5173652d..354d198e046cf 100644 --- a/src/Symfony/Component/Console/Input/InputInterface.php +++ b/src/Symfony/Component/Console/Input/InputInterface.php @@ -59,6 +59,8 @@ public function getParameterOption($values, $default = false); /** * Binds the current Input instance with the given arguments and options. + * + * @throws RuntimeException */ public function bind(InputDefinition $definition); @@ -81,7 +83,7 @@ public function getArguments(); * * @param string $name The argument name * - * @return mixed The argument value + * @return string|string[] The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -90,8 +92,8 @@ public function getArgument($name); /** * Sets an argument value by name. * - * @param string $name The argument name - * @param string $value The argument value + * @param string $name The argument name + * @param string|string[] $value The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -118,7 +120,7 @@ public function getOptions(); * * @param string $name The option name * - * @return mixed The option value + * @return string|string[]|bool The option value * * @throws InvalidArgumentException When option given doesn't exist */ @@ -127,8 +129,8 @@ public function getOption($name); /** * Sets an option value by name. * - * @param string $name The option name - * @param string|bool $value The option value + * @param string $name The option name + * @param string|string[]|bool $value The option value * * @throws InvalidArgumentException When option given doesn't exist */ diff --git a/src/Symfony/Component/Console/Input/InputOption.php b/src/Symfony/Component/Console/Input/InputOption.php index 9567876c8ace9..429c9f037d981 100644 --- a/src/Symfony/Component/Console/Input/InputOption.php +++ b/src/Symfony/Component/Console/Input/InputOption.php @@ -149,7 +149,7 @@ public function isArray() /** * Sets the default value. * - * @param mixed $default The default value + * @param string|string[]|bool $default The default value * * @throws LogicException When incorrect default value is given */ @@ -173,7 +173,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return mixed The default value + * @return string|string[]|bool The default value */ public function getDefault() { diff --git a/src/Symfony/Component/Console/Output/StreamOutput.php b/src/Symfony/Component/Console/Output/StreamOutput.php index 20f45082836f6..47da3270f1a1b 100644 --- a/src/Symfony/Component/Console/Output/StreamOutput.php +++ b/src/Symfony/Component/Console/Output/StreamOutput.php @@ -20,11 +20,11 @@ * * Usage: * - * $output = new StreamOutput(fopen('php://stdout', 'w')); + * $output = new StreamOutput(fopen('php://stdout', 'w')); * * As `StreamOutput` can use any stream, you can also use a file: * - * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); + * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); * * @author Fabien Potencier */ diff --git a/src/Symfony/Component/Console/Tests/ApplicationTest.php b/src/Symfony/Component/Console/Tests/ApplicationTest.php index 1664302dcf985..8eb01d9f59f86 100644 --- a/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -774,6 +774,31 @@ public function testRunReturnsIntegerExitCode() $this->assertSame(4, $exitCode, '->run() returns integer exit code extracted from raised exception'); } + public function testRunDispatchesIntegerExitCode() + { + $passedRightValue = false; + + // We can assume here that some other test asserts that the event is dispatched at all + $dispatcher = new EventDispatcher(); + $self = $this; + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($self, &$passedRightValue) { + $passedRightValue = (4 === $event->getExitCode()); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('test')->setCode(function (InputInterface $input, OutputInterface $output) { + throw new \Exception('', 4); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'test')); + + $this->assertTrue($passedRightValue, '-> exit code 4 was passed in the console.terminate event'); + } + public function testRunReturnsExitCodeOneForExceptionCodeZero() { $exception = new \Exception('', 0); @@ -789,6 +814,31 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero() $this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0'); } + public function testRunDispatchesExitCodeOneForExceptionCodeZero() + { + $passedRightValue = false; + + // We can assume here that some other test asserts that the event is dispatched at all + $dispatcher = new EventDispatcher(); + $self = $this; + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($self, &$passedRightValue) { + $passedRightValue = (1 === $event->getExitCode()); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('test')->setCode(function (InputInterface $input, OutputInterface $output) { + throw new \Exception(); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'test')); + + $this->assertTrue($passedRightValue, '-> exit code 1 was passed in the console.terminate event'); + } + /** * @expectedException \LogicException * @expectedExceptionMessage An option with shortcut "e" already exists. diff --git a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php index bbd0fa8f742a3..500dd190b20be 100644 --- a/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -75,6 +75,19 @@ public function testAskChoice() $this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output); } + public function testAskChoiceWithChoiceValueAsDefault() + { + $questionHelper = new SymfonyQuestionHelper(); + $helperSet = new HelperSet(array(new FormatterHelper())); + $questionHelper->setHelperSet($helperSet); + $questionHelper->setInputStream($this->getInputStream("Batman\n")); + $question = new ChoiceQuestion('What is your favorite superhero?', array('Superman', 'Batman', 'Spiderman'), 'Batman'); + $question->setMaxAttempts(1); + + $this->assertSame('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('What is your favorite superhero? [Batman]', $output); + } + public function testAskReturnsNullIfValidatorAllowsIt() { $questionHelper = new SymfonyQuestionHelper(); diff --git a/src/Symfony/Component/Console/Tests/Helper/TableTest.php b/src/Symfony/Component/Console/Tests/Helper/TableTest.php index 58c620953e051..1dadc27258c0b 100644 --- a/src/Symfony/Component/Console/Tests/Helper/TableTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/TableTest.php @@ -745,6 +745,42 @@ public function testGetStyleDefinition() Table::getStyleDefinition('absent'); } + public function testBoxedStyleWithColspan() + { + $boxed = new TableStyle(); + $boxed + ->setHorizontalBorderChar('─') + ->setVerticalBorderChar('│') + ->setCrossingChar('┼') + ; + + $table = new Table($output = $this->getOutputStream()); + $table->setStyle($boxed); + $table + ->setHeaders(array('ISBN', 'Title', 'Author')) + ->setRows(array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + new TableSeparator(), + array(new TableCell('This value spans 3 columns.', array('colspan' => 3))), + )) + ; + $table->render(); + + $expected = + <<assertSame($expected, $this->getOutputContent($output)); + } + protected function getOutputStream($decorated = false) { return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); diff --git a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php index 9290d980f6a9c..c81385e3e3f70 100644 --- a/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php +++ b/src/Symfony/Component/Console/Tests/Input/ArgvInputTest.php @@ -228,6 +228,11 @@ public function provideInvalidInput() new InputDefinition(array(new InputArgument('number'))), 'The "-1" option does not exist.', ), + array( + array('cli.php', '-fЩ'), + new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), + 'The "-Щ" option does not exist.', + ), ); } diff --git a/src/Symfony/Component/CssSelector/CssSelector.php b/src/Symfony/Component/CssSelector/CssSelector.php index b4ac866b051b3..c1f8c88829470 100644 --- a/src/Symfony/Component/CssSelector/CssSelector.php +++ b/src/Symfony/Component/CssSelector/CssSelector.php @@ -17,7 +17,7 @@ * CssSelector is the main entry point of the component and can convert CSS * selectors to XPath expressions. * - * $xpath = CssSelector::toXpath('h1.foo'); + * $xpath = CssSelector::toXpath('h1.foo'); * * This component is a port of the Python cssselect library, * which is copyright Ian Bicking, @see https://github.com/SimonSapin/cssselect. diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php index c2606b5ad4308..4d34d0ef2401b 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/FunctionExtension.php @@ -150,10 +150,7 @@ public function translateContains(XPathExpr $xpath, FunctionNode $function) $arguments = $function->getArguments(); foreach ($arguments as $token) { if (!($token->isString() || $token->isIdentifier())) { - throw new ExpressionErrorException( - 'Expected a single string or identifier for :contains(), got ' - .implode(', ', $arguments) - ); + throw new ExpressionErrorException('Expected a single string or identifier for :contains(), got '.implode(', ', $arguments)); } } @@ -173,10 +170,7 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function) $arguments = $function->getArguments(); foreach ($arguments as $token) { if (!($token->isString() || $token->isIdentifier())) { - throw new ExpressionErrorException( - 'Expected a single string or identifier for :lang(), got ' - .implode(', ', $arguments) - ); + throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments)); } } diff --git a/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php b/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php index 625ffa5cad670..cd8e0d5fd8677 100644 --- a/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php +++ b/src/Symfony/Component/CssSelector/XPath/Extension/HtmlExtension.php @@ -158,10 +158,7 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function) $arguments = $function->getArguments(); foreach ($arguments as $token) { if (!($token->isString() || $token->isIdentifier())) { - throw new ExpressionErrorException( - 'Expected a single string or identifier for :lang(), got ' - .implode(', ', $arguments) - ); + throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments)); } } diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php index 739e5b2b15b7d..a2647f57f201a 100644 --- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php @@ -64,10 +64,10 @@ public function provideUndefinedMethodData() ), array( array( - 'type' => 1, - 'message' => 'Call to undefined method class@anonymous::test()', - 'file' => '/home/possum/work/symfony/test.php', - 'line' => 11, + 'type' => 1, + 'message' => 'Call to undefined method class@anonymous::test()', + 'file' => '/home/possum/work/symfony/test.php', + 'line' => 11, ), 'Attempted to call an undefined method named "test" of class "class@anonymous".', ), diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php index f79a4b0f5b75f..ea1e089179a83 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php @@ -64,13 +64,7 @@ public function process(ContainerBuilder $container) throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); } - throw new RuntimeException(sprintf( - 'The definition for "%s" has no class. If you intend to inject ' - .'this service dynamically at runtime, please mark it as synthetic=true. ' - .'If this is an abstract definition solely used by child definitions, ' - .'please add abstract=true, otherwise specify a class to get rid of this error.', - $id - )); + throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); } // tag attribute values must be scalars diff --git a/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php b/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php index 416103ec0e69d..2b380dd352a85 100644 --- a/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php +++ b/src/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php @@ -94,12 +94,7 @@ private function validateReferences(array $arguments) $targetDefinition = $this->getDefinition((string) $argument); if (null !== $targetDefinition && $targetDefinition->isAbstract()) { - throw new RuntimeException(sprintf( - 'The definition "%s" has a reference to an abstract definition "%s". ' - .'Abstract definitions cannot be the target of references.', - $this->currentId, - $argument - )); + throw new RuntimeException(sprintf('The definition "%s" has a reference to an abstract definition "%s". Abstract definitions cannot be the target of references.', $this->currentId, $argument)); } $this->validateScope($argument, $targetDefinition); diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php index 00b34b59682cd..25532ead233d5 100644 --- a/src/Symfony/Component/DependencyInjection/Container.php +++ b/src/Symfony/Component/DependencyInjection/Container.php @@ -33,11 +33,9 @@ * A service can also be defined by creating a method named * getXXXService(), where XXX is the camelized version of the id: * - *
    - *
  • request -> getRequestService()
  • - *
  • mysql_session_storage -> getMysqlSessionStorageService()
  • - *
  • symfony.mysql_session_storage -> getSymfony_MysqlSessionStorageService()
  • - *
+ * * request -> getRequestService() + * * mysql_session_storage -> getMysqlSessionStorageService() + * * symfony.mysql_session_storage -> getSymfony_MysqlSessionStorageService() * * The container can have three possible behaviors when a service does not exist: * diff --git a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php index d78491bb96335..e7b9d575ece50 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php +++ b/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -18,5 +18,8 @@ */ interface ContainerAwareInterface { + /** + * Sets the container. + */ public function setContainer(ContainerInterface $container = null); } diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index dc09a65820587..c31eeea4177f9 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -493,10 +493,10 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV * the parameters passed to the container constructor to have precedence * over the loaded ones. * - * $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); - * $loader = new LoaderXXX($container); - * $loader->load('resource_name'); - * $container->register('foo', 'stdClass'); + * $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + * $loader = new LoaderXXX($container); + * $loader->load('resource_name'); + * $container->register('foo', 'stdClass'); * * In the above example, even if the loaded resource defines a foo * parameter, the value will still be 'bar' as defined in the ContainerBuilder @@ -999,14 +999,14 @@ private function doResolveServices($value, \SplObjectStorage $inlinedDefinitions * * Example: * - * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); + * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); * - * $serviceIds = $container->findTaggedServiceIds('my.tag'); - * foreach ($serviceIds as $serviceId => $tags) { - * foreach ($tags as $tag) { - * echo $tag['hello']; + * $serviceIds = $container->findTaggedServiceIds('my.tag'); + * foreach ($serviceIds as $serviceId => $tags) { + * foreach ($tags as $tag) { + * echo $tag['hello']; + * } * } - * } * * @param string $name The tag name * diff --git a/src/Symfony/Component/DependencyInjection/Definition.php b/src/Symfony/Component/DependencyInjection/Definition.php index 70f68469e30dc..0880646b34abd 100644 --- a/src/Symfony/Component/DependencyInjection/Definition.php +++ b/src/Symfony/Component/DependencyInjection/Definition.php @@ -79,7 +79,7 @@ public function setFactory($factory) /** * Gets the factory. * - * @return string|array The PHP function or an array containing a class/Reference and a method to call + * @return string|array|null The PHP function or an array containing a class/Reference and a method to call */ public function getFactory() { diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 82b578bec9dba..ecebe0125ec28 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -543,13 +543,7 @@ private function validateExtensions(\DOMDocument $dom, $file) // can it be handled by an extension? if (!$this->container->hasExtension($node->namespaceURI)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $node->tagName, - $file, - $node->namespaceURI, - $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } } diff --git a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index 51bc768c0fed8..d25f654709b87 100644 --- a/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -396,13 +396,7 @@ private function validate($content, $file) if (!$this->container->hasExtension($namespace)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $namespace, - $file, - $namespace, - $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php index 565a22431228f..afcfbe8cb824e 100644 --- a/src/Symfony/Component/DomCrawler/Crawler.php +++ b/src/Symfony/Component/DomCrawler/Crawler.php @@ -579,7 +579,7 @@ public function html() * * Example: * - * $crawler->filter('h1 a')->extract(array('_text', 'href')); + * $crawler->filter('h1 a')->extract(array('_text', 'href')); * * @param array $attributes An array of attributes * @@ -787,7 +787,7 @@ public function registerNamespace($prefix, $namespace) * Escaped characters are: quotes (") and apostrophe ('). * * Examples: - * + * * echo Crawler::xpathLiteral('foo " bar'); * //prints 'foo " bar' * @@ -796,7 +796,7 @@ public function registerNamespace($prefix, $namespace) * * echo Crawler::xpathLiteral('a\'b"c'); * //prints concat('a', "'", 'b"c') - * + * * * @param string $s String to be escaped * diff --git a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php index d2acb15adac06..6398cc60693ad 100644 --- a/src/Symfony/Component/DomCrawler/FormFieldRegistry.php +++ b/src/Symfony/Component/DomCrawler/FormFieldRegistry.php @@ -186,9 +186,7 @@ private function walk(array $array, $base = '', array &$output = array()) /** * Splits a field name into segments as a web browser would do. * - * * getSegments('base[foo][3][]') = array('base', 'foo, '3', ''); - * * * @param string $name The name of the field * diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php index 6303323223f9a..02d2ebe593b08 100644 --- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php +++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php @@ -936,12 +936,12 @@ public function testgetPhpValuesWithEmptyTextarea() { $dom = new \DOMDocument(); $dom->loadHTML(' - - - - - - '); + + + + + ' + ); $nodes = $dom->getElementsByTagName('form'); $form = new Form($nodes->item(0), 'http://example.com'); diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index 6a7fad69ed54e..d24d9675028f0 100644 --- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -50,6 +50,10 @@ public function testCopyUnreadableFileFails() $this->markTestSkipped('This test cannot run on Windows.'); } + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; @@ -124,6 +128,10 @@ public function testCopyWithOverrideWithReadOnlyTargetFails() $this->markTestSkipped('This test cannot run on Windows.'); } + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; @@ -161,7 +169,10 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist() */ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy() { - $sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png'; + if (!\in_array('https', stream_get_wrappers())) { + $this->markTestSkipped('"https" stream wrapper is not enabled.'); + } + $sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png'; $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($targetFilePath, 'TARGET FILE'); diff --git a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php index 6390b1f1e6e0a..635570cefd9b8 100644 --- a/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php +++ b/src/Symfony/Component/Filesystem/Tests/LockHandlerTest.php @@ -49,6 +49,10 @@ public function testErrorHandlingInLockIfLockPathBecomesUnwritable() $this->markTestSkipped('This test cannot run on Windows.'); } + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + $lockPath = sys_get_temp_dir().'/'.uniqid('', true); $e = null; $wrongMessage = null; diff --git a/src/Symfony/Component/Finder/Finder.php b/src/Symfony/Component/Finder/Finder.php index 007b68867532b..1ee9017356903 100644 --- a/src/Symfony/Component/Finder/Finder.php +++ b/src/Symfony/Component/Finder/Finder.php @@ -36,7 +36,7 @@ * * All methods return the current Finder object to allow easy chaining: * - * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); + * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); * * @author Fabien Potencier */ @@ -215,8 +215,8 @@ public function files() * * Usage: * - * $finder->depth('> 1') // the Finder will start matching at level 1. - * $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. + * $finder->depth('> 1') // the Finder will start matching at level 1. + * $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. * * @param string|int $level The depth level expression * @@ -237,10 +237,10 @@ public function depth($level) * * The date must be something that strtotime() is able to parse: * - * $finder->date('since yesterday'); - * $finder->date('until 2 days ago'); - * $finder->date('> now - 2 hours'); - * $finder->date('>= 2005-10-15'); + * $finder->date('since yesterday'); + * $finder->date('until 2 days ago'); + * $finder->date('> now - 2 hours'); + * $finder->date('>= 2005-10-15'); * * @param string $date A date range string * @@ -262,9 +262,9 @@ public function date($date) * * You can use patterns (delimited with / sign), globs or simple strings. * - * $finder->name('*.php') - * $finder->name('/\.php$/') // same as above - * $finder->name('test.php') + * $finder->name('*.php') + * $finder->name('/\.php$/') // same as above + * $finder->name('test.php') * * @param string $pattern A pattern (a regexp, a glob, or a string) * @@ -300,8 +300,8 @@ public function notName($pattern) * * Strings or PCRE patterns can be used: * - * $finder->contains('Lorem ipsum') - * $finder->contains('/Lorem ipsum/i') + * $finder->contains('Lorem ipsum') + * $finder->contains('/Lorem ipsum/i') * * @param string $pattern A pattern (string or regexp) * @@ -321,8 +321,8 @@ public function contains($pattern) * * Strings or PCRE patterns can be used: * - * $finder->notContains('Lorem ipsum') - * $finder->notContains('/Lorem ipsum/i') + * $finder->notContains('Lorem ipsum') + * $finder->notContains('/Lorem ipsum/i') * * @param string $pattern A pattern (string or regexp) * @@ -342,8 +342,8 @@ public function notContains($pattern) * * You can use patterns (delimited with / sign) or simple strings. * - * $finder->path('some/special/dir') - * $finder->path('/some\/special\/dir/') // same as above + * $finder->path('some/special/dir') + * $finder->path('/some\/special\/dir/') // same as above * * Use only / as dirname separator. * @@ -365,8 +365,8 @@ public function path($pattern) * * You can use patterns (delimited with / sign) or simple strings. * - * $finder->notPath('some/special/dir') - * $finder->notPath('/some\/special\/dir/') // same as above + * $finder->notPath('some/special/dir') + * $finder->notPath('/some\/special\/dir/') // same as above * * Use only / as dirname separator. * @@ -386,9 +386,9 @@ public function notPath($pattern) /** * Adds tests for file sizes. * - * $finder->size('> 10K'); - * $finder->size('<= 1Ki'); - * $finder->size(4); + * $finder->size('> 10K'); + * $finder->size('<= 1Ki'); + * $finder->size(4); * * @param string|int $size A size range string or an integer * @@ -699,7 +699,7 @@ public function getIterator() * * The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array. * - * @param mixed $iterator + * @param iterable $iterator * * @return $this * @@ -751,7 +751,7 @@ private function sortAdapters() } /** - * @param $dir + * @param string $dir * * @return \Iterator */ diff --git a/src/Symfony/Component/Finder/Glob.php b/src/Symfony/Component/Finder/Glob.php index 2e56cf2800511..e2988f25768ec 100644 --- a/src/Symfony/Component/Finder/Glob.php +++ b/src/Symfony/Component/Finder/Glob.php @@ -14,14 +14,14 @@ /** * Glob matches globbing patterns against text. * - * if match_glob("foo.*", "foo.bar") echo "matched\n"; + * if match_glob("foo.*", "foo.bar") echo "matched\n"; * - * // prints foo.bar and foo.baz - * $regex = glob_to_regex("foo.*"); - * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) - * { - * if (/$regex/) echo "matched: $car\n"; - * } + * // prints foo.bar and foo.baz + * $regex = glob_to_regex("foo.*"); + * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) + * { + * if (/$regex/) echo "matched: $car\n"; + * } * * Glob implements glob(3) style matching that can be used to match * against text, rather than fetching names from a filesystem. diff --git a/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php b/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php index 36e6528d019b9..a5ac93a46c82f 100644 --- a/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php +++ b/src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php @@ -29,12 +29,12 @@ public function __construct($param) parent::__construct($param); } elseif (\is_array($param)) { $defaults = array( - 'name' => 'file.txt', - 'contents' => null, - 'mode' => null, - 'type' => null, - 'relativePath' => null, - 'relativePathname' => null, + 'name' => 'file.txt', + 'contents' => null, + 'mode' => null, + 'type' => null, + 'relativePath' => null, + 'relativePathname' => null, ); $defaults = array_merge($defaults, $param); parent::__construct($defaults['name']); diff --git a/src/Symfony/Component/Form/ChoiceList/ArrayKeyChoiceList.php b/src/Symfony/Component/Form/ChoiceList/ArrayKeyChoiceList.php index b51a5a575f7dd..bfe4571e52da4 100644 --- a/src/Symfony/Component/Form/ChoiceList/ArrayKeyChoiceList.php +++ b/src/Symfony/Component/Form/ChoiceList/ArrayKeyChoiceList.php @@ -29,16 +29,14 @@ * * Example: * - * ```php - * $choices = array('' => 'Don\'t know', 0 => 'No', 1 => 'Yes'); - * $choiceList = new ArrayKeyChoiceList(array_keys($choices)); + * $choices = array('' => 'Don\'t know', 0 => 'No', 1 => 'Yes'); + * $choiceList = new ArrayKeyChoiceList(array_keys($choices)); * - * $values = $choiceList->getValues() - * // => array('', '0', '1') + * $values = $choiceList->getValues() + * // => array('', '0', '1') * - * $selectedValues = $choiceList->getValuesForChoices(array(true)); - * // => array('1') - * ``` + * $selectedValues = $choiceList->getValuesForChoices(array(true)); + * // => array('1') * * @author Bernhard Schussek * @@ -72,10 +70,7 @@ class ArrayKeyChoiceList extends ArrayChoiceList public static function toArrayKey($choice) { if (!is_scalar($choice) && null !== $choice) { - throw new InvalidArgumentException(sprintf( - 'The value of type "%s" cannot be converted to a valid array key.', - \gettype($choice) - )); + throw new InvalidArgumentException(sprintf('The value of type "%s" cannot be converted to a valid array key.', \gettype($choice))); } if (\is_bool($choice) || (string) (int) $choice === (string) $choice) { diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php index 146669b27f7e7..ee749ca029ae2 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/PropertyAccessDecorator.php @@ -24,18 +24,14 @@ * * Pass the decorated factory to the constructor: * - * ```php - * $decorator = new PropertyAccessDecorator($factory); - * ``` + * $decorator = new PropertyAccessDecorator($factory); * * You can now pass property paths for generating choice values, labels, view * indices, HTML attributes and for determining the preferred choices and the * choice groups: * - * ```php - * // extract values from the $value property - * $list = $createListFromChoices($objects, 'value'); - * ``` + * // extract values from the $value property + * $list = $createListFromChoices($objects, 'value'); * * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php b/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php index 8e4695011fea9..ec3857aa8729c 100644 --- a/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php +++ b/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php @@ -28,11 +28,9 @@ * can be stored in the array key pointing to the nested array. The topmost * level of the hierarchy may also be a \Traversable. * - * - * $choices = array(true, false); - * $labels = array('Agree', 'Disagree'); - * $choiceList = new ArrayChoiceList($choices, $labels); - * + * $choices = array(true, false); + * $labels = array('Agree', 'Disagree'); + * $choiceList = new ArrayChoiceList($choices, $labels); * * @author Bernhard Schussek * diff --git a/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php b/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php index 67a783284f44a..265d85691a211 100644 --- a/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php +++ b/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php @@ -26,12 +26,10 @@ * Supports generation of choice labels, choice groups and choice values * by calling getters of the object (or associated objects). * - * - * $choices = array($user1, $user2); + * $choices = array($user1, $user2); * - * // call getName() to determine the choice labels - * $choiceList = new ObjectChoiceList($choices, 'name'); - * + * // call getName() to determine the choice labels + * $choiceList = new ObjectChoiceList($choices, 'name'); * * @author Bernhard Schussek * diff --git a/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php b/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php index 7255b1254ee35..47500045ed7d7 100644 --- a/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php +++ b/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php @@ -22,12 +22,10 @@ * creating nested arrays. The title of the sub-hierarchy can be stored in the * array key pointing to the nested array. * - * - * $choiceList = new SimpleChoiceList(array( - * 'creditcard' => 'Credit card payment', - * 'cash' => 'Cash payment', - * )); - * + * $choiceList = new SimpleChoiceList(array( + * 'creditcard' => 'Credit card payment', + * 'cash' => 'Cash payment', + * )); * * @author Bernhard Schussek * diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php index 53d4deddd379c..b09fba8532d48 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php @@ -76,9 +76,7 @@ public function reverseTransform($array) return; } - throw new TransformationFailedException( - sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys) - )); + throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys))); } return $result; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php index aeb6abb42d142..2dcb702b8133d 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php @@ -135,9 +135,7 @@ public function reverseTransform($value) } if (\count($emptyFields) > 0) { - throw new TransformationFailedException( - sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields) - )); + throw new TransformationFailedException(sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields))); } if (isset($value['month']) && !ctype_digit((string) $value['month'])) { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php new file mode 100644 index 0000000000000..ed90331266443 --- /dev/null +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformer.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Franz Wilding + * @author Bernhard Schussek + * @author Fred Cox + */ +class DateTimeToHtml5LocalDateTimeTransformer extends BaseDateTimeTransformer +{ + const HTML5_FORMAT = 'Y-m-d\\TH:i:s'; + + /** + * Transforms a \DateTime into a local date and time string. + * + * According to the HTML standard, the input string of a datetime-local + * input is a RFC3339 date followed by 'T', followed by a RFC3339 time. + * https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-local-date-and-time-string + * + * @param \DateTime|\DateTimeInterface $dateTime A DateTime object + * + * @return string The formatted date + * + * @throws TransformationFailedException If the given value is not an + * instance of \DateTime or \DateTimeInterface + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return ''; + } + + if (!$dateTime instanceof \DateTime && !$dateTime instanceof \DateTimeInterface) { + throw new TransformationFailedException('Expected a \DateTime or \DateTimeInterface.'); + } + + if ($this->inputTimezone !== $this->outputTimezone) { + if (!$dateTime instanceof \DateTimeImmutable) { + $dateTime = clone $dateTime; + } + + $dateTime = $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + } + + return $dateTime->format(self::HTML5_FORMAT); + } + + /** + * Transforms a local date and time string into a \DateTime. + * + * When transforming back to DateTime the regex is slightly laxer, taking into + * account rules for parsing a local date and time string + * https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#parse-a-local-date-and-time-string + * + * @param string $dateTimeLocal Formatted string + * + * @return \DateTime Normalized date + * + * @throws TransformationFailedException If the given value is not a string, + * if the value could not be transformed + */ + public function reverseTransform($dateTimeLocal) + { + if (!\is_string($dateTimeLocal)) { + throw new TransformationFailedException('Expected a string.'); + } + + if ('' === $dateTimeLocal) { + return; + } + + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})[T ]\d{2}:\d{2}(?::\d{2})?$/', $dateTimeLocal, $matches)) { + throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $dateTimeLocal)); + } + + try { + $dateTime = new \DateTime($dateTimeLocal, new \DateTimeZone($this->outputTimezone)); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + + if ($this->inputTimezone !== $dateTime->getTimezone()->getName()) { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } + + if (!checkdate($matches[2], $matches[3], $matches[1])) { + throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3])); + } + + return $dateTime; + } +} diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php index 7e72f9a11d87b..8d1a92af8b4bc 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -69,6 +69,10 @@ public function reverseTransform($rfc3339) return; } + if (!preg_match('/^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2})?(?:\.\d)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))$/', $rfc3339, $matches)) { + throw new TransformationFailedException(sprintf('The date "%s" is not a valid date.', $rfc3339)); + } + try { $dateTime = new \DateTime($rfc3339); } catch (\Exception $e) { @@ -79,15 +83,8 @@ public function reverseTransform($rfc3339) $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); } - if (preg_match('/(\d{4})-(\d{2})-(\d{2})/', $rfc3339, $matches)) { - if (!checkdate($matches[2], $matches[3], $matches[1])) { - throw new TransformationFailedException(sprintf( - 'The date "%s-%s-%s" is not a valid date.', - $matches[1], - $matches[2], - $matches[3] - )); - } + if (!checkdate($matches[2], $matches[3], $matches[1])) { + throw new TransformationFailedException(sprintf('The date "%s-%s-%s" is not a valid date.', $matches[1], $matches[2], $matches[3])); } return $dateTime; diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php index cb274603155d6..3eca981b4b15e 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php @@ -126,12 +126,7 @@ public function reverseTransform($value) $lastErrors = \DateTime::getLastErrors(); if (0 < $lastErrors['warning_count'] || 0 < $lastErrors['error_count']) { - throw new TransformationFailedException( - implode(', ', array_merge( - array_values($lastErrors['warnings']), - array_values($lastErrors['errors']) - )) - ); + throw new TransformationFailedException(implode(', ', array_merge(array_values($lastErrors['warnings']), array_values($lastErrors['errors'])))); } try { diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php index 2d166324abf78..531d6289841e9 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php @@ -225,9 +225,7 @@ public function reverseTransform($value) $remainder = trim($remainder, " \t\n\r\0\x0b\xc2\xa0"); if ('' !== $remainder) { - throw new TransformationFailedException( - sprintf('The number contains unrecognized characters: "%s"', $remainder) - ); + throw new TransformationFailedException(sprintf('The number contains unrecognized characters: "%s"', $remainder)); } } diff --git a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php index c9adb0ad5a6fa..49032a6777c83 100644 --- a/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php +++ b/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php @@ -64,9 +64,7 @@ public function reverseTransform($array) foreach ($this->keys as $key) { if (isset($array[$key]) && '' !== $array[$key] && false !== $array[$key] && array() !== $array[$key]) { if ($array[$key] !== $result) { - throw new TransformationFailedException( - 'All values in the array should be the same' - ); + throw new TransformationFailedException('All values in the array should be the same'); } } else { $emptyKeys[] = $key; @@ -79,9 +77,7 @@ public function reverseTransform($array) return; } - throw new TransformationFailedException( - sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys) - )); + throw new TransformationFailedException(sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys))); } return $result; diff --git a/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php b/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php index 5f9289280b961..559a70f69858e 100644 --- a/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php +++ b/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php @@ -66,10 +66,7 @@ public function preSubmit(FormEvent $event) } if (\count($submittedValues) > 0) { - throw new TransformationFailedException(sprintf( - 'The following choices were not found: "%s"', - implode('", "', array_keys($submittedValues)) - )); + throw new TransformationFailedException(sprintf('The following choices were not found: "%s"', implode('", "', array_keys($submittedValues)))); } } elseif ('' === $data || null === $data) { // Empty values are always accepted. diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index 63bea89cd60d0..6ae6cfe3a2daa 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -132,10 +132,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) // Throw exception if unknown values were submitted if (\count($unknownValues) > 0) { - throw new TransformationFailedException(sprintf( - 'The choices "%s" do not exist in the choice list.', - implode('", "', array_keys($unknownValues)) - )); + throw new TransformationFailedException(sprintf('The choices "%s" do not exist in the choice list.', implode('", "', array_keys($unknownValues)))); } $event->setData($data); diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php index e6598a3f10cd0..c3f95f59af03c 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php @@ -15,8 +15,8 @@ use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToHtml5LocalDateTimeTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer; -use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; use Symfony\Component\Form\FormBuilderInterface; @@ -33,21 +33,8 @@ class DateTimeType extends AbstractType const DEFAULT_TIME_FORMAT = \IntlDateFormatter::MEDIUM; /** - * This is not quite the HTML5 format yet, because ICU lacks the - * capability of parsing and generating RFC 3339 dates. - * - * For more information see: - * - * http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax - * https://www.w3.org/TR/html5/sec-forms.html#local-date-and-time-state-typedatetimelocal - * http://tools.ietf.org/html/rfc3339 - * - * An ICU ticket was created: - * http://icu-project.org/trac/ticket/9421 - * - * It was supposedly fixed, but is not available in all PHP installations - * yet. To temporarily circumvent this issue, DateTimeToRfc3339Transformer - * is used when the format matches this constant. + * The HTML5 datetime-local format as defined in + * http://w3c.github.io/html-reference/datatypes.html#form.data.datetime-local. */ const HTML5_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; @@ -88,7 +75,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) if ('single_text' === $options['widget']) { if (self::HTML5_FORMAT === $pattern) { - $builder->addViewTransformer(new DateTimeToRfc3339Transformer( + $builder->addViewTransformer(new DateTimeToHtml5LocalDateTimeTransformer( $options['model_timezone'], $options['view_timezone'] )); @@ -134,6 +121,11 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'invalid_message_parameters', ))); + if (false === $options['label']) { + $dateOptions['label'] = false; + $timeOptions['label'] = false; + } + if (null !== $options['date_widget']) { $dateOptions['widget'] = $options['date_widget']; } diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index b5dc3213d3baa..ad4499899a3ba 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -77,6 +77,18 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'error_bubbling' => true, ); + if (isset($options['invalid_message'])) { + $dayOptions['invalid_message'] = $options['invalid_message']; + $monthOptions['invalid_message'] = $options['invalid_message']; + $yearOptions['invalid_message'] = $options['invalid_message']; + } + + if (isset($options['invalid_message_parameters'])) { + $dayOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $monthOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $yearOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + } + $formatter = new \IntlDateFormatter( \Locale::getDefault(), $dateFormat, diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 37357be199f11..4a27cd440b665 100644 --- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -72,6 +72,18 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'error_bubbling' => true, ); + if (isset($options['invalid_message'])) { + $hourOptions['invalid_message'] = $options['invalid_message']; + $minuteOptions['invalid_message'] = $options['invalid_message']; + $secondOptions['invalid_message'] = $options['invalid_message']; + } + + if (isset($options['invalid_message_parameters'])) { + $hourOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $minuteOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + $secondOptions['invalid_message_parameters'] = $options['invalid_message_parameters']; + } + if ('choice' === $options['widget']) { $hours = $minutes = array(); diff --git a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php index 73683e426827b..9a0866f5229a7 100644 --- a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php +++ b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php @@ -43,13 +43,7 @@ public function getType($name) // BC: validate result of getName() for legacy names (non-FQCN) if ($name !== \get_class($type) && $type->getName() !== $name) { - throw new InvalidArgumentException( - sprintf('The type name specified for the service "%s" does not match the actual name. Expected "%s", given "%s"', - $this->typeServiceIds[$name], - $name, - $type->getName() - ) - ); + throw new InvalidArgumentException(sprintf('The type name specified for the service "%s" does not match the actual name. Expected "%s", given "%s"', $this->typeServiceIds[$name], $name, $type->getName())); } return $type; @@ -70,13 +64,7 @@ public function getTypeExtensions($name) // validate result of getExtendedType() to ensure it is consistent with the service definition if ($extension->getExtendedType() !== $name) { - throw new InvalidArgumentException( - sprintf('The extended type specified for the service "%s" does not match the actual extended type. Expected "%s", given "%s".', - $serviceId, - $name, - $extension->getExtendedType() - ) - ); + throw new InvalidArgumentException(sprintf('The extended type specified for the service "%s" does not match the actual extended type. Expected "%s", given "%s".', $serviceId, $name, $extension->getExtendedType())); } } } diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index 21551f36bbde3..fc6f2abe51679 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -211,7 +211,7 @@ private static function allowDataWalking(FormInterface $form) /** * Returns the validation groups of the given form. * - * @return array The validation groups + * @return string|GroupSequence|(string|GroupSequence)[] The validation groups */ private static function getValidationGroups(FormInterface $form) { @@ -246,10 +246,10 @@ private static function getValidationGroups(FormInterface $form) /** * Post-processes the validation groups option for a given form. * - * @param array|callable $groups The validation groups - * @param FormInterface $form The validated form + * @param string|GroupSequence|(string|GroupSequence)[]|callable $groups The validation groups + * @param FormInterface $form The validated form * - * @return array The validation groups + * @return (string|GroupSequence)[] The validation groups */ private static function resolveValidationGroups($groups, FormInterface $form) { diff --git a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php index 805150f2d1d00..19020c7a6926a 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php +++ b/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php @@ -198,9 +198,7 @@ public function isIndex($index) * * Consider the following violation path: * - * - * children[address].children[office].data.street - * + * children[address].children[office].data.street * * In this example, "address" and "office" map to forms, while * "street does not. diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php index 819ce7273904b..923407383159b 100644 --- a/src/Symfony/Component/Form/Form.php +++ b/src/Symfony/Component/Form/Form.php @@ -359,13 +359,7 @@ public function setData($modelData) ? 'an instance of class '.\get_class($viewData) : 'a(n) '.\gettype($viewData); - throw new LogicException( - 'The form\'s view data is expected to be an instance of class '. - $dataClass.', but is '.$actualType.'. You can avoid this error '. - 'by setting the "data_class" option to null or by adding a view '. - 'transformer that transforms '.$actualType.' to an instance of '. - $dataClass.'.' - ); + throw new LogicException('The form\'s view data is expected to be an instance of class '.$dataClass.', but is '.$actualType.'. You can avoid this error by setting the "data_class" option to null or by adding a view transformer that transforms '.$actualType.' to an instance of '.$dataClass.'.'); } } @@ -915,11 +909,7 @@ public function add($child, $type = null, array $options = array()) $child = $this->config->getFormFactory()->createNamed($child, $type, null, $options); } } elseif ($child->getConfig()->getAutoInitialize()) { - throw new RuntimeException(sprintf( - 'Automatic initialization is only supported on root forms. You '. - 'should set the "auto_initialize" option to false on the field "%s".', - $child->getName() - )); + throw new RuntimeException(sprintf('Automatic initialization is only supported on root forms. You should set the "auto_initialize" option to false on the field "%s".', $child->getName())); } $this->children[$child->getName()] = $child; @@ -1093,11 +1083,7 @@ private function modelToNorm($value) $value = $transformer->transform($value); } } catch (TransformationFailedException $exception) { - throw new TransformationFailedException( - 'Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), - $exception->getCode(), - $exception - ); + throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception); } return $value; @@ -1121,11 +1107,7 @@ private function normToModel($value) $value = $transformers[$i]->reverseTransform($value); } } catch (TransformationFailedException $exception) { - throw new TransformationFailedException( - 'Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), - $exception->getCode(), - $exception - ); + throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception); } return $value; @@ -1156,11 +1138,7 @@ private function normToView($value) $value = $transformer->transform($value); } } catch (TransformationFailedException $exception) { - throw new TransformationFailedException( - 'Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), - $exception->getCode(), - $exception - ); + throw new TransformationFailedException('Unable to transform value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception); } return $value; @@ -1188,11 +1166,7 @@ private function viewToNorm($value) $value = $transformers[$i]->reverseTransform($value); } } catch (TransformationFailedException $exception) { - throw new TransformationFailedException( - 'Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), - $exception->getCode(), - $exception - ); + throw new TransformationFailedException('Unable to reverse value for property path "'.$this->getPropertyPath().'": '.$exception->getMessage(), $exception->getCode(), $exception); } return $value; diff --git a/src/Symfony/Component/Form/FormConfigBuilder.php b/src/Symfony/Component/Form/FormConfigBuilder.php index 34d5664e9f174..e2ab1310a6570 100644 --- a/src/Symfony/Component/Form/FormConfigBuilder.php +++ b/src/Symfony/Component/Form/FormConfigBuilder.php @@ -821,11 +821,7 @@ public function setMethod($method) $upperCaseMethod = strtoupper($method); if (!\in_array($upperCaseMethod, self::$allowedMethods)) { - throw new InvalidArgumentException(sprintf( - 'The form method is "%s", but should be one of "%s".', - $method, - implode('", "', self::$allowedMethods) - )); + throw new InvalidArgumentException(sprintf('The form method is "%s", but should be one of "%s".', $method, implode('", "', self::$allowedMethods))); } $this->method = $upperCaseMethod; @@ -892,10 +888,7 @@ public static function validateName($name) } if (!self::isValidName($name)) { - throw new InvalidArgumentException(sprintf( - 'The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', - $name - )); + throw new InvalidArgumentException(sprintf('The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").', $name)); } } diff --git a/src/Symfony/Component/Form/FormErrorIterator.php b/src/Symfony/Component/Form/FormErrorIterator.php index 672029071befd..26bb23a129e86 100644 --- a/src/Symfony/Component/Form/FormErrorIterator.php +++ b/src/Symfony/Component/Form/FormErrorIterator.php @@ -50,12 +50,7 @@ public function __construct(FormInterface $form, array $errors) { foreach ($errors as $error) { if (!($error instanceof FormError || $error instanceof self)) { - throw new InvalidArgumentException(sprintf( - 'The errors must be instances of '. - '"\Symfony\Component\Form\FormError" or "%s". Got: "%s".', - __CLASS__, - \is_object($error) ? \get_class($error) : \gettype($error) - )); + throw new InvalidArgumentException(sprintf('The errors must be instances of "Symfony\Component\Form\FormError" or "%s". Got: "%s".', __CLASS__, \is_object($error) ? \get_class($error) : \gettype($error))); } } diff --git a/src/Symfony/Component/Form/FormRendererEngineInterface.php b/src/Symfony/Component/Form/FormRendererEngineInterface.php index e2300ef5a2dd2..d283837432c42 100644 --- a/src/Symfony/Component/Form/FormRendererEngineInterface.php +++ b/src/Symfony/Component/Form/FormRendererEngineInterface.php @@ -53,11 +53,9 @@ public function getResourceForBlockName(FormView $view, $blockName); * and continues with the child of that root, the child of that child etc. * The following is an example for a block hierarchy: * - * - * form_widget - * text_widget - * url_widget - * + * form_widget + * text_widget + * url_widget * * In this example, "url_widget" is the most specific block, while the other * blocks are its ancestors in the hierarchy. @@ -91,11 +89,9 @@ public function getResourceForBlockNameHierarchy(FormView $view, array $blockNam * and continues with the child of that root, the child of that child etc. * The following is an example for a block hierarchy: * - * - * form_widget - * text_widget - * url_widget - * + * form_widget + * text_widget + * url_widget * * The second parameter $hierarchyLevel determines the level of the hierarchy * that should be rendered. diff --git a/src/Symfony/Component/Form/FormRendererInterface.php b/src/Symfony/Component/Form/FormRendererInterface.php index f0f51e4f59251..edddeff5b78dd 100644 --- a/src/Symfony/Component/Form/FormRendererInterface.php +++ b/src/Symfony/Component/Form/FormRendererInterface.php @@ -69,18 +69,14 @@ public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $va * Use this helper for CSRF protection without the overhead of creating a * form. * - * - * - * + * * * Check the token in your action using the same token ID. * - * - * $csrfProvider = $this->get('security.csrf.token_generator'); - * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { - * throw new \RuntimeException('CSRF attack detected.'); - * } - * + * $csrfProvider = $this->get('security.csrf.token_generator'); + * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) { + * throw new \RuntimeException('CSRF attack detected.'); + * } * * @param string $tokenId The ID of the CSRF token * diff --git a/src/Symfony/Component/Form/Forms.php b/src/Symfony/Component/Form/Forms.php index 2a47513f61a25..079ceda750d44 100644 --- a/src/Symfony/Component/Form/Forms.php +++ b/src/Symfony/Component/Form/Forms.php @@ -18,29 +18,25 @@ * * Use this class to conveniently create new form factories: * - * - * use Symfony\Component\Form\Forms; - * - * $formFactory = Forms::createFormFactory(); - * - * $form = $formFactory->createBuilder() - * ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType') - * ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType') - * ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType') - * ->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array( - * 'choices' => array('Male' => 'm', 'Female' => 'f'), - * 'choices_as_values' => true, - * )) - * ->getForm(); - * + * use Symfony\Component\Form\Forms; + * + * $formFactory = Forms::createFormFactory(); + * + * $form = $formFactory->createBuilder() + * ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType') + * ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType') + * ->add('age', 'Symfony\Component\Form\Extension\Core\Type\IntegerType') + * ->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array( + * 'choices' => array('Male' => 'm', 'Female' => 'f'), + * 'choices_as_values' => true, + * )) + * ->getForm(); * * You can also add custom extensions to the form factory: * - * - * $formFactory = Forms::createFormFactoryBuilder() - * ->addExtension(new AcmeExtension()) - * ->getFormFactory(); - * + * $formFactory = Forms::createFormFactoryBuilder() + * ->addExtension(new AcmeExtension()) + * ->getFormFactory(); * * If you create custom form types or type extensions, it is * generally recommended to create your own extensions that lazily @@ -48,54 +44,46 @@ * does not matter that much, you can also pass them directly to the * form factory: * - * - * $formFactory = Forms::createFormFactoryBuilder() - * ->addType(new PersonType()) - * ->addType(new PhoneNumberType()) - * ->addTypeExtension(new FormTypeHelpTextExtension()) - * ->getFormFactory(); - * + * $formFactory = Forms::createFormFactoryBuilder() + * ->addType(new PersonType()) + * ->addType(new PhoneNumberType()) + * ->addTypeExtension(new FormTypeHelpTextExtension()) + * ->getFormFactory(); * * Support for the Validator component is provided by ValidatorExtension. * This extension needs a validator object to function properly: * - * - * use Symfony\Component\Validator\Validation; - * use Symfony\Component\Form\Extension\Validator\ValidatorExtension; + * use Symfony\Component\Validator\Validation; + * use Symfony\Component\Form\Extension\Validator\ValidatorExtension; * - * $validator = Validation::createValidator(); - * $formFactory = Forms::createFormFactoryBuilder() - * ->addExtension(new ValidatorExtension($validator)) - * ->getFormFactory(); - * + * $validator = Validation::createValidator(); + * $formFactory = Forms::createFormFactoryBuilder() + * ->addExtension(new ValidatorExtension($validator)) + * ->getFormFactory(); * * Support for the Templating component is provided by TemplatingExtension. * This extension needs a PhpEngine object for rendering forms. As second * argument you should pass the names of the default themes. Here is an * example for using the default layout with "
" tags: * - * - * use Symfony\Component\Form\Extension\Templating\TemplatingExtension; + * use Symfony\Component\Form\Extension\Templating\TemplatingExtension; * - * $formFactory = Forms::createFormFactoryBuilder() - * ->addExtension(new TemplatingExtension($engine, null, array( - * 'FrameworkBundle:Form', - * ))) - * ->getFormFactory(); - * + * $formFactory = Forms::createFormFactoryBuilder() + * ->addExtension(new TemplatingExtension($engine, null, array( + * 'FrameworkBundle:Form', + * ))) + * ->getFormFactory(); * * The next example shows how to include the "
" layout: * - * - * use Symfony\Component\Form\Extension\Templating\TemplatingExtension; + * use Symfony\Component\Form\Extension\Templating\TemplatingExtension; * - * $formFactory = Forms::createFormFactoryBuilder() - * ->addExtension(new TemplatingExtension($engine, null, array( - * 'FrameworkBundle:Form', - * 'FrameworkBundle:FormTable', - * ))) - * ->getFormFactory(); - * + * $formFactory = Forms::createFormFactoryBuilder() + * ->addExtension(new TemplatingExtension($engine, null, array( + * 'FrameworkBundle:Form', + * 'FrameworkBundle:FormTable', + * ))) + * ->getFormFactory(); * * @author Bernhard Schussek */ diff --git a/src/Symfony/Component/Form/ResolvedFormType.php b/src/Symfony/Component/Form/ResolvedFormType.php index 7837a95b9da95..b8a252ec3acab 100644 --- a/src/Symfony/Component/Form/ResolvedFormType.php +++ b/src/Symfony/Component/Form/ResolvedFormType.php @@ -86,11 +86,7 @@ public function __construct(FormTypeInterface $innerType, array $typeExtensions // As of Symfony 2.8, getName() returns the FQCN by default // Otherwise check that the name matches the old naming restrictions if ($hasCustomName && !preg_match('/^[a-z0-9_]*$/i', $name)) { - throw new InvalidArgumentException(sprintf( - 'The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".', - \get_class($innerType), - $name - )); + throw new InvalidArgumentException(sprintf('The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".', \get_class($innerType), $name)); } foreach ($typeExtensions as $extension) { diff --git a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php index a6d8dc7411d99..01440575a1126 100644 --- a/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php +++ b/src/Symfony/Component/Form/Test/FormPerformanceTestCase.php @@ -36,14 +36,7 @@ protected function runTest() $time = microtime(true) - $s; if (0 != $this->maxRunningTime && $time > $this->maxRunningTime) { - $this->fail( - sprintf( - 'expected running time: <= %s but was: %s', - - $this->maxRunningTime, - $time - ) - ); + $this->fail(sprintf('expected running time: <= %s but was: %s', $this->maxRunningTime, $time)); } } diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php index 576b29e52616d..ef3c17a4c692d 100644 --- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php @@ -1603,7 +1603,7 @@ public function testDateTimeWithWidgetSingleText() [@type="datetime-local"] [@name="name"] [@class="my&class form-control"] - [@value="2011-02-03T04:05:06Z"] + [@value="2011-02-03T04:05:06"] ' ); } @@ -1624,7 +1624,7 @@ public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets() [@type="datetime-local"] [@name="name"] [@class="my&class form-control"] - [@value="2011-02-03T04:05:06Z"] + [@value="2011-02-03T04:05:06"] ' ); } diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index fbeab910928bc..1d5ebc96a2952 100644 --- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -1502,7 +1502,7 @@ public function testDateTimeWithWidgetSingleText() '/input [@type="datetime-local"] [@name="name"] - [@value="2011-02-03T04:05:06Z"] + [@value="2011-02-03T04:05:06"] ' ); } @@ -1522,7 +1522,7 @@ public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets() '/input [@type="datetime-local"] [@name="name"] - [@value="2011-02-03T04:05:06Z"] + [@value="2011-02-03T04:05:06"] ' ); } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php new file mode 100644 index 0000000000000..5dac998ad16a5 --- /dev/null +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToHtml5LocalDateTimeTransformerTest.php @@ -0,0 +1,129 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToHtml5LocalDateTimeTransformer; + +class DateTimeToHtml5LocalDateTimeTransformerTest extends TestCase +{ + public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) + { + if ($expected instanceof \DateTime && $actual instanceof \DateTime) { + $expected = $expected->format('c'); + $actual = $actual->format('c'); + } + + parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase); + } + + public function transformProvider() + { + return array( + array('UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06'), + array('UTC', 'UTC', null, ''), + array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:06 America/New_York', '2010-02-03T17:05:06'), + array('America/New_York', 'Asia/Hong_Kong', null, ''), + array('UTC', 'Asia/Hong_Kong', '2010-02-03 04:05:06 UTC', '2010-02-03T12:05:06'), + array('America/New_York', 'UTC', '2010-02-03 04:05:06 America/New_York', '2010-02-03T09:05:06'), + ); + } + + public function reverseTransformProvider() + { + return array( + // format without seconds, as appears in some browsers + array('UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06'), + array('UTC', 'UTC', null, ''), + array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:06 America/New_York', '2010-02-03T17:05:06'), + array('America/New_York', 'Asia/Hong_Kong', null, ''), + array('UTC', 'Asia/Hong_Kong', '2010-02-03 04:05:06 UTC', '2010-02-03T12:05:06'), + array('America/New_York', 'UTC', '2010-02-03 04:05:06 America/New_York', '2010-02-03T09:05:06'), + array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05'), + array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05'), + array('Europe/Amsterdam', 'Europe/Amsterdam', '2013-08-21 10:30:00 Europe/Amsterdam', '2013-08-21T10:30:00'), + ); + } + + /** + * @dataProvider transformProvider + */ + public function testTransform($fromTz, $toTz, $from, $to) + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer($fromTz, $toTz); + + $this->assertSame($to, $transformer->transform(null !== $from ? new \DateTime($from) : null)); + } + + /** + * @dataProvider transformProvider + * @requires PHP 5.5 + */ + public function testTransformDateTimeImmutable($fromTz, $toTz, $from, $to) + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer($fromTz, $toTz); + + $this->assertSame($to, $transformer->transform(null !== $from ? new \DateTimeImmutable($from) : null)); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testTransformRequiresValidDateTime() + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer(); + $transformer->transform('2010-01-01'); + } + + /** + * @dataProvider reverseTransformProvider + */ + public function testReverseTransform($toTz, $fromTz, $to, $from) + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer($toTz, $fromTz); + + if (null !== $to) { + $this->assertEquals(new \DateTime($to), $transformer->reverseTransform($from)); + } else { + $this->assertNull($transformer->reverseTransform($from)); + } + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformRequiresString() + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer(); + $transformer->reverseTransform(12345); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformWithNonExistingDate() + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer('UTC', 'UTC'); + + $transformer->reverseTransform('2010-04-31T04:05'); + } + + /** + * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformExpectsValidDateString() + { + $transformer = new DateTimeToHtml5LocalDateTimeTransformer('UTC', 'UTC'); + + $transformer->reverseTransform('2010-2010-2010'); + } +} diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php index c02d3dd6950b9..5f4043523e73f 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -134,12 +134,25 @@ public function testReverseTransformWithNonExistingDate() } /** + * @dataProvider invalidDateStringProvider * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException */ - public function testReverseTransformExpectsValidDateString() + public function testReverseTransformExpectsValidDateString($date) { $transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC'); - $transformer->reverseTransform('2010-2010-2010'); + $transformer->reverseTransform($date); + } + + public function invalidDateStringProvider() + { + return array( + 'invalid month' => array('2010-2010-01'), + 'invalid day' => array('2010-10-2010'), + 'no date' => array('x'), + 'cookie format' => array('Saturday, 01-May-2010 04:05:00 Z'), + 'RFC 822 format' => array('Sat, 01 May 10 04:05:00 +0000'), + 'RSS format' => array('Sat, 01 May 2010 04:05:00 +0000'), + ); } } diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index f4bc3f8827276..27c6581f0bea0 100644 --- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -221,12 +221,12 @@ public function testSubmitDifferentTimezonesDateTime() $outputTime = new \DateTime('2010-06-02 03:04:00 Pacific/Tahiti'); - $form->submit('2010-06-02T03:04:00-10:00'); + $form->submit('2010-06-02T03:04:00'); $outputTime->setTimezone(new \DateTimeZone('America/New_York')); $this->assertEquals($outputTime, $form->getData()); - $this->assertEquals('2010-06-02T03:04:00-10:00', $form->getViewData()); + $this->assertEquals('2010-06-02T03:04:00', $form->getViewData()); } public function testSubmitStringSingleText() @@ -238,10 +238,10 @@ public function testSubmitStringSingleText() 'widget' => 'single_text', )); - $form->submit('2010-06-02T03:04:00Z'); + $form->submit('2010-06-02T03:04:00'); $this->assertEquals('2010-06-02 03:04:00', $form->getData()); - $this->assertEquals('2010-06-02T03:04:00Z', $form->getViewData()); + $this->assertEquals('2010-06-02T03:04:00', $form->getViewData()); } public function testSubmitStringSingleTextWithSeconds() @@ -254,10 +254,10 @@ public function testSubmitStringSingleTextWithSeconds() 'with_seconds' => true, )); - $form->submit('2010-06-02T03:04:05Z'); + $form->submit('2010-06-02T03:04:05'); $this->assertEquals('2010-06-02 03:04:05', $form->getData()); - $this->assertEquals('2010-06-02T03:04:05Z', $form->getViewData()); + $this->assertEquals('2010-06-02T03:04:05', $form->getViewData()); } public function testSubmitDifferentPattern() diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index a29037279a698..85b5a53f4fb10 100644 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -1367,7 +1367,7 @@ public function setFormat($format, $mimeTypes) * * _format request parameter * * $default * - * @param string $default The default format + * @param string|null $default The default format * * @return string The request format */ diff --git a/src/Symfony/Component/HttpFoundation/Session/Session.php b/src/Symfony/Component/HttpFoundation/Session/Session.php index 725b97ea4ec16..8293cf287156e 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Session.php +++ b/src/Symfony/Component/HttpFoundation/Session/Session.php @@ -178,7 +178,9 @@ public function getId() */ public function setId($id) { - $this->storage->setId($id); + if ($this->storage->getId() !== $id) { + $this->storage->setId($id); + } } /** diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index 9575e4e9a7c76..ad54b6c4b91c0 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -43,9 +43,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface public function __construct(\Memcache $memcache, array $options = array()) { if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } $this->memcache = $memcache; diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index 2c45face4da09..1191a411d5bc2 100644 --- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -50,9 +50,7 @@ public function __construct(\Memcached $memcached, array $options = array()) $this->memcached = $memcached; if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; diff --git a/src/Symfony/Component/HttpFoundation/StreamedResponse.php b/src/Symfony/Component/HttpFoundation/StreamedResponse.php index 8552d7130580f..ed1c5ff3ece19 100644 --- a/src/Symfony/Component/HttpFoundation/StreamedResponse.php +++ b/src/Symfony/Component/HttpFoundation/StreamedResponse.php @@ -123,6 +123,8 @@ public function setContent($content) if (null !== $content) { throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); } + + $this->streamed = true; } /** @@ -134,16 +136,4 @@ public function getContent() { return false; } - - /** - * {@inheritdoc} - * - * @return $this - */ - public function setNotModified() - { - $this->setCallback(function () {}); - - return parent::setNotModified(); - } } diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index 8e3d55ecbd5dc..acd5513896579 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -70,6 +70,27 @@ public function testSetId() $this->assertEquals('0123456789abcdef', $this->session->getId()); } + public function testSetIdAfterStart() + { + $this->session->start(); + $id = $this->session->getId(); + + $e = null; + try { + $this->session->setId($id); + } catch (\Exception $e) { + } + + $this->assertNull($e); + + try { + $this->session->setId('different'); + } catch (\Exception $e) { + } + + $this->assertInstanceOf('\LogicException', $e); + } + public function testSetName() { $this->assertEquals('MOCKSESSID', $this->session->getName()); diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 0c182e0b0bf57..893e120ce166e 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -48,7 +48,7 @@ protected function setUp() $this->data = array( $this->attributes->getStorageKey() => array('foo' => 'bar'), $this->flashes->getStorageKey() => array('notice' => 'hello'), - ); + ); $this->storage = new MockArraySessionStorage(); $this->storage->registerBag($this->flashes); diff --git a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php index c99862a10f4bb..11d93d77092ca 100644 --- a/src/Symfony/Component/HttpKernel/Bundle/Bundle.php +++ b/src/Symfony/Component/HttpKernel/Bundle/Bundle.php @@ -35,23 +35,21 @@ abstract class Bundle implements BundleInterface protected $path; /** - * Boots the Bundle. + * {@inheritdoc} */ public function boot() { } /** - * Shutdowns the Bundle. + * {@inheritdoc} */ public function shutdown() { } /** - * Builds the bundle. - * - * It is only ever called once when the cache is empty. + * {@inheritdoc} * * This method can be overridden to register compilation passes, * other extensions, ... @@ -61,9 +59,7 @@ public function build(ContainerBuilder $container) } /** - * Sets the container. - * - * @param ContainerInterface|null $container A ContainerInterface instance or null + * {@inheritdoc} */ public function setContainer(ContainerInterface $container = null) { @@ -71,9 +67,7 @@ public function setContainer(ContainerInterface $container = null) } /** - * Returns the bundle's container extension. - * - * @return ExtensionInterface|null The container extension + * {@inheritdoc} * * @throws \LogicException */ @@ -92,10 +86,7 @@ public function getContainerExtension() $expectedAlias = Container::underscore($basename); if ($expectedAlias != $extension->getAlias()) { - throw new \LogicException(sprintf( - 'Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', - $expectedAlias, $extension->getAlias() - )); + throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias())); } $this->extension = $extension; @@ -110,9 +101,7 @@ public function getContainerExtension() } /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace + * {@inheritdoc} */ public function getNamespace() { @@ -122,9 +111,7 @@ public function getNamespace() } /** - * Gets the Bundle directory path. - * - * @return string The Bundle absolute path + * {@inheritdoc} */ public function getPath() { @@ -137,18 +124,14 @@ public function getPath() } /** - * Returns the bundle parent name. - * - * @return string|null The Bundle parent name it overrides or null if no parent + * {@inheritdoc} */ public function getParent() { } /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name + * {@inheritdoc} */ final public function getName() { diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php index 49f0e4c16943f..2175b567a76d6 100644 --- a/src/Symfony/Component/HttpKernel/Client.php +++ b/src/Symfony/Component/HttpKernel/Client.php @@ -71,12 +71,12 @@ protected function doRequest($request) */ protected function getScript($request) { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); + $kernel = var_export(serialize($this->kernel), true); + $request = var_export(serialize($request), true); $r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\ClassLoader'); - $requirePath = str_replace("'", "\\'", $r->getFileName()); - $symfonyPath = str_replace("'", "\\'", \dirname(\dirname(\dirname(__DIR__)))); + $requirePath = var_export($r->getFileName(), true); + $symfonyPath = var_export(\dirname(\dirname(\dirname(__DIR__))), true); $errorReporting = error_reporting(); $code = <<addPrefix('Symfony', '$symfonyPath'); +\$loader->addPrefix('Symfony', $symfonyPath); \$loader->register(); -\$kernel = unserialize('$kernel'); -\$request = unserialize('$request'); +\$kernel = unserialize($kernel); +\$request = unserialize($request); EOF; return $code.$this->getHandleScript(); diff --git a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php index 712248578d0a7..13fc3356242e7 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/InlineFragmentRenderer.php @@ -122,6 +122,13 @@ protected function createSubRequest($uri, Request $request) $subRequest->setSession($session); } + if ($request->get('_format')) { + $subRequest->attributes->set('_format', $request->get('_format')); + } + if ($request->getDefaultLocale() !== $request->getLocale()) { + $subRequest->setLocale($request->getLocale()); + } + return $subRequest; } diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 276b2a1516b57..b6db6ee97cd89 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -59,11 +59,11 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $startTime; protected $loadClassCache; - const VERSION = '2.8.45'; - const VERSION_ID = 20845; + const VERSION = '2.8.46'; + const VERSION_ID = 20846; const MAJOR_VERSION = 2; const MINOR_VERSION = 8; - const RELEASE_VERSION = 45; + const RELEASE_VERSION = 46; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2018'; @@ -112,7 +112,7 @@ public function __clone() } /** - * Boots the current kernel. + * {@inheritdoc} */ public function boot() { @@ -265,11 +265,7 @@ public function locateResource($name, $dir = null, $first = true) foreach ($bundles as $bundle) { if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); + throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', $file, $resourceBundle, $dir.'/'.$bundles[0]->getName().$overridePath)); } if ($first) { diff --git a/src/Symfony/Component/HttpKernel/KernelInterface.php b/src/Symfony/Component/HttpKernel/KernelInterface.php index 18b128c296ca8..670e0269dba18 100644 --- a/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -139,7 +139,7 @@ public function getRootDir(); /** * Gets the current container. * - * @return ContainerInterface A ContainerInterface instance + * @return ContainerInterface|null A ContainerInterface instance or null when the Kernel is shutdown */ public function getContainer(); diff --git a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php index 197a720439253..6cd2bf03ca16d 100644 --- a/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -175,6 +175,26 @@ public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() $this->assertEquals('Foo', ob_get_clean()); } + public function testLocaleAndFormatAreIsKeptInSubrequest() + { + $expectedSubRequest = Request::create('/'); + $expectedSubRequest->attributes->set('_format', 'foo'); + $expectedSubRequest->setLocale('fr'); + if (Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) { + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + } + $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); + + $request = Request::create('/'); + $request->attributes->set('_format', 'foo'); + $request->setLocale('fr'); + $strategy->render('/', $request); + } + public function testESIHeaderIsKeptInSubrequest() { $expectedSubRequest = Request::create('/'); diff --git a/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php b/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php index ef54e402e9294..3383a0a76aa4f 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Compiler/GenrbCompiler.php @@ -37,10 +37,7 @@ public function __construct($genrb = 'genrb', $envVars = '') exec('which '.$genrb, $output, $status); if (0 !== $status) { - throw new RuntimeException(sprintf( - 'The command "%s" is not installed', - $genrb - )); + throw new RuntimeException(sprintf('The command "%s" is not installed', $genrb)); } $this->genrb = ($envVars ? $envVars.' ' : '').$genrb; @@ -58,12 +55,7 @@ public function compile($sourcePath, $targetDir) exec($this->genrb.' --quiet -e UTF-8 -d '.$targetDir.' '.$sourcePath, $output, $status); if (0 !== $status) { - throw new RuntimeException(sprintf( - 'genrb failed with status %d while compiling %s to %s.', - $status, - $sourcePath, - $targetDir - )); + throw new RuntimeException(sprintf('genrb failed with status %d while compiling %s to %s.', $status, $sourcePath, $targetDir)); } } } diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php index 3c351c3422f4f..b4bf25abb91c4 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/IntlBundleReader.php @@ -41,11 +41,7 @@ public function read($path, $locale) // The bundle is NULL if the path does not look like a resource bundle // (i.e. contain a bunch of *.res files) if (null === $bundle) { - throw new ResourceBundleNotFoundException(sprintf( - 'The resource bundle "%s/%s.res" could not be found.', - $path, - $locale - )); + throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s/%s.res" could not be found.', $path, $locale)); } // Other possible errors are U_USING_FALLBACK_WARNING and U_ZERO_ERROR, diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php index b5786d12a22ef..5c41c4043918e 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/JsonBundleReader.php @@ -36,27 +36,17 @@ public function read($path, $locale) } if (!file_exists($fileName)) { - throw new ResourceBundleNotFoundException(sprintf( - 'The resource bundle "%s" does not exist.', - $fileName - )); + throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s" does not exist.', $fileName)); } if (!is_file($fileName)) { - throw new RuntimeException(sprintf( - 'The resource bundle "%s" is not a file.', - $fileName - )); + throw new RuntimeException(sprintf('The resource bundle "%s" is not a file.', $fileName)); } $data = json_decode(file_get_contents($fileName), true); if (null === $data) { - throw new RuntimeException(sprintf( - 'The resource bundle "%s" contains invalid JSON: %s', - $fileName, - json_last_error_msg() - )); + throw new RuntimeException(sprintf('The resource bundle "%s" contains invalid JSON: %s', $fileName, json_last_error_msg())); } return $data; diff --git a/src/Symfony/Component/Intl/Data/Bundle/Reader/PhpBundleReader.php b/src/Symfony/Component/Intl/Data/Bundle/Reader/PhpBundleReader.php index 7c4b71c93ac1a..bbe2dfda6b973 100644 --- a/src/Symfony/Component/Intl/Data/Bundle/Reader/PhpBundleReader.php +++ b/src/Symfony/Component/Intl/Data/Bundle/Reader/PhpBundleReader.php @@ -36,19 +36,11 @@ public function read($path, $locale) } if (!file_exists($fileName)) { - throw new ResourceBundleNotFoundException(sprintf( - 'The resource bundle "%s/%s.php" does not exist.', - $path, - $locale - )); + throw new ResourceBundleNotFoundException(sprintf('The resource bundle "%s/%s.php" does not exist.', $path, $locale)); } if (!is_file($fileName)) { - throw new RuntimeException(sprintf( - 'The resource bundle "%s/%s.php" is not a file.', - $path, - $locale - )); + throw new RuntimeException(sprintf('The resource bundle "%s/%s.php" is not a file.', $path, $locale)); } return include $fileName; diff --git a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php index 6cfe5884b3e05..17c52042cac1c 100644 --- a/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/LanguageDataGenerator.php @@ -175,32 +175,19 @@ private function generateAlpha2ToAlpha3Mapping(ArrayAccessibleResourceBundle $me if (isset(self::$preferredAlpha2ToAlpha3Mapping[$language])) { // Validate to prevent typos if (!isset($aliases[self::$preferredAlpha2ToAlpha3Mapping[$language]])) { - throw new RuntimeException( - 'The statically set three-letter mapping '. - self::$preferredAlpha2ToAlpha3Mapping[$language].' '. - 'for the language code '.$language.' seems to be '. - 'invalid. Typo?' - ); + throw new RuntimeException('The statically set three-letter mapping '.self::$preferredAlpha2ToAlpha3Mapping[$language].' for the language code '.$language.' seems to be invalid. Typo?'); } $alpha3 = self::$preferredAlpha2ToAlpha3Mapping[$language]; $alpha2 = $aliases[$alpha3]['replacement']; if ($language !== $alpha2) { - throw new RuntimeException( - 'The statically set three-letter mapping '.$alpha3.' '. - 'for the language code '.$language.' seems to be '. - 'an alias for '.$alpha2.'. Wrong mapping?' - ); + throw new RuntimeException('The statically set three-letter mapping '.$alpha3.' for the language code '.$language.' seems to be an alias for '.$alpha2.'. Wrong mapping?'); } $alpha2ToAlpha3[$language] = $alpha3; } elseif (isset($alpha2ToAlpha3[$language])) { - throw new RuntimeException( - 'Multiple three-letter mappings exist for the language '. - 'code '.$language.'. Please add one of them to the '. - 'property $preferredAlpha2ToAlpha3Mapping.' - ); + throw new RuntimeException('Multiple three-letter mappings exist for the language code '.$language.'. Please add one of them to the property $preferredAlpha2ToAlpha3Mapping.'); } else { $alpha2ToAlpha3[$language] = $alias; } diff --git a/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php b/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php index e1265b3a1b742..920e2e311b049 100644 --- a/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php +++ b/src/Symfony/Component/Intl/Data/Generator/RegionDataGenerator.php @@ -34,6 +34,8 @@ class RegionDataGenerator extends AbstractDataGenerator const BOUVET_ISLAND_ID = 'BV'; const HEARD_MCDONALD_ISLANDS_ID = 'HM'; const CLIPPERTON_ISLAND_ID = 'CP'; + const EUROZONE_ID = 'EZ'; + const UNITED_NATIONS_ID = 'UN'; /** * Regions excluded from generation. @@ -43,6 +45,8 @@ class RegionDataGenerator extends AbstractDataGenerator // Look like countries, but are sub-continents self::OUTLYING_OCEANIA_REGION_ID => true, self::EUROPEAN_UNION_ID => true, + self::EUROZONE_ID => true, + self::UNITED_NATIONS_ID => true, // No longer exists self::NETHERLANDS_ANTILLES_ID => true, // Uninhabited islands diff --git a/src/Symfony/Component/Intl/Data/Util/RecursiveArrayAccess.php b/src/Symfony/Component/Intl/Data/Util/RecursiveArrayAccess.php index 086b550478057..c133932c9e6ff 100644 --- a/src/Symfony/Component/Intl/Data/Util/RecursiveArrayAccess.php +++ b/src/Symfony/Component/Intl/Data/Util/RecursiveArrayAccess.php @@ -36,10 +36,7 @@ public static function get($array, array $indices) } } - throw new OutOfBoundsException(sprintf( - 'The index %s does not exist.', - $index - )); + throw new OutOfBoundsException(sprintf('The index %s does not exist.', $index)); } return $array; diff --git a/src/Symfony/Component/Intl/Data/Util/RingBuffer.php b/src/Symfony/Component/Intl/Data/Util/RingBuffer.php index b63c31e91970f..1ab1a301497ae 100644 --- a/src/Symfony/Component/Intl/Data/Util/RingBuffer.php +++ b/src/Symfony/Component/Intl/Data/Util/RingBuffer.php @@ -53,10 +53,7 @@ public function offsetExists($key) public function offsetGet($key) { if (!isset($this->indices[$key])) { - throw new OutOfBoundsException(sprintf( - 'The index "%s" does not exist.', - $key - )); + throw new OutOfBoundsException(sprintf('The index "%s" does not exist.', $key)); } return $this->values[$this->indices[$key]]; diff --git a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php index 40004eb5c2313..2840f0ad47aa4 100644 --- a/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php +++ b/src/Symfony/Component/Intl/DateFormatter/DateFormat/TimeZoneTransformer.php @@ -106,10 +106,7 @@ public static function getEtcTimeZoneId($formattedTimeZone) $signal = '-' == $matches['signal'] ? '+' : '-'; if (0 < $minutes) { - throw new NotImplementedException(sprintf( - 'It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.', - $formattedTimeZone - )); + throw new NotImplementedException(sprintf('It is not possible to use a GMT time zone with minutes offset different than zero (0). GMT time zone tried: %s.', $formattedTimeZone)); } return 'Etc/GMT'.(0 !== $hours ? $signal.$hours : ''); diff --git a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php index 551b84244e870..ea1eb1b7a337c 100644 --- a/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php +++ b/src/Symfony/Component/Intl/NumberFormatter/NumberFormatter.php @@ -360,10 +360,7 @@ public function format($value, $type = self::TYPE_DEFAULT) } if (self::CURRENCY == $this->style) { - throw new NotImplementedException(sprintf( - '%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', - __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE - )); + throw new NotImplementedException(sprintf('%s() method does not support the formatting of currencies (instance with CURRENCY style). %s', __METHOD__, NotImplementedException::INTL_INSTALL_MESSAGE)); } // Only the default type is supported. @@ -519,7 +516,7 @@ public function parse($value, $type = self::TYPE_DOUBLE, &$position = 0) $groupSep = $this->getAttribute(self::GROUPING_USED) ? ',' : ''; // Any string before the numeric value causes error in the parsing - if (preg_match("/^-?(?:\.\d++|([\d{$groupSep}]++)(?:\.\d++)?)/", $value, $matches)) { + if (preg_match("/^-?(?:\.\d++|([\d{$groupSep}]++)(?:\.\d*+)?)/", $value, $matches)) { $value = $matches[0]; $position = \strlen($value); if ($error = $groupSep && isset($matches[1]) && !preg_match('/^\d{1,3}+(?:(?:,\d{3})++|\d*+)$/', $matches[1])) { diff --git a/src/Symfony/Component/Intl/Resources/data/regions/af.json b/src/Symfony/Component/Intl/Resources/data/regions/af.json index 2b280fd249db1..726c0350799c2 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/af.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/af.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanje", "ET": "Ethiopië", - "EZ": "Eurosone", "FI": "Finland", "FJ": "Fidji", "FK": "Falklandeilande", @@ -237,7 +236,6 @@ "UA": "Oekraïne", "UG": "Uganda", "UM": "Klein afgeleë eilande van die VSA", - "UN": "Verenigde Nasies", "US": "Verenigde State van Amerika", "UY": "Uruguay", "UZ": "Oesbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/am.json b/src/Symfony/Component/Intl/Resources/data/regions/am.json index 0936881e34dd1..929f7797e823c 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/am.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/am.json @@ -72,7 +72,6 @@ "ER": "ኤርትራ", "ES": "ስፔን", "ET": "ኢትዮጵያ", - "EZ": "የአውሮፓ ዞን", "FI": "ፊንላንድ", "FJ": "ፊጂ", "FK": "የፎክላንድ ደሴቶች", @@ -237,7 +236,6 @@ "UA": "ዩክሬን", "UG": "ዩጋንዳ", "UM": "የዩ ኤስ ጠረፍ ላይ ያሉ ደሴቶች", - "UN": "የተባበሩት መንግስታት", "US": "ዩናይትድ ስቴትስ", "UY": "ኡራጓይ", "UZ": "ኡዝቤኪስታን", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ar.json b/src/Symfony/Component/Intl/Resources/data/regions/ar.json index 93ce837ca1ecd..989681613e67c 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ar.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ar.json @@ -72,7 +72,6 @@ "ER": "إريتريا", "ES": "إسبانيا", "ET": "إثيوبيا", - "EZ": "منطقة اليورو", "FI": "فنلندا", "FJ": "فيجي", "FK": "جزر فوكلاند", @@ -237,7 +236,6 @@ "UA": "أوكرانيا", "UG": "أوغندا", "UM": "جزر الولايات المتحدة النائية", - "UN": "الأمم المتحدة", "US": "الولايات المتحدة", "UY": "أورغواي", "UZ": "أوزبكستان", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/as.json b/src/Symfony/Component/Intl/Resources/data/regions/as.json index 50baeecf10cc0..2a61a13138b71 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/as.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/as.json @@ -72,7 +72,6 @@ "ER": "এৰিত্ৰিয়া", "ES": "স্পেইন", "ET": "ইথিঅ’পিয়া", - "EZ": "ইউৰোজ’ন", "FI": "ফিনলেণ্ড", "FJ": "ফিজি", "FK": "ফকলেণ্ড দ্বীপপুঞ্জ", @@ -237,7 +236,6 @@ "UA": "ইউক্ৰেইন", "UG": "উগাণ্ডা", "UM": "ইউ. এছ. আউটলায়িং দ্বীপপুঞ্জ", - "UN": "ৰাষ্ট্ৰসংঘ", "US": "মাৰ্কিন যুক্তৰাষ্ট্ৰ", "UY": "উৰুগুৱে", "UZ": "উজবেকিস্তান", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/az.json b/src/Symfony/Component/Intl/Resources/data/regions/az.json index 2bc9b27e4b692..217a2f388388d 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/az.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/az.json @@ -72,7 +72,6 @@ "ER": "Eritreya", "ES": "İspaniya", "ET": "Efiopiya", - "EZ": "Avrozona", "FI": "Finlandiya", "FJ": "Fici", "FK": "Folklend adaları", @@ -237,7 +236,6 @@ "UA": "Ukrayna", "UG": "Uqanda", "UM": "ABŞ-a bağlı kiçik adacıqlar", - "UN": "Birləşmiş Millətlər Təşkilatı", "US": "Amerika Birləşmiş Ştatları", "UY": "Uruqvay", "UZ": "Özbəkistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/be.json b/src/Symfony/Component/Intl/Resources/data/regions/be.json index 916a0653e726f..f117642b14a48 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/be.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/be.json @@ -72,7 +72,6 @@ "ER": "Эрытрэя", "ES": "Іспанія", "ET": "Эфіопія", - "EZ": "Еўразона", "FI": "Фінляндыя", "FJ": "Фіджы", "FK": "Фалклендскія астравы", @@ -237,7 +236,6 @@ "UA": "Украіна", "UG": "Уганда", "UM": "Малыя Аддаленыя астравы ЗША", - "UN": "ААН", "US": "Злучаныя Штаты Амерыкі", "UY": "Уругвай", "UZ": "Узбекістан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/bg.json b/src/Symfony/Component/Intl/Resources/data/regions/bg.json index 0a4de0c69eb56..8d46867ad975c 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/bg.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/bg.json @@ -72,7 +72,6 @@ "ER": "Еритрея", "ES": "Испания", "ET": "Етиопия", - "EZ": "Еврозона", "FI": "Финландия", "FJ": "Фиджи", "FK": "Фолклендски острови", @@ -237,7 +236,6 @@ "UA": "Украйна", "UG": "Уганда", "UM": "Отдалечени острови на САЩ", - "UN": "Организация на обединените нации", "US": "Съединени щати", "UY": "Уругвай", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/bn.json b/src/Symfony/Component/Intl/Resources/data/regions/bn.json index 35626e5519c09..8a0ec061f1883 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/bn.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/bn.json @@ -72,7 +72,6 @@ "ER": "ইরিত্রিয়া", "ES": "স্পেন", "ET": "ইথিওপিয়া", - "EZ": "ইউরোজোন", "FI": "ফিনল্যান্ড", "FJ": "ফিজি", "FK": "ফকল্যান্ড দ্বীপপুঞ্জ", @@ -237,7 +236,6 @@ "UA": "ইউক্রেন", "UG": "উগান্ডা", "UM": "যুক্তরাষ্ট্রের পার্শ্ববর্তী দ্বীপপুঞ্জ", - "UN": "জাতিসংঘ", "US": "মার্কিন যুক্তরাষ্ট্র", "UY": "উরুগুয়ে", "UZ": "উজবেকিস্তান", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/br.json b/src/Symfony/Component/Intl/Resources/data/regions/br.json index 5f1bdd18120d2..ad7fd7262d433 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/br.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/br.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spagn", "ET": "Etiopia", - "EZ": "takad an euro", "FI": "Finland", "FJ": "Fidji", "FK": "Inizi Falkland", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Ouganda", "UM": "Inizi diabell ar Stadoù-Unanet", - "UN": "Broadoù unanet", "US": "Stadoù-Unanet", "UY": "Uruguay", "UZ": "Ouzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/bs.json b/src/Symfony/Component/Intl/Resources/data/regions/bs.json index a923f5fd90c29..387c866323465 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/bs.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/bs.json @@ -72,7 +72,6 @@ "ER": "Eritreja", "ES": "Španija", "ET": "Etiopija", - "EZ": "Eurozona", "FI": "Finska", "FJ": "Fidži", "FK": "Folklandska ostrva", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Američka Vanjska Ostrva", - "UN": "Ujedinjene Nacije", "US": "Sjedinjene Američke Države", "UY": "Urugvaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/bs_Cyrl.json b/src/Symfony/Component/Intl/Resources/data/regions/bs_Cyrl.json index 76c673b03b2ae..a31e2b35bf507 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/bs_Cyrl.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/bs_Cyrl.json @@ -72,7 +72,6 @@ "ER": "Еритреја", "ES": "Шпанија", "ET": "Етиопија", - "EZ": "Еурозона", "FI": "Финска", "FJ": "Фиџи", "FK": "Фокландска острва", @@ -236,7 +235,6 @@ "UA": "Украјина", "UG": "Уганда", "UM": "Мања удаљена острва САД", - "UN": "Уједињене нације", "US": "Сједињене Америчке Државе", "UY": "Уругвај", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ca.json b/src/Symfony/Component/Intl/Resources/data/regions/ca.json index 50a0177b4d7d2..2336686f511ca 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ca.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ca.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Espanya", "ET": "Etiòpia", - "EZ": "zona euro", "FI": "Finlàndia", "FJ": "Fiji", "FK": "Illes Malvines", @@ -237,7 +236,6 @@ "UA": "Ucraïna", "UG": "Uganda", "UM": "Illes Perifèriques Menors dels EUA", - "UN": "Nacions Unides", "US": "Estats Units", "UY": "Uruguai", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ce.json b/src/Symfony/Component/Intl/Resources/data/regions/ce.json index 934580a09914e..e86ed1000e2a1 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ce.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ce.json @@ -72,7 +72,6 @@ "ER": "Эритрей", "ES": "Испани", "ET": "Эфиопи", - "EZ": "еврозона", "FI": "Финлянди", "FJ": "Фиджи", "FK": "Фолклендан гӀайренаш", @@ -237,7 +236,6 @@ "UA": "Украина", "UG": "Уганда", "UM": "АЦШн арахьара кегийн гӀайренаш", - "UN": "Вовшахкхетта Къаьмнийн Организаци", "US": "Цхьанатоьхна Штаташ", "UY": "Уругвай", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/cs.json b/src/Symfony/Component/Intl/Resources/data/regions/cs.json index 68eea5b4ac7b9..375a62819d333 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/cs.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/cs.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Španělsko", "ET": "Etiopie", - "EZ": "eurozóna", "FI": "Finsko", "FJ": "Fidži", "FK": "Falklandské ostrovy", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Menší odlehlé ostrovy USA", - "UN": "Organizace spojených národů", "US": "Spojené státy", "UY": "Uruguay", "UZ": "Uzbekistán", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/cy.json b/src/Symfony/Component/Intl/Resources/data/regions/cy.json index caa829ed16014..2fd5967749108 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/cy.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/cy.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Sbaen", "ET": "Ethiopia", - "EZ": "Ardal yr Ewro", "FI": "Y Ffindir", "FJ": "Fiji", "FK": "Ynysoedd y Falkland\/Malvinas", @@ -237,7 +236,6 @@ "UA": "Wcráin", "UG": "Uganda", "UM": "Ynysoedd Pellennig UDA", - "UN": "y Cenhedloedd Unedig", "US": "Yr Unol Daleithiau", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/da.json b/src/Symfony/Component/Intl/Resources/data/regions/da.json index ef8b2658a839a..ddda65b193cf8 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/da.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/da.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanien", "ET": "Etiopien", - "EZ": "eurozonen", "FI": "Finland", "FJ": "Fiji", "FK": "Falklandsøerne", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Uganda", "UM": "Amerikanske oversøiske øer", - "UN": "De Forenede Nationer", "US": "USA", "UY": "Uruguay", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/de.json b/src/Symfony/Component/Intl/Resources/data/regions/de.json index b521ae4bc511e..38e353f6a35a4 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/de.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/de.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanien", "ET": "Äthiopien", - "EZ": "Eurozone", "FI": "Finnland", "FJ": "Fidschi", "FK": "Falklandinseln", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Uganda", "UM": "Amerikanische Überseeinseln", - "UN": "Vereinte Nationen", "US": "Vereinigte Staaten", "UY": "Uruguay", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/el.json b/src/Symfony/Component/Intl/Resources/data/regions/el.json index 447264e8c6ebc..8387c53c9106b 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/el.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/el.json @@ -72,7 +72,6 @@ "ER": "Ερυθραία", "ES": "Ισπανία", "ET": "Αιθιοπία", - "EZ": "Ευρωζώνη", "FI": "Φινλανδία", "FJ": "Φίτζι", "FK": "Νήσοι Φόκλαντ", @@ -237,7 +236,6 @@ "UA": "Ουκρανία", "UG": "Ουγκάντα", "UM": "Απομακρυσμένες Νησίδες ΗΠΑ", - "UN": "Ηνωμένα Έθνη", "US": "Ηνωμένες Πολιτείες", "UY": "Ουρουγουάη", "UZ": "Ουζμπεκιστάν", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/en.json b/src/Symfony/Component/Intl/Resources/data/regions/en.json index 74663075241bc..7b053c475c022 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/en.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/en.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spain", "ET": "Ethiopia", - "EZ": "Eurozone", "FI": "Finland", "FJ": "Fiji", "FK": "Falkland Islands", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Uganda", "UM": "U.S. Outlying Islands", - "UN": "United Nations", "US": "United States", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/es.json b/src/Symfony/Component/Intl/Resources/data/regions/es.json index 3369ed0e0b945..451b4a7de640d 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/es.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/es.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "España", "ET": "Etiopía", - "EZ": "zona euro", "FI": "Finlandia", "FJ": "Fiyi", "FK": "Islas Malvinas", @@ -237,7 +236,6 @@ "UA": "Ucrania", "UG": "Uganda", "UM": "Islas menores alejadas de EE. UU.", - "UN": "Naciones Unidas", "US": "Estados Unidos", "UY": "Uruguay", "UZ": "Uzbekistán", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/es_419.json b/src/Symfony/Component/Intl/Resources/data/regions/es_419.json index 3b0afed924741..9b25f033b2010 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/es_419.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/es_419.json @@ -4,7 +4,6 @@ "AC": "Isla Ascensión", "BA": "Bosnia-Herzegovina", "CI": "Costa de Marfil", - "EZ": "Eurozona", "GG": "Guernesey", "IC": "Islas Canarias", "TA": "Tristán da Cunha", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/es_MX.json b/src/Symfony/Component/Intl/Resources/data/regions/es_MX.json index 6b0c66ccfc6e6..63cc2187ad45d 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/es_MX.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/es_MX.json @@ -3,12 +3,10 @@ "Names": { "BA": "Bosnia y Herzegovina", "CI": "Côte d’Ivoire", - "EZ": "zona euro", "GG": "Guernsey", "TA": "Tristán de Acuña", "TL": "Timor-Leste", "UM": "Islas menores alejadas de EE. UU.", - "UN": "UN", "VI": "Islas Vírgenes de EE. UU." } } diff --git a/src/Symfony/Component/Intl/Resources/data/regions/es_US.json b/src/Symfony/Component/Intl/Resources/data/regions/es_US.json index b1325a4b7da2e..3c694616bc6ba 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/es_US.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/es_US.json @@ -3,7 +3,6 @@ "Names": { "AC": "Isla de la Ascensión", "CI": "Côte d’Ivoire", - "EZ": "zona euro", "GG": "Guernsey", "TL": "Timor-Leste", "UM": "Islas menores alejadas de EE. UU.", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/et.json b/src/Symfony/Component/Intl/Resources/data/regions/et.json index e22adf5ffddb6..61008dc9e10ce 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/et.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/et.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Hispaania", "ET": "Etioopia", - "EZ": "euroala", "FI": "Soome", "FJ": "Fidži", "FK": "Falklandi saared", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Ühendriikide hajasaared", - "UN": "Ühendatud Rahvaste Organisatsioon", "US": "Ameerika Ühendriigid", "UY": "Uruguay", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/eu.json b/src/Symfony/Component/Intl/Resources/data/regions/eu.json index 9df3ed11c06c5..795a63a14a709 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/eu.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/eu.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Espainia", "ET": "Etiopia", - "EZ": "Eurogunea", "FI": "Finlandia", "FJ": "Fiji", "FK": "Malvinak", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Ameriketako Estatu Batuetako Kanpoaldeko Uharte Txikiak", - "UN": "Nazio Batuak", "US": "Ameriketako Estatu Batuak", "UY": "Uruguai", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/fa.json b/src/Symfony/Component/Intl/Resources/data/regions/fa.json index fb2ac4af4cc69..d62eb92a0e597 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/fa.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/fa.json @@ -72,7 +72,6 @@ "ER": "اریتره", "ES": "اسپانیا", "ET": "اتیوپی", - "EZ": "منطقه یورو", "FI": "فنلاند", "FJ": "فیجی", "FK": "جزایر فالکلند", @@ -237,7 +236,6 @@ "UA": "اوکراین", "UG": "اوگاندا", "UM": "جزایر دورافتادهٔ ایالات متحده", - "UN": "سازمان ملل متحد", "US": "ایالات متحده", "UY": "اروگوئه", "UZ": "ازبکستان", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/fi.json b/src/Symfony/Component/Intl/Resources/data/regions/fi.json index 4ba9dcd1e77a3..a46d8175c79cc 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/fi.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/fi.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Espanja", "ET": "Etiopia", - "EZ": "euroalue", "FI": "Suomi", "FJ": "Fidži", "FK": "Falklandinsaaret", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Yhdysvaltain erillissaaret", - "UN": "Yhdistyneet kansakunnat", "US": "Yhdysvallat", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/fo.json b/src/Symfony/Component/Intl/Resources/data/regions/fo.json index 8459fc4314f81..649d9bc1bc787 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/fo.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/fo.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spania", "ET": "Etiopia", - "EZ": "Evrasona", "FI": "Finnland", "FJ": "Fiji", "FK": "Falklandsoyggjar", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Sambandsríki Amerikas fjarskotnu oyggjar", - "UN": "Sameindu Tjóðir", "US": "Sambandsríki Amerika", "UY": "Uruguai", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/fr.json b/src/Symfony/Component/Intl/Resources/data/regions/fr.json index 17184b5d4f503..466fd46366f91 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/fr.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/fr.json @@ -72,7 +72,6 @@ "ER": "Érythrée", "ES": "Espagne", "ET": "Éthiopie", - "EZ": "zone euro", "FI": "Finlande", "FJ": "Fidji", "FK": "Îles Malouines", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Ouganda", "UM": "Îles mineures éloignées des États-Unis", - "UN": "Nations Unies", "US": "États-Unis", "UY": "Uruguay", "UZ": "Ouzbékistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ga.json b/src/Symfony/Component/Intl/Resources/data/regions/ga.json index ba938a53c13d6..6ca450d3aa64b 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ga.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ga.json @@ -72,7 +72,6 @@ "ER": "an Eiritré", "ES": "an Spáinn", "ET": "an Aetóip", - "EZ": "Limistéar an euro", "FI": "an Fhionlainn", "FJ": "Fidsí", "FK": "Oileáin Fháclainne", @@ -237,7 +236,6 @@ "UA": "an Úcráin", "UG": "Uganda", "UM": "Oileáin Imeallacha S.A.M.", - "UN": "na Náisiúin Aontaiteh", "US": "Stáit Aontaithe Mheiriceá", "UY": "Uragua", "UZ": "an Úisbéiceastáin", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/gd.json b/src/Symfony/Component/Intl/Resources/data/regions/gd.json index 6844ad29d3c84..88ebf40449e36 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/gd.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/gd.json @@ -72,7 +72,6 @@ "ER": "Eartra", "ES": "An Spàinnt", "ET": "An Itiop", - "EZ": "Raon an Eòro", "FI": "An Fhionnlann", "FJ": "Fìdi", "FK": "Na h-Eileanan Fàclannach", @@ -237,7 +236,6 @@ "UA": "An Ucràin", "UG": "Uganda", "UM": "Meanbh-Eileanan Iomallach nan SA", - "UN": "Na Dùthchannan Aonaichte", "US": "Na Stàitean Aonaichte", "UY": "Uruguaidh", "UZ": "Usbagastàn", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/gl.json b/src/Symfony/Component/Intl/Resources/data/regions/gl.json index e6f23e88f5bed..1cdd8900e1036 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/gl.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/gl.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "España", "ET": "Etiopía", - "EZ": "Eurozona", "FI": "Finlandia", "FJ": "Fidxi", "FK": "Illas Malvinas", @@ -237,7 +236,6 @@ "UA": "Ucraína", "UG": "Uganda", "UM": "Illas Ultramarinas dos EUA", - "UN": "Nacións Unidas", "US": "Estados Unidos de América", "UY": "Uruguai", "UZ": "Uzbequistán", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/gu.json b/src/Symfony/Component/Intl/Resources/data/regions/gu.json index d3e310380bcd4..83e9ba7a6268f 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/gu.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/gu.json @@ -72,7 +72,6 @@ "ER": "એરિટ્રિયા", "ES": "સ્પેન", "ET": "ઇથિઓપિયા", - "EZ": "યુરોઝોન", "FI": "ફિનલેન્ડ", "FJ": "ફીજી", "FK": "ફૉકલેન્ડ આઇલેન્ડ્સ", @@ -237,7 +236,6 @@ "UA": "યુક્રેન", "UG": "યુગાંડા", "UM": "યુ.એસ. આઉટલાઇનિંગ આઇલેન્ડ્સ", - "UN": "સંયુક્ત રાષ્ટ્ર", "US": "યુનાઇટેડ સ્ટેટ્સ", "UY": "ઉરુગ્વે", "UZ": "ઉઝ્બેકિસ્તાન", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/he.json b/src/Symfony/Component/Intl/Resources/data/regions/he.json index ce12c7030efa7..1bbfb96d1f06e 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/he.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/he.json @@ -72,7 +72,6 @@ "ER": "אריתריאה", "ES": "ספרד", "ET": "אתיופיה", - "EZ": "גוש האירו", "FI": "פינלנד", "FJ": "פיג׳י", "FK": "איי פוקלנד", @@ -237,7 +236,6 @@ "UA": "אוקראינה", "UG": "אוגנדה", "UM": "האיים המרוחקים הקטנים של ארה״ב", - "UN": "האומות המאוחדות", "US": "ארצות הברית", "UY": "אורוגוואי", "UZ": "אוזבקיסטן", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/hi.json b/src/Symfony/Component/Intl/Resources/data/regions/hi.json index 3cb506ce25115..9ea72b6b228dd 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/hi.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/hi.json @@ -72,7 +72,6 @@ "ER": "इरिट्रिया", "ES": "स्पेन", "ET": "इथियोपिया", - "EZ": "यूरोज़ोन", "FI": "फ़िनलैंड", "FJ": "फ़िजी", "FK": "फ़ॉकलैंड द्वीपसमूह", @@ -237,7 +236,6 @@ "UA": "यूक्रेन", "UG": "युगांडा", "UM": "यू॰एस॰ आउटलाइंग द्वीपसमूह", - "UN": "संयुक्त राष्ट्र", "US": "संयुक्त राज्य", "UY": "उरूग्वे", "UZ": "उज़्बेकिस्तान", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/hr.json b/src/Symfony/Component/Intl/Resources/data/regions/hr.json index b086e081de377..03f59c24e93ce 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/hr.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/hr.json @@ -72,7 +72,6 @@ "ER": "Eritreja", "ES": "Španjolska", "ET": "Etiopija", - "EZ": "eurozona", "FI": "Finska", "FJ": "Fidži", "FK": "Falklandski otoci", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Mali udaljeni otoci SAD-a", - "UN": "Ujedinjeni narodi", "US": "Sjedinjene Američke Države", "UY": "Urugvaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/hu.json b/src/Symfony/Component/Intl/Resources/data/regions/hu.json index badd300ee33e6..5011e0398285d 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/hu.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/hu.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanyolország", "ET": "Etiópia", - "EZ": "Eurózóna", "FI": "Finnország", "FJ": "Fidzsi", "FK": "Falkland-szigetek", @@ -237,7 +236,6 @@ "UA": "Ukrajna", "UG": "Uganda", "UM": "Az USA lakatlan külbirtokai", - "UN": "Egyesült Nemzetek Szervezete", "US": "Egyesült Államok", "UY": "Uruguay", "UZ": "Üzbegisztán", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/hy.json b/src/Symfony/Component/Intl/Resources/data/regions/hy.json index 08be7f38349f0..6f4ba308e0890 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/hy.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/hy.json @@ -72,7 +72,6 @@ "ER": "Էրիթրեա", "ES": "Իսպանիա", "ET": "Եթովպիա", - "EZ": "Եվրագոտի", "FI": "Ֆինլանդիա", "FJ": "Ֆիջի", "FK": "Ֆոլքլենդյան կղզիներ", @@ -237,7 +236,6 @@ "UA": "Ուկրաինա", "UG": "Ուգանդա", "UM": "Արտաքին կղզիներ (ԱՄՆ)", - "UN": "Միավորված ազգերի կազմակերպություն", "US": "Միացյալ Նահանգներ", "UY": "Ուրուգվայ", "UZ": "Ուզբեկստան", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/id.json b/src/Symfony/Component/Intl/Resources/data/regions/id.json index 552825ccdffd1..007d02cccbfd5 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/id.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/id.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanyol", "ET": "Etiopia", - "EZ": "Zona Euro", "FI": "Finlandia", "FJ": "Fiji", "FK": "Kepulauan Malvinas", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Kepulauan Terluar A.S.", - "UN": "Perserikatan Bangsa-Bangsa", "US": "Amerika Serikat", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/in.json b/src/Symfony/Component/Intl/Resources/data/regions/in.json index 552825ccdffd1..007d02cccbfd5 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/in.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/in.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanyol", "ET": "Etiopia", - "EZ": "Zona Euro", "FI": "Finlandia", "FJ": "Fiji", "FK": "Kepulauan Malvinas", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Kepulauan Terluar A.S.", - "UN": "Perserikatan Bangsa-Bangsa", "US": "Amerika Serikat", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/is.json b/src/Symfony/Component/Intl/Resources/data/regions/is.json index db171546d2bff..294f9fb20b580 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/is.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/is.json @@ -72,7 +72,6 @@ "ER": "Erítrea", "ES": "Spánn", "ET": "Eþíópía", - "EZ": "Evrusvæðið", "FI": "Finnland", "FJ": "Fídjíeyjar", "FK": "Falklandseyjar", @@ -237,7 +236,6 @@ "UA": "Úkraína", "UG": "Úganda", "UM": "Smáeyjar Bandaríkjanna", - "UN": "Sameinuðu þjóðirnar", "US": "Bandaríkin", "UY": "Úrúgvæ", "UZ": "Úsbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/it.json b/src/Symfony/Component/Intl/Resources/data/regions/it.json index 865a31a6accbd..5cef8d7ec790b 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/it.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/it.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spagna", "ET": "Etiopia", - "EZ": "Eurozona", "FI": "Finlandia", "FJ": "Figi", "FK": "Isole Falkland", @@ -237,7 +236,6 @@ "UA": "Ucraina", "UG": "Uganda", "UM": "Altre isole americane del Pacifico", - "UN": "Nazioni Unite", "US": "Stati Uniti", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/iw.json b/src/Symfony/Component/Intl/Resources/data/regions/iw.json index ce12c7030efa7..1bbfb96d1f06e 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/iw.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/iw.json @@ -72,7 +72,6 @@ "ER": "אריתריאה", "ES": "ספרד", "ET": "אתיופיה", - "EZ": "גוש האירו", "FI": "פינלנד", "FJ": "פיג׳י", "FK": "איי פוקלנד", @@ -237,7 +236,6 @@ "UA": "אוקראינה", "UG": "אוגנדה", "UM": "האיים המרוחקים הקטנים של ארה״ב", - "UN": "האומות המאוחדות", "US": "ארצות הברית", "UY": "אורוגוואי", "UZ": "אוזבקיסטן", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ja.json b/src/Symfony/Component/Intl/Resources/data/regions/ja.json index 511a6bde6573f..f62db01842d52 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ja.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ja.json @@ -72,7 +72,6 @@ "ER": "エリトリア", "ES": "スペイン", "ET": "エチオピア", - "EZ": "ユーロ圏", "FI": "フィンランド", "FJ": "フィジー", "FK": "フォークランド諸島", @@ -237,7 +236,6 @@ "UA": "ウクライナ", "UG": "ウガンダ", "UM": "合衆国領有小離島", - "UN": "国際連合", "US": "アメリカ合衆国", "UY": "ウルグアイ", "UZ": "ウズベキスタン", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ka.json b/src/Symfony/Component/Intl/Resources/data/regions/ka.json index 861ca2ea951ac..4d145bab65e37 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ka.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ka.json @@ -72,7 +72,6 @@ "ER": "ერიტრეა", "ES": "ესპანეთი", "ET": "ეთიოპია", - "EZ": "ევროზონა", "FI": "ფინეთი", "FJ": "ფიჯი", "FK": "ფოლკლენდის კუნძულები", @@ -237,7 +236,6 @@ "UA": "უკრაინა", "UG": "უგანდა", "UM": "აშშ-ის შორეული კუნძულები", - "UN": "გაერო", "US": "ამერიკის შეერთებული შტატები", "UY": "ურუგვაი", "UZ": "უზბეკეთი", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/kk.json b/src/Symfony/Component/Intl/Resources/data/regions/kk.json index 0c6e912947b2e..2cd5007dd1061 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/kk.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/kk.json @@ -72,7 +72,6 @@ "ER": "Эритрея", "ES": "Испания", "ET": "Эфиопия", - "EZ": "Еуроаймақ", "FI": "Финляндия", "FJ": "Фиджи", "FK": "Фолкленд аралдары", @@ -237,7 +236,6 @@ "UA": "Украина", "UG": "Уганда", "UM": "АҚШ-тың сыртқы кіші аралдары", - "UN": "Біріккен Ұлттар Ұйымы", "US": "Америка Құрама Штаттары", "UY": "Уругвай", "UZ": "Өзбекстан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/km.json b/src/Symfony/Component/Intl/Resources/data/regions/km.json index 50d149e55e0dc..21fe35191db61 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/km.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/km.json @@ -72,7 +72,6 @@ "ER": "អេរីត្រេ", "ES": "អេស្ប៉ាញ", "ET": "អេត្យូពី", - "EZ": "តំបន់ចាយលុយអឺរ៉ូ", "FI": "ហ្វាំងឡង់", "FJ": "ហ្វីជី", "FK": "កោះ​ហ្វក់ឡែន", @@ -237,7 +236,6 @@ "UA": "អ៊ុយក្រែន", "UG": "អ៊ូហ្គង់ដា", "UM": "កោះ​អៅឡាយីង​អាមេរិក", - "UN": "អង្គការសហប្រជាជាតិ", "US": "សហរដ្ឋអាមេរិក", "UY": "អ៊ុយរូហ្គាយ", "UZ": "អ៊ូសបេគីស្ថាន", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/kn.json b/src/Symfony/Component/Intl/Resources/data/regions/kn.json index 0265e4f39be72..9e452245b0637 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/kn.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/kn.json @@ -72,7 +72,6 @@ "ER": "ಎರಿಟ್ರಿಯಾ", "ES": "ಸ್ಪೇನ್", "ET": "ಇಥಿಯೋಪಿಯಾ", - "EZ": "ಯೂರೋಝೋನ್‌", "FI": "ಫಿನ್‌ಲ್ಯಾಂಡ್", "FJ": "ಫಿಜಿ", "FK": "ಫಾಕ್‌ಲ್ಯಾಂಡ್ ದ್ವೀಪಗಳು", @@ -237,7 +236,6 @@ "UA": "ಉಕ್ರೈನ್", "UG": "ಉಗಾಂಡಾ", "UM": "ಯುಎಸ್‌ ಔಟ್‌ಲೇಯಿಂಗ್ ದ್ವೀಪಗಳು", - "UN": "ಸಂಯುಕ್ತ ಸಂಸ್ಥಾನಗಳು", "US": "ಅಮೇರಿಕಾ ಸಂಯುಕ್ತ ಸಂಸ್ಥಾನ", "UY": "ಉರುಗ್ವೆ", "UZ": "ಉಜ್ಬೇಕಿಸ್ಥಾನ್", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ko.json b/src/Symfony/Component/Intl/Resources/data/regions/ko.json index e33d48d1b9deb..b955a71a5d35f 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ko.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ko.json @@ -72,7 +72,6 @@ "ER": "에리트리아", "ES": "스페인", "ET": "에티오피아", - "EZ": "유로존", "FI": "핀란드", "FJ": "피지", "FK": "포클랜드 제도", @@ -237,7 +236,6 @@ "UA": "우크라이나", "UG": "우간다", "UM": "미국령 해외 제도", - "UN": "유엔", "US": "미국", "UY": "우루과이", "UZ": "우즈베키스탄", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ky.json b/src/Symfony/Component/Intl/Resources/data/regions/ky.json index e3acf4db41793..9b6d27ce8369d 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ky.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ky.json @@ -72,7 +72,6 @@ "ER": "Эритрея", "ES": "Испания", "ET": "Эфиопия", - "EZ": "Еврозона", "FI": "Финляндия", "FJ": "Фиджи", "FK": "Фолкленд аралдары", @@ -237,7 +236,6 @@ "UA": "Украина", "UG": "Уганда", "UM": "АКШнын сырткы аралдары", - "UN": "БУ", "US": "Америка Кошмо Штаттары", "UY": "Уругвай", "UZ": "Өзбекстан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/lo.json b/src/Symfony/Component/Intl/Resources/data/regions/lo.json index 8de0bb9006954..fb116d91a0068 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/lo.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/lo.json @@ -72,7 +72,6 @@ "ER": "ເອຣິເທຣຍ", "ES": "ສະເປນ", "ET": "ອີທິໂອເປຍ", - "EZ": "ເຂດຢູໂຣບ", "FI": "ຟິນແລນ", "FJ": "ຟິຈິ", "FK": "ຫມູ່ເກາະຟອກແລນ", @@ -237,7 +236,6 @@ "UA": "ຢູເຄຣນ", "UG": "ອູການດາ", "UM": "ໝູ່ເກາະຮອບນອກຂອງສະຫະລັດຯ", - "UN": "ສະຫະປະຊາຊາດ", "US": "ສະຫະລັດ", "UY": "ອູຣຸກວຍ", "UZ": "ອຸສເບກິສະຖານ", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/lt.json b/src/Symfony/Component/Intl/Resources/data/regions/lt.json index d3d868d21ec1c..f7a79dbb770fd 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/lt.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/lt.json @@ -72,7 +72,6 @@ "ER": "Eritrėja", "ES": "Ispanija", "ET": "Etiopija", - "EZ": "euro zona", "FI": "Suomija", "FJ": "Fidžis", "FK": "Folklando Salos", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Jungtinių Valstijų Mažosios Tolimosios Salos", - "UN": "Jungtinės Tautos", "US": "Jungtinės Valstijos", "UY": "Urugvajus", "UZ": "Uzbekistanas", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/lv.json b/src/Symfony/Component/Intl/Resources/data/regions/lv.json index a5d6739a27730..87ad10494cecd 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/lv.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/lv.json @@ -72,7 +72,6 @@ "ER": "Eritreja", "ES": "Spānija", "ET": "Etiopija", - "EZ": "Eirozona", "FI": "Somija", "FJ": "Fidži", "FK": "Folklenda salas", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "ASV Mazās Aizjūras salas", - "UN": "Apvienoto Nāciju Organizācija", "US": "Amerikas Savienotās Valstis", "UY": "Urugvaja", "UZ": "Uzbekistāna", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/meta.json b/src/Symfony/Component/Intl/Resources/data/regions/meta.json index 9dbe566037405..54569d238e0aa 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/meta.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/meta.json @@ -72,7 +72,6 @@ "ER", "ES", "ET", - "EZ", "FI", "FJ", "FK", @@ -237,7 +236,6 @@ "UA", "UG", "UM", - "UN", "US", "UY", "UZ", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/mk.json b/src/Symfony/Component/Intl/Resources/data/regions/mk.json index d03ade1157a73..bc11772b20bda 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/mk.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/mk.json @@ -72,7 +72,6 @@ "ER": "Еритреја", "ES": "Шпанија", "ET": "Етиопија", - "EZ": "Еврозона", "FI": "Финска", "FJ": "Фиџи", "FK": "Фолкландски Острови", @@ -237,7 +236,6 @@ "UA": "Украина", "UG": "Уганда", "UM": "Американски територии во Пацификот", - "UN": "Обединети нации", "US": "Соединети Американски Држави", "UY": "Уругвај", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ml.json b/src/Symfony/Component/Intl/Resources/data/regions/ml.json index 54e7f6568d3a4..6f367931cc9e4 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ml.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ml.json @@ -72,7 +72,6 @@ "ER": "എറിത്രിയ", "ES": "സ്‌പെയിൻ", "ET": "എത്യോപ്യ", - "EZ": "യൂറോസോൺ", "FI": "ഫിൻലാൻഡ്", "FJ": "ഫിജി", "FK": "ഫാക്ക്‌ലാന്റ് ദ്വീപുകൾ", @@ -237,7 +236,6 @@ "UA": "ഉക്രെയ്‌ൻ", "UG": "ഉഗാണ്ട", "UM": "യു.എസ്. ദ്വീപസമൂഹങ്ങൾ", - "UN": "ഐക്യരാഷ്ട്രസഭ", "US": "അമേരിക്കൻ ഐക്യനാടുകൾ", "UY": "ഉറുഗ്വേ", "UZ": "ഉസ്‌ബെക്കിസ്ഥാൻ", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/mn.json b/src/Symfony/Component/Intl/Resources/data/regions/mn.json index f32d2000b4a11..a40f22bb718c5 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/mn.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/mn.json @@ -72,7 +72,6 @@ "ER": "Эритрей", "ES": "Испани", "ET": "Этиоп", - "EZ": "Евро бүс", "FI": "Финланд", "FJ": "Фижи", "FK": "Фолклендийн арлууд", @@ -237,7 +236,6 @@ "UA": "Украин", "UG": "Уганда", "UM": "Америкийн Нэгдсэн Улсын бага арлууд", - "UN": "Нэгдсэн Үндэстний Байгууллага", "US": "Америкийн Нэгдсэн Улс", "UY": "Уругвай", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/mr.json b/src/Symfony/Component/Intl/Resources/data/regions/mr.json index f80e64ff770d3..91786de809b82 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/mr.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/mr.json @@ -72,7 +72,6 @@ "ER": "एरिट्रिया", "ES": "स्पेन", "ET": "इथिओपिया", - "EZ": "युरोझोन", "FI": "फिनलंड", "FJ": "फिजी", "FK": "फॉकलंड बेटे", @@ -237,7 +236,6 @@ "UA": "युक्रेन", "UG": "युगांडा", "UM": "यू.एस. आउटलाइंग बेटे", - "UN": "संयुक्त राष्ट्र", "US": "युनायटेड स्टेट्स", "UY": "उरुग्वे", "UZ": "उझबेकिस्तान", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ms.json b/src/Symfony/Component/Intl/Resources/data/regions/ms.json index a5b9fae212e0f..6c407fbc872d1 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ms.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ms.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Sepanyol", "ET": "Ethiopia", - "EZ": "Zon Euro", "FI": "Finland", "FJ": "Fiji", "FK": "Kepulauan Falkland", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Uganda", "UM": "Kepulauan Terpencil A.S.", - "UN": "Bangsa-bangsa Bersatu", "US": "Amerika Syarikat", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/my.json b/src/Symfony/Component/Intl/Resources/data/regions/my.json index 73946f0ac61fa..5a40c847b516a 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/my.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/my.json @@ -72,7 +72,6 @@ "ER": "အီရီထရီးယား", "ES": "စပိန်", "ET": "အီသီယိုးပီးယား", - "EZ": "ဥရောပဒေသ", "FI": "ဖင်လန်", "FJ": "ဖီဂျီ", "FK": "ဖော့ကလန် ကျွန်းစု", @@ -237,7 +236,6 @@ "UA": "ယူကရိန်း", "UG": "ယူဂန်းဒါး", "UM": "ယူနိုက်တက်စတိတ် ကျွန်းနိုင်ငံများ", - "UN": "ကုလသမဂ္ဂ", "US": "အမေရိကန် ပြည်ထောင်စု", "UY": "ဥရုဂွေး", "UZ": "ဥဇဘက်ကစ္စတန်", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/nb.json b/src/Symfony/Component/Intl/Resources/data/regions/nb.json index ad15e817644d3..dcf10608a7458 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/nb.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/nb.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spania", "ET": "Etiopia", - "EZ": "eurosonen", "FI": "Finland", "FJ": "Fiji", "FK": "Falklandsøyene", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "USAs ytre øyer", - "UN": "FN", "US": "USA", "UY": "Uruguay", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ne.json b/src/Symfony/Component/Intl/Resources/data/regions/ne.json index a72f1fdccf6ea..34600f488c87e 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ne.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ne.json @@ -72,7 +72,6 @@ "ER": "एरित्रिया", "ES": "स्पेन", "ET": "इथियोपिया", - "EZ": "युरोजोन", "FI": "फिन्ल्याण्ड", "FJ": "फिजी", "FK": "फकल्याण्ड टापुहरु", @@ -237,7 +236,6 @@ "UA": "युक्रेन", "UG": "युगाण्डा", "UM": "संयुक्त राज्यका बाह्य टापुहरु", - "UN": "संयुक्त राष्ट्र संघ", "US": "संयुक्त राज्य", "UY": "उरूग्वे", "UZ": "उज्बेकिस्तान", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/nl.json b/src/Symfony/Component/Intl/Resources/data/regions/nl.json index a57efb1b355b2..48abedc9313bb 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/nl.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/nl.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanje", "ET": "Ethiopië", - "EZ": "eurozone", "FI": "Finland", "FJ": "Fiji", "FK": "Falklandeilanden", @@ -237,7 +236,6 @@ "UA": "Oekraïne", "UG": "Oeganda", "UM": "Kleine afgelegen eilanden van de Verenigde Staten", - "UN": "Verenigde Naties", "US": "Verenigde Staten", "UY": "Uruguay", "UZ": "Oezbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/nn.json b/src/Symfony/Component/Intl/Resources/data/regions/nn.json index 60e95611cf146..e80e7639fa26b 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/nn.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/nn.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spania", "ET": "Etiopia", - "EZ": "eurosona", "FI": "Finland", "FJ": "Fiji", "FK": "Falklandsøyane", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "USAs ytre småøyar", - "UN": "SN", "US": "USA", "UY": "Uruguay", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/no.json b/src/Symfony/Component/Intl/Resources/data/regions/no.json index ad15e817644d3..dcf10608a7458 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/no.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/no.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spania", "ET": "Etiopia", - "EZ": "eurosonen", "FI": "Finland", "FJ": "Fiji", "FK": "Falklandsøyene", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "USAs ytre øyer", - "UN": "FN", "US": "USA", "UY": "Uruguay", "UZ": "Usbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/or.json b/src/Symfony/Component/Intl/Resources/data/regions/or.json index c7d9d4c46118a..e2680dc0d3c79 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/or.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/or.json @@ -72,7 +72,6 @@ "ER": "ଇରିଟ୍ରିୟା", "ES": "ସ୍ପେନ୍", "ET": "ଇଥିଓପିଆ", - "EZ": "ୟୁରୋକ୍ଷେତ୍ର", "FI": "ଫିନଲ୍ୟାଣ୍ଡ", "FJ": "ଫିଜି", "FK": "ଫକ୍‌ଲ୍ୟାଣ୍ଡ ଦ୍ଵୀପପୁଞ୍ଜ", @@ -237,7 +236,6 @@ "UA": "ୟୁକ୍ରେନ୍‌", "UG": "ଉଗାଣ୍ଡା", "UM": "ଯୁକ୍ତରାଷ୍ଟ୍ର ଆଉଟ୍‌ଲାଇଙ୍ଗ ଦ୍ଵୀପପୁଞ୍ଜ", - "UN": "ଜାତିସଂଘ", "US": "ଯୁକ୍ତ ରାଷ୍ଟ୍ର", "UY": "ଉରୁଗୁଏ", "UZ": "ଉଜବେକିସ୍ତାନ", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/pa.json b/src/Symfony/Component/Intl/Resources/data/regions/pa.json index 206bf55846097..f8091bd3bdecf 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/pa.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/pa.json @@ -72,7 +72,6 @@ "ER": "ਇਰੀਟ੍ਰਿਆ", "ES": "ਸਪੇਨ", "ET": "ਇਥੋਪੀਆ", - "EZ": "EZ", "FI": "ਫਿਨਲੈਂਡ", "FJ": "ਫ਼ਿਜੀ", "FK": "ਫ਼ਾਕਲੈਂਡ ਟਾਪੂ", @@ -237,7 +236,6 @@ "UA": "ਯੂਕਰੇਨ", "UG": "ਯੂਗਾਂਡਾ", "UM": "ਯੂ.ਐੱਸ. ਦੂਰ-ਦੁਰਾਡੇ ਟਾਪੂ", - "UN": "ਸੰਯੁਕਤ ਰਾਸ਼ਟਰ", "US": "ਸੰਯੁਕਤ ਰਾਜ", "UY": "ਉਰੂਗਵੇ", "UZ": "ਉਜ਼ਬੇਕਿਸਤਾਨ", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/pl.json b/src/Symfony/Component/Intl/Resources/data/regions/pl.json index 9abb131f316fd..671b9d6d74d88 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/pl.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/pl.json @@ -72,7 +72,6 @@ "ER": "Erytrea", "ES": "Hiszpania", "ET": "Etiopia", - "EZ": "strefa euro", "FI": "Finlandia", "FJ": "Fidżi", "FK": "Falklandy", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Dalekie Wyspy Mniejsze Stanów Zjednoczonych", - "UN": "Organizacja Narodów Zjednoczonych", "US": "Stany Zjednoczone", "UY": "Urugwaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ps.json b/src/Symfony/Component/Intl/Resources/data/regions/ps.json index 03675445edcd4..45d6a2d8e5ebb 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ps.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ps.json @@ -72,7 +72,6 @@ "ER": "اریتره", "ES": "هسپانیه", "ET": "حبشه", - "EZ": "اروپاسيمه", "FI": "فنلینډ", "FJ": "في جي", "FK": "فوکلنډ ټاپو", @@ -237,7 +236,6 @@ "UA": "اوکراین", "UG": "یوګانډا", "UM": "د متحده ایالاتو ټاپو ټاپوګانې", - "UN": "ملگري ملتونه", "US": "متحده ایالات", "UY": "یوروګوی", "UZ": "اوزبکستان", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/pt.json b/src/Symfony/Component/Intl/Resources/data/regions/pt.json index 6bf9bf4269523..a004367e161f9 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/pt.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/pt.json @@ -72,7 +72,6 @@ "ER": "Eritreia", "ES": "Espanha", "ET": "Etiópia", - "EZ": "zona do euro", "FI": "Finlândia", "FJ": "Fiji", "FK": "Ilhas Malvinas", @@ -237,7 +236,6 @@ "UA": "Ucrânia", "UG": "Uganda", "UM": "Ilhas Menores Distantes dos EUA", - "UN": "Nações Unidas", "US": "Estados Unidos", "UY": "Uruguai", "UZ": "Uzbequistão", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/pt_PT.json b/src/Symfony/Component/Intl/Resources/data/regions/pt_PT.json index 38c9ce880b379..5b84703bffea6 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/pt_PT.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/pt_PT.json @@ -19,7 +19,6 @@ "DM": "Domínica", "EE": "Estónia", "EH": "Sara Ocidental", - "EZ": "Zona Euro", "FK": "Ilhas Falkland", "FO": "Ilhas Faroé", "GL": "Gronelândia", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ro.json b/src/Symfony/Component/Intl/Resources/data/regions/ro.json index 76157267588b0..11c04d88d2c7f 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ro.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ro.json @@ -72,7 +72,6 @@ "ER": "Eritreea", "ES": "Spania", "ET": "Etiopia", - "EZ": "Zona euro", "FI": "Finlanda", "FJ": "Fiji", "FK": "Insulele Falkland", @@ -237,7 +236,6 @@ "UA": "Ucraina", "UG": "Uganda", "UM": "Insulele Îndepărtate ale S.U.A.", - "UN": "Națiunile Unite", "US": "Statele Unite ale Americii", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ru.json b/src/Symfony/Component/Intl/Resources/data/regions/ru.json index 3b172ca715175..569797192e320 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ru.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ru.json @@ -72,7 +72,6 @@ "ER": "Эритрея", "ES": "Испания", "ET": "Эфиопия", - "EZ": "еврозона", "FI": "Финляндия", "FJ": "Фиджи", "FK": "Фолклендские о-ва", @@ -237,7 +236,6 @@ "UA": "Украина", "UG": "Уганда", "UM": "Внешние малые о-ва (США)", - "UN": "Организация Объединенных Наций", "US": "Соединенные Штаты", "UY": "Уругвай", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/se_FI.json b/src/Symfony/Component/Intl/Resources/data/regions/se_FI.json index 5aba89f37403b..41c5b42ffc25d 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/se_FI.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/se_FI.json @@ -2,10 +2,8 @@ "Version": "2.1.38.73", "Names": { "BA": "Bosnia ja Hercegovina", - "EZ": "Euroavádat", "KH": "Kamboža", "SD": "Sudan", - "TD": "Chad", - "UN": "Ovttastuvvan Našuvnnat" + "TD": "Chad" } } diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sh.json b/src/Symfony/Component/Intl/Resources/data/regions/sh.json index e8b664995118a..b634f3bef4f3e 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sh.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sh.json @@ -72,7 +72,6 @@ "ER": "Eritreja", "ES": "Španija", "ET": "Etiopija", - "EZ": "Evrozona", "FI": "Finska", "FJ": "Fidži", "FK": "Foklandska Ostrva", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Udaljena ostrva SAD", - "UN": "Ujedinjene nacije", "US": "Sjedinjene Države", "UY": "Urugvaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/si.json b/src/Symfony/Component/Intl/Resources/data/regions/si.json index 9975aeec7d45f..c3b969881e4bb 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/si.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/si.json @@ -72,7 +72,6 @@ "ER": "එරිත්‍රියාව", "ES": "ස්පාඤ්ඤය", "ET": "ඉතියෝපියාව", - "EZ": "යුරෝ කලාපය", "FI": "ෆින්ලන්තය", "FJ": "ෆීජී", "FK": "ෆෝක්ලන්ත දූපත්", @@ -237,7 +236,6 @@ "UA": "යුක්රේනය", "UG": "උගන්ඩාව", "UM": "එක්සත් ජනපද ඈත දූපත්", - "UN": "එක්සත් ජාතීන්", "US": "එක්සත් ජනපදය", "UY": "උරුගුවේ", "UZ": "උස්බෙකිස්ථානය", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sk.json b/src/Symfony/Component/Intl/Resources/data/regions/sk.json index 0bba0649a8f31..7d8d918b4495c 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sk.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sk.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Španielsko", "ET": "Etiópia", - "EZ": "eurozóna", "FI": "Fínsko", "FJ": "Fidži", "FK": "Falklandy", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Menšie odľahlé ostrovy USA", - "UN": "Organizácia Spojených národov", "US": "Spojené štáty", "UY": "Uruguaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sl.json b/src/Symfony/Component/Intl/Resources/data/regions/sl.json index c84a219667d13..15bea67b9d04a 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sl.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sl.json @@ -72,7 +72,6 @@ "ER": "Eritreja", "ES": "Španija", "ET": "Etiopija", - "EZ": "evroobmočje", "FI": "Finska", "FJ": "Fidži", "FK": "Falklandski otoki", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Stranski zunanji otoki Združenih držav", - "UN": "Združeni narodi", "US": "Združene države Amerike", "UY": "Urugvaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sq.json b/src/Symfony/Component/Intl/Resources/data/regions/sq.json index af82944add734..67a4d6bcf7c0f 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sq.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sq.json @@ -72,7 +72,6 @@ "ER": "Eritre", "ES": "Spanjë", "ET": "Etiopi", - "EZ": "Eurozonë", "FI": "Finlandë", "FJ": "Fixhi", "FK": "Ishujt Falkland", @@ -237,7 +236,6 @@ "UA": "Ukrainë", "UG": "Ugandë", "UM": "Ishujt Periferikë të SHBA-së", - "UN": "Kombet e Bashkuara", "US": "Shtetet e Bashkuara të Amerikës", "UY": "Uruguai", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sr.json b/src/Symfony/Component/Intl/Resources/data/regions/sr.json index 125467cbb16d4..e11116d2d8196 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sr.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sr.json @@ -72,7 +72,6 @@ "ER": "Еритреја", "ES": "Шпанија", "ET": "Етиопија", - "EZ": "Еврозона", "FI": "Финска", "FJ": "Фиџи", "FK": "Фокландска Острва", @@ -237,7 +236,6 @@ "UA": "Украјина", "UG": "Уганда", "UM": "Удаљена острва САД", - "UN": "Уједињене нације", "US": "Сједињене Државе", "UY": "Уругвај", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sr_Latn.json b/src/Symfony/Component/Intl/Resources/data/regions/sr_Latn.json index e8b664995118a..b634f3bef4f3e 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sr_Latn.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sr_Latn.json @@ -72,7 +72,6 @@ "ER": "Eritreja", "ES": "Španija", "ET": "Etiopija", - "EZ": "Evrozona", "FI": "Finska", "FJ": "Fidži", "FK": "Foklandska Ostrva", @@ -237,7 +236,6 @@ "UA": "Ukrajina", "UG": "Uganda", "UM": "Udaljena ostrva SAD", - "UN": "Ujedinjene nacije", "US": "Sjedinjene Države", "UY": "Urugvaj", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sv.json b/src/Symfony/Component/Intl/Resources/data/regions/sv.json index 5801373a61caa..934324ff96fda 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sv.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sv.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spanien", "ET": "Etiopien", - "EZ": "eurozonen", "FI": "Finland", "FJ": "Fiji", "FK": "Falklandsöarna", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "USA:s yttre öar", - "UN": "Förenta Nationerna", "US": "USA", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/sw.json b/src/Symfony/Component/Intl/Resources/data/regions/sw.json index 2cb97478b9b35..a91a143bbc696 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/sw.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/sw.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Uhispania", "ET": "Ethiopia", - "EZ": "EZ", "FI": "Ufini", "FJ": "Fiji", "FK": "Visiwa vya Falkland", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Uganda", "UM": "Visiwa Vidogo vya Nje vya Marekani", - "UN": "Umoja wa Mataifa", "US": "Marekani", "UY": "Uruguay", "UZ": "Uzibekistani", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ta.json b/src/Symfony/Component/Intl/Resources/data/regions/ta.json index 0cc6b2e94f282..b8238eeae1acc 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ta.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ta.json @@ -72,7 +72,6 @@ "ER": "எரிட்ரியா", "ES": "ஸ்பெயின்", "ET": "எத்தியோப்பியா", - "EZ": "யூரோஜோன்", "FI": "பின்லாந்து", "FJ": "ஃபிஜி", "FK": "ஃபாக்லாந்து தீவுகள்", @@ -237,7 +236,6 @@ "UA": "உக்ரைன்", "UG": "உகாண்டா", "UM": "யூ.எஸ். வெளிப்புறத் தீவுகள்", - "UN": "ஐக்கிய நாடுகள்", "US": "அமெரிக்கா", "UY": "உருகுவே", "UZ": "உஸ்பெகிஸ்தான்", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/te.json b/src/Symfony/Component/Intl/Resources/data/regions/te.json index e845e339bfb40..0045be5f4e123 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/te.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/te.json @@ -72,7 +72,6 @@ "ER": "ఎరిట్రియా", "ES": "స్పెయిన్", "ET": "ఇథియోపియా", - "EZ": "యూరోజోన్", "FI": "ఫిన్లాండ్", "FJ": "ఫిజీ", "FK": "ఫాక్‌ల్యాండ్ దీవులు", @@ -237,7 +236,6 @@ "UA": "ఉక్రెయిన్", "UG": "ఉగాండా", "UM": "సంయుక్త రాజ్య అమెరికా బయట ఉన్న దీవులు", - "UN": "యునైటెడ్ నేషన్స్", "US": "యునైటెడ్ స్టేట్స్", "UY": "ఉరుగ్వే", "UZ": "ఉజ్బెకిస్తాన్", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/th.json b/src/Symfony/Component/Intl/Resources/data/regions/th.json index 3317bbc7543e0..defa020527ad5 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/th.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/th.json @@ -72,7 +72,6 @@ "ER": "เอริเทรีย", "ES": "สเปน", "ET": "เอธิโอเปีย", - "EZ": "ยูโรโซน", "FI": "ฟินแลนด์", "FJ": "ฟิจิ", "FK": "หมู่เกาะฟอล์กแลนด์", @@ -237,7 +236,6 @@ "UA": "ยูเครน", "UG": "ยูกันดา", "UM": "หมู่เกาะรอบนอกของสหรัฐอเมริกา", - "UN": "สหประชาชาติ", "US": "สหรัฐอเมริกา", "UY": "อุรุกวัย", "UZ": "อุซเบกิสถาน", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/tl.json b/src/Symfony/Component/Intl/Resources/data/regions/tl.json index 19554b3f88089..546894d8f35d2 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/tl.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/tl.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Spain", "ET": "Ethiopia", - "EZ": "Eurozone", "FI": "Finland", "FJ": "Fiji", "FK": "Falkland Islands", @@ -237,7 +236,6 @@ "UA": "Ukraine", "UG": "Uganda", "UM": "U.S. Outlying Islands", - "UN": "United Nations", "US": "Estados Unidos", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/to.json b/src/Symfony/Component/Intl/Resources/data/regions/to.json index 5b63c0201836c..28812f59eed6e 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/to.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/to.json @@ -72,7 +72,6 @@ "ER": "ʻElitulia", "ES": "Sipeini", "ET": "ʻĪtiōpia", - "EZ": "ʻEulope fekauʻaki-paʻanga", "FI": "Finilani", "FJ": "Fisi", "FK": "ʻOtumotu Fokulani", @@ -237,7 +236,6 @@ "UA": "ʻŪkalaʻine", "UG": "ʻIukanitā", "UM": "ʻOtumotu siʻi ʻo ʻAmelika", - "UN": "ʻŪ fonua fakatahataha", "US": "Puleʻanga fakatahataha ʻAmelika", "UY": "ʻUlukuai", "UZ": "ʻUsipekitani", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/tr.json b/src/Symfony/Component/Intl/Resources/data/regions/tr.json index 6e12bc5f1f1be..6996536cbd2eb 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/tr.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/tr.json @@ -72,7 +72,6 @@ "ER": "Eritre", "ES": "İspanya", "ET": "Etiyopya", - "EZ": "Euro Bölgesi", "FI": "Finlandiya", "FJ": "Fiji", "FK": "Falkland Adaları", @@ -237,7 +236,6 @@ "UA": "Ukrayna", "UG": "Uganda", "UM": "ABD Küçük Harici Adaları", - "UN": "Birleşmiş Milletler", "US": "Amerika Birleşik Devletleri", "UY": "Uruguay", "UZ": "Özbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/uk.json b/src/Symfony/Component/Intl/Resources/data/regions/uk.json index 5ddda82648360..08d88962151d0 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/uk.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/uk.json @@ -72,7 +72,6 @@ "ER": "Еритрея", "ES": "Іспанія", "ET": "Ефіопія", - "EZ": "Єврозона", "FI": "Фінляндія", "FJ": "Фіджі", "FK": "Фолклендські острови", @@ -237,7 +236,6 @@ "UA": "Україна", "UG": "Уганда", "UM": "Віддалені острови США", - "UN": "Організація Об’єднаних Націй", "US": "Сполучені Штати", "UY": "Уруґвай", "UZ": "Узбекистан", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/ur.json b/src/Symfony/Component/Intl/Resources/data/regions/ur.json index f315ffdedf7bf..ec4a8aff46592 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/ur.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/ur.json @@ -72,7 +72,6 @@ "ER": "اریٹیریا", "ES": "ہسپانیہ", "ET": "ایتھوپیا", - "EZ": "یوروزون", "FI": "فن لینڈ", "FJ": "فجی", "FK": "فاکلینڈ جزائر", @@ -237,7 +236,6 @@ "UA": "یوکرین", "UG": "یوگنڈا", "UM": "امریکہ سے باہر کے چھوٹے جزائز", - "UN": "اقوام متحدہ", "US": "ریاستہائے متحدہ", "UY": "یوروگوئے", "UZ": "ازبکستان", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/uz.json b/src/Symfony/Component/Intl/Resources/data/regions/uz.json index ab2ddfc66edff..ff17448c5707b 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/uz.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/uz.json @@ -72,7 +72,6 @@ "ER": "Eritreya", "ES": "Ispaniya", "ET": "Efiopiya", - "EZ": "yevrozona", "FI": "Finlandiya", "FJ": "Fiji", "FK": "Folklend orollari", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "AQSH yondosh orollari", - "UN": "Birlashgan Millatlar Tashkiloti", "US": "Amerika Qo‘shma Shtatlari", "UY": "Urugvay", "UZ": "Oʻzbekiston", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/vi.json b/src/Symfony/Component/Intl/Resources/data/regions/vi.json index 4d286235a8b53..71df7f435e522 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/vi.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/vi.json @@ -72,7 +72,6 @@ "ER": "Eritrea", "ES": "Tây Ban Nha", "ET": "Ethiopia", - "EZ": "Khu vực đồng Euro", "FI": "Phần Lan", "FJ": "Fiji", "FK": "Quần đảo Falkland", @@ -237,7 +236,6 @@ "UA": "Ukraina", "UG": "Uganda", "UM": "Các tiểu đảo xa của Hoa Kỳ", - "UN": "Liên hiệp quốc", "US": "Hoa Kỳ", "UY": "Uruguay", "UZ": "Uzbekistan", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/zh.json b/src/Symfony/Component/Intl/Resources/data/regions/zh.json index 4fc172b7647ad..6a1e11eefd4da 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/zh.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/zh.json @@ -72,7 +72,6 @@ "ER": "厄立特里亚", "ES": "西班牙", "ET": "埃塞俄比亚", - "EZ": "欧元区", "FI": "芬兰", "FJ": "斐济", "FK": "福克兰群岛", @@ -237,7 +236,6 @@ "UA": "乌克兰", "UG": "乌干达", "UM": "美国本土外小岛屿", - "UN": "联合国", "US": "美国", "UY": "乌拉圭", "UZ": "乌兹别克斯坦", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/zh_Hant.json b/src/Symfony/Component/Intl/Resources/data/regions/zh_Hant.json index 1b7ef475ad1e1..ab60d9829570c 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/zh_Hant.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/zh_Hant.json @@ -72,7 +72,6 @@ "ER": "厄利垂亞", "ES": "西班牙", "ET": "衣索比亞", - "EZ": "歐元區", "FI": "芬蘭", "FJ": "斐濟", "FK": "福克蘭群島", @@ -237,7 +236,6 @@ "UA": "烏克蘭", "UG": "烏干達", "UM": "美國本土外小島嶼", - "UN": "聯合國", "US": "美國", "UY": "烏拉圭", "UZ": "烏茲別克", diff --git a/src/Symfony/Component/Intl/Resources/data/regions/zu.json b/src/Symfony/Component/Intl/Resources/data/regions/zu.json index e92b1858c0684..77f36017cfd58 100644 --- a/src/Symfony/Component/Intl/Resources/data/regions/zu.json +++ b/src/Symfony/Component/Intl/Resources/data/regions/zu.json @@ -72,7 +72,6 @@ "ER": "i-Eritrea", "ES": "i-Spain", "ET": "i-Ethiopia", - "EZ": "EZ", "FI": "i-Finland", "FJ": "i-Fiji", "FK": "i-Falkland Islands", @@ -237,7 +236,6 @@ "UA": "i-Ukraine", "UG": "i-Uganda", "UM": "i-U.S. Minor Outlying Islands", - "UN": "I-United Nations", "US": "i-United States", "UY": "i-Uruguay", "UZ": "i-Uzbekistan", diff --git a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php index 1b790d41c9a73..f282d64e01930 100644 --- a/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php +++ b/src/Symfony/Component/Intl/Tests/Data/Provider/AbstractRegionDataProviderTest.php @@ -94,7 +94,6 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest 'ER', 'ES', 'ET', - 'EZ', 'FI', 'FJ', 'FK', @@ -259,7 +258,6 @@ abstract class AbstractRegionDataProviderTest extends AbstractDataProviderTest 'UA', 'UG', 'UM', - 'UN', 'US', 'UY', 'UZ', diff --git a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php index 0e10f7d374a0c..ece5ad5625791 100644 --- a/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php +++ b/src/Symfony/Component/Intl/Tests/NumberFormatter/AbstractNumberFormatterTest.php @@ -654,6 +654,7 @@ public function parseProvider() array('-123,4567', false, '->parse() does not parse when invalid grouping used.', 9), array('-123,,456', false, '->parse() does not parse when invalid grouping used.', 4), array('-123,,456', -123.0, '->parse() parses when grouping is disabled.', 4, false), + array('239.', 239.0, '->parse() parses when string ends with decimal separator.', 4, false), ); } diff --git a/src/Symfony/Component/Ldap/LdapClient.php b/src/Symfony/Component/Ldap/LdapClient.php index de341e06d2707..92a7be997068b 100644 --- a/src/Symfony/Component/Ldap/LdapClient.php +++ b/src/Symfony/Component/Ldap/LdapClient.php @@ -136,7 +136,7 @@ private function connect() ldap_set_option($this->connection, LDAP_OPT_REFERRALS, $this->optReferrals); if ($this->useStartTls) { - ldap_start_tls($this->connection); + @ldap_start_tls($this->connection); } } } diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/src/Symfony/Component/OptionsResolver/OptionsResolver.php index be9d44ed05796..20d0770ebcd11 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -360,11 +360,9 @@ public function getDefinedOptions() * * The normalizer should be a closure with the following signature: * - * ```php - * function (Options $options, $value) { - * // ... - * } - * ``` + * function (Options $options, $value) { + * // ... + * } * * The closure is invoked when {@link resolve()} is called. The closure * has access to the resolved values of other options through the passed @@ -390,11 +388,7 @@ public function setNormalizer($option, \Closure $normalizer) } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->normalizers[$option] = $normalizer; @@ -468,11 +462,7 @@ public function setAllowedValues($option, $allowedValues = null) } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->allowedValues[$option] = \is_array($allowedValues) ? $allowedValues : array($allowedValues); @@ -524,11 +514,7 @@ public function addAllowedValues($option, $allowedValues = null) } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } if (!\is_array($allowedValues)) { @@ -580,11 +566,7 @@ public function setAllowedTypes($option, $allowedTypes = null) } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } $this->allowedTypes[$option] = (array) $allowedTypes; @@ -630,11 +612,7 @@ public function addAllowedTypes($option, $allowedTypes = null) } if (!isset($this->defined[$option])) { - throw new UndefinedOptionsException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new UndefinedOptionsException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } if (!isset($this->allowedTypes[$option])) { @@ -739,11 +717,7 @@ public function resolve(array $options = array()) ksort($clone->defined); ksort($diff); - throw new UndefinedOptionsException(sprintf( - (\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', - implode('", "', array_keys($diff)), - implode('", "', array_keys($clone->defined)) - )); + throw new UndefinedOptionsException(sprintf((\count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".', implode('", "', array_keys($diff)), implode('", "', array_keys($clone->defined)))); } // Override options set by the user @@ -758,10 +732,7 @@ public function resolve(array $options = array()) if (\count($diff) > 0) { ksort($diff); - throw new MissingOptionsException(sprintf( - \count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', - implode('", "', array_keys($diff)) - )); + throw new MissingOptionsException(sprintf(\count($diff) > 1 ? 'The required options "%s" are missing.' : 'The required option "%s" is missing.', implode('", "', array_keys($diff)))); } // Lock the container @@ -805,17 +776,10 @@ public function offsetGet($option) // Check whether the option is set at all if (!array_key_exists($option, $this->defaults)) { if (!isset($this->defined[$option])) { - throw new NoSuchOptionException(sprintf( - 'The option "%s" does not exist. Defined options are: "%s".', - $option, - implode('", "', array_keys($this->defined)) - )); + throw new NoSuchOptionException(sprintf('The option "%s" does not exist. Defined options are: "%s".', $option, implode('", "', array_keys($this->defined)))); } - throw new NoSuchOptionException(sprintf( - 'The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', - $option - )); + throw new NoSuchOptionException(sprintf('The optional option "%s" has no value set. You should make sure it is set with "isset" before reading it.', $option)); } $value = $this->defaults[$option]; @@ -825,10 +789,7 @@ public function offsetGet($option) // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { - throw new OptionDefinitionException(sprintf( - 'The options "%s" have a cyclic dependency.', - implode('", "', array_keys($this->calling)) - )); + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } // The following section must be protected from cyclic @@ -874,14 +835,7 @@ public function offsetGet($option) } if (!$valid) { - throw new InvalidOptionsException(sprintf( - 'The option "%s" with value %s is expected to be of type '. - '"%s", but is of type "%s".', - $option, - $this->formatValue($value), - implode('" or "', $this->allowedTypes[$option]), - $this->formatTypeOf($value) - )); + throw new InvalidOptionsException(sprintf('The option "%s" with value %s is expected to be of type "%s", but is of type "%s".', $option, $this->formatValue($value), implode('" or "', $this->allowedTypes[$option]), $this->formatTypeOf($value))); } } @@ -930,10 +884,7 @@ public function offsetGet($option) // If the closure is already being called, we have a cyclic // dependency if (isset($this->calling[$option])) { - throw new OptionDefinitionException(sprintf( - 'The options "%s" have a cyclic dependency.', - implode('", "', array_keys($this->calling)) - )); + throw new OptionDefinitionException(sprintf('The options "%s" have a cyclic dependency.', implode('", "', array_keys($this->calling)))); } $normalizer = $this->normalizers[$option]; diff --git a/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php b/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php index 24f343e026aa6..156cc751e70b1 100644 --- a/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php +++ b/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php @@ -29,10 +29,8 @@ interface OptionsResolverInterface * evaluate the option value lazily. These closures must have one * of the following signatures: * - * - * function (Options $options) - * function (Options $options, $value) - * + * function (Options $options) + * function (Options $options, $value) * * The second parameter passed to the closure is the previously * set default value, in case you are overwriting an existing @@ -154,9 +152,7 @@ public function addAllowedTypes($allowedTypes); * * The normalizers should be closures with the following signature: * - * - * function (Options $options, $value) - * + * function (Options $options, $value) * * The second parameter passed to the closure is the value of * the option. diff --git a/src/Symfony/Component/Process/PhpProcess.php b/src/Symfony/Component/Process/PhpProcess.php index 6bf6bb67495b2..31a855d943af2 100644 --- a/src/Symfony/Component/Process/PhpProcess.php +++ b/src/Symfony/Component/Process/PhpProcess.php @@ -16,9 +16,9 @@ /** * PhpProcess runs a PHP script in an independent process. * - * $p = new PhpProcess(''); - * $p->run(); - * print $p->getOutput()."\n"; + * $p = new PhpProcess(''); + * $p->run(); + * print $p->getOutput()."\n"; * * @author Fabien Potencier */ diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 9589136c6b096..b0a5916adfcaa 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1413,8 +1413,8 @@ private function resetProcessData() $this->exitcode = null; $this->fallbackStatus = array(); $this->processInformation = null; - $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); - $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); + $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); + $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); $this->process = null; $this->latestSignal = null; $this->status = self::STATUS_READY; diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php index d639506ef3f9f..c14afc2dd9449 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php +++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php @@ -345,22 +345,13 @@ private function readPropertiesUntil($zval, PropertyPathInterface $propertyPath, if (!$ignoreInvalidIndices) { if (!\is_array($zval[self::VALUE])) { if (!$zval[self::VALUE] instanceof \Traversable) { - throw new NoSuchIndexException(sprintf( - 'Cannot read index "%s" while trying to traverse path "%s".', - $property, - (string) $propertyPath - )); + throw new NoSuchIndexException(sprintf('Cannot read index "%s" while trying to traverse path "%s".', $property, (string) $propertyPath)); } $zval[self::VALUE] = iterator_to_array($zval[self::VALUE]); } - throw new NoSuchIndexException(sprintf( - 'Cannot read index "%s" while trying to traverse path "%s". Available indices are "%s".', - $property, - (string) $propertyPath, - print_r(array_keys($zval[self::VALUE]), true) - )); + throw new NoSuchIndexException(sprintf('Cannot read index "%s" while trying to traverse path "%s". Available indices are "%s".', $property, (string) $propertyPath, print_r(array_keys($zval[self::VALUE]), true))); } if ($i + 1 < $propertyPath->getLength()) { diff --git a/src/Symfony/Component/PropertyAccess/PropertyPath.php b/src/Symfony/Component/PropertyAccess/PropertyPath.php index 890b8ffce61b4..2897a4adfab8b 100644 --- a/src/Symfony/Component/PropertyAccess/PropertyPath.php +++ b/src/Symfony/Component/PropertyAccess/PropertyPath.php @@ -77,12 +77,7 @@ public function __construct($propertyPath) return; } if (!\is_string($propertyPath)) { - throw new InvalidArgumentException(sprintf( - 'The property path constructor needs a string or an instance of '. - '"Symfony\Component\PropertyAccess\PropertyPath". '. - 'Got: "%s"', - \is_object($propertyPath) ? \get_class($propertyPath) : \gettype($propertyPath) - )); + throw new InvalidArgumentException(sprintf('The property path constructor needs a string or an instance of "Symfony\Component\PropertyAccess\PropertyPath". Got: "%s"', \is_object($propertyPath) ? \get_class($propertyPath) : \gettype($propertyPath))); } if ('' === $propertyPath) { @@ -113,12 +108,7 @@ public function __construct($propertyPath) } if ('' !== $remaining) { - throw new InvalidPropertyPathException(sprintf( - 'Could not parse property path "%s". Unexpected token "%s" at position %d', - $propertyPath, - $remaining[0], - $position - )); + throw new InvalidPropertyPathException(sprintf('Could not parse property path "%s". Unexpected token "%s" at position %d', $propertyPath, $remaining[0], $position)); } $this->length = \count($this->elements); diff --git a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php index 2d98eed190484..47fc8cf7693f9 100644 --- a/src/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/src/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -209,28 +209,16 @@ protected function validate($config, $name, $path) throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); } if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', - $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys) - )); + throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys))); } if (isset($config['resource']) && isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', - $path, $name - )); + throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name)); } if (!isset($config['resource']) && isset($config['type'])) { - throw new \InvalidArgumentException(sprintf( - 'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', - $name, $path - )); + throw new \InvalidArgumentException(sprintf('The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', $name, $path)); } if (!isset($config['resource']) && !isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'You must define a "path" for the route "%s" in file "%s".', - $name, $path - )); + throw new \InvalidArgumentException(sprintf('You must define a "path" for the route "%s" in file "%s".', $name, $path)); } } } diff --git a/src/Symfony/Component/Routing/RouteCollectionBuilder.php b/src/Symfony/Component/Routing/RouteCollectionBuilder.php index 4503eca5a85b3..34b2abc5bf6c7 100644 --- a/src/Symfony/Component/Routing/RouteCollectionBuilder.php +++ b/src/Symfony/Component/Routing/RouteCollectionBuilder.php @@ -46,7 +46,7 @@ public function __construct(LoaderInterface $loader = null) /** * Import an external routing resource and returns the RouteCollectionBuilder. * - * $routes->import('blog.yml', '/blog'); + * $routes->import('blog.yml', '/blog'); * * @param mixed $resource * @param string|null $prefix diff --git a/src/Symfony/Component/Security/Core/User/UserInterface.php b/src/Symfony/Component/Security/Core/User/UserInterface.php index 747884282dcaa..613db8ecc0fac 100644 --- a/src/Symfony/Component/Security/Core/User/UserInterface.php +++ b/src/Symfony/Component/Security/Core/User/UserInterface.php @@ -36,12 +36,10 @@ interface UserInterface /** * Returns the roles granted to the user. * - * - * public function getRoles() - * { - * return array('ROLE_USER'); - * } - * + * public function getRoles() + * { + * return array('ROLE_USER'); + * } * * Alternatively, the roles might be stored on a ``roles`` property, * and populated in any number of different ways when the user object diff --git a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php index 214a189e99b17..2ec282144cfe3 100644 --- a/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php +++ b/src/Symfony/Component/Security/Csrf/Tests/CsrfTokenManagerTest.php @@ -210,12 +210,12 @@ private function getGeneratorAndStorage() ); } - public function setUp() + protected function setUp() { $_SERVER['HTTPS'] = 'on'; } - public function tearDown() + protected function tearDown() { parent::tearDown(); diff --git a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php index 837d7e0fbec61..26f06ab5bedce 100644 --- a/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php +++ b/src/Symfony/Component/Security/Guard/Firewall/GuardAuthenticationListener.php @@ -190,10 +190,7 @@ private function triggerRememberMe(GuardAuthenticatorInterface $guardAuthenticat } if (!$response instanceof Response) { - throw new \LogicException(sprintf( - '%s::onAuthenticationSuccess *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', - \get_class($guardAuthenticator) - )); + throw new \LogicException(sprintf('%s::onAuthenticationSuccess *must* return a Response if you want to use the remember me functionality. Return a Response, or set remember_me to false under the guard configuration.', \get_class($guardAuthenticator))); } $this->rememberMeServices->loginSuccess($request, $response, $token); diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php index 00e6bfb069825..194e2e1908666 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorHandler.php @@ -84,11 +84,7 @@ public function handleAuthenticationSuccess(TokenInterface $token, Request $requ return $response; } - throw new \UnexpectedValueException(sprintf( - 'The %s::onAuthenticationSuccess method must return null or a Response object. You returned %s.', - \get_class($guardAuthenticator), - \is_object($response) ? \get_class($response) : \gettype($response) - )); + throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationSuccess method must return null or a Response object. You returned %s.', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response))); } /** @@ -132,11 +128,7 @@ public function handleAuthenticationFailure(AuthenticationException $authenticat return $response; } - throw new \UnexpectedValueException(sprintf( - 'The %s::onAuthenticationFailure method must return null or a Response object. You returned %s.', - \get_class($guardAuthenticator), - \is_object($response) ? \get_class($response) : \gettype($response) - )); + throw new \UnexpectedValueException(sprintf('The %s::onAuthenticationFailure method must return null or a Response object. You returned %s.', \get_class($guardAuthenticator), \is_object($response) ? \get_class($response) : \gettype($response))); } /** diff --git a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php index 307d70f9e973e..3cafddcdaa15c 100644 --- a/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php +++ b/src/Symfony/Component/Security/Guard/GuardAuthenticatorInterface.php @@ -40,18 +40,18 @@ interface GuardAuthenticatorInterface extends AuthenticationEntryPointInterface * * For example, for a form login, you might: * - * if ($request->request->has('_username')) { - * return array( - * 'username' => $request->request->get('_username'), - * 'password' => $request->request->get('_password'), - * ); - * } else { - * return; - * } + * if ($request->request->has('_username')) { + * return array( + * 'username' => $request->request->get('_username'), + * 'password' => $request->request->get('_password'), + * ); + * } else { + * return; + * } * * Or for an API token that's on a header, you might use: * - * return array('api_key' => $request->headers->get('X-API-TOKEN')); + * return array('api_key' => $request->headers->get('X-API-TOKEN')); * * @param Request $request * diff --git a/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php b/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php index f9484e0a6c7dc..c37a0e4875797 100644 --- a/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php +++ b/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php @@ -31,10 +31,14 @@ interface AuthenticationEntryPointInterface * response that "helps" the user start into the authentication process. * * Examples: - * A) For a form login, you might redirect to the login page - * return new RedirectResponse('/login'); - * B) For an API token authentication system, you return a 401 response - * return new Response('Auth header required', 401); + * + * - For a form login, you might redirect to the login page + * + * return new RedirectResponse('/login'); + * + * - For an API token authentication system, you return a 401 response + * + * return new Response('Auth header required', 401); * * @param Request $request The request that resulted in an AuthenticationException * @param AuthenticationException $authException The exception that started the authentication process diff --git a/src/Symfony/Component/Security/Http/HttpUtils.php b/src/Symfony/Component/Security/Http/HttpUtils.php index 60498231a614b..b0377bb44f9b0 100644 --- a/src/Symfony/Component/Security/Http/HttpUtils.php +++ b/src/Symfony/Component/Security/Http/HttpUtils.php @@ -91,6 +91,13 @@ public function createRequest(Request $request, $path) $newRequest->attributes->set(Security::LAST_USERNAME, $request->attributes->get(Security::LAST_USERNAME)); } + if ($request->get('_format')) { + $newRequest->attributes->set('_format', $request->get('_format')); + } + if ($request->getDefaultLocale() !== $request->getLocale()) { + $newRequest->setLocale($request->getLocale()); + } + return $newRequest; } diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index afb48b4e36c9d..d448885a31645 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -122,10 +122,7 @@ public function setCallbacks(array $callbacks) { foreach ($callbacks as $attribute => $callback) { if (!\is_callable($callback)) { - throw new InvalidArgumentException(sprintf( - 'The given callback for attribute "%s" is not callable.', - $attribute - )); + throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute)); } } $this->callbacks = $callbacks; @@ -337,13 +334,7 @@ protected function instantiateObject(array &$data, $class, array &$context, \Ref } elseif ($constructorParameter->isDefaultValueAvailable()) { $params[] = $constructorParameter->getDefaultValue(); } else { - throw new RuntimeException( - sprintf( - 'Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.', - $class, - $constructorParameter->name - ) - ); + throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because its constructor requires parameter "%s" to be present.', $class, $constructorParameter->name)); } } diff --git a/src/Symfony/Component/Serializer/Serializer.php b/src/Symfony/Component/Serializer/Serializer.php index 1214771eb131d..f935d1db35a95 100644 --- a/src/Symfony/Component/Serializer/Serializer.php +++ b/src/Symfony/Component/Serializer/Serializer.php @@ -26,9 +26,9 @@ * objects are turned into arrays by normalizers. * arrays are turned into various output formats by encoders. * - * $serializer->serialize($obj, 'xml') - * $serializer->decode($data, 'xml') - * $serializer->denormalize($data, 'Class', 'xml') + * $serializer->serialize($obj, 'xml') + * $serializer->decode($data, 'xml') + * $serializer->denormalize($data, 'Class', 'xml') * * @author Jordi Boggiano * @author Johannes M. Schmitt diff --git a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php index 2ed89868e7405..4372c501c1cf8 100644 --- a/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php +++ b/src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php @@ -167,8 +167,8 @@ public function testContext() public function testEncodeScalarRootAttributes() { $array = array( - '#' => 'Paul', - '@gender' => 'm', + '#' => 'Paul', + '@gender' => 'm', ); $expected = ''."\n". @@ -180,8 +180,8 @@ public function testEncodeScalarRootAttributes() public function testEncodeRootAttributes() { $array = array( - 'firstname' => 'Paul', - '@gender' => 'm', + 'firstname' => 'Paul', + '@gender' => 'm', ); $expected = ''."\n". @@ -193,7 +193,7 @@ public function testEncodeRootAttributes() public function testEncodeCdataWrapping() { $array = array( - 'firstname' => 'Paul ', + 'firstname' => 'Paul ', ); $expected = ''."\n". diff --git a/src/Symfony/Component/Templating/Helper/AssetsHelper.php b/src/Symfony/Component/Templating/Helper/AssetsHelper.php index 363b4aa6d1e16..43f62c19c5df9 100644 --- a/src/Symfony/Component/Templating/Helper/AssetsHelper.php +++ b/src/Symfony/Component/Templating/Helper/AssetsHelper.php @@ -21,9 +21,7 @@ * * Usage: * - * - * - * + * * * @author Fabien Potencier * @author Kris Wallsmith diff --git a/src/Symfony/Component/Templating/Helper/CoreAssetsHelper.php b/src/Symfony/Component/Templating/Helper/CoreAssetsHelper.php index a246a1b52251c..b8b0a9a70dcc6 100644 --- a/src/Symfony/Component/Templating/Helper/CoreAssetsHelper.php +++ b/src/Symfony/Component/Templating/Helper/CoreAssetsHelper.php @@ -20,9 +20,7 @@ * * Usage: * - * - * - * + * * * @author Fabien Potencier * @author Kris Wallsmith diff --git a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php index 4f0e26fa9729f..0a94476ab7b31 100644 --- a/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php +++ b/src/Symfony/Component/Translation/Catalogue/AbstractOperation.php @@ -37,21 +37,20 @@ abstract class AbstractOperation implements OperationInterface * This array stores 'all', 'new' and 'obsolete' messages for all valid domains. * * The data structure of this array is as follows: - * ```php - * array( - * 'domain 1' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * 'domain 2' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * ... - * ) - * ``` + * + * array( + * 'domain 1' => array( + * 'all' => array(...), + * 'new' => array(...), + * 'obsolete' => array(...) + * ), + * 'domain 2' => array( + * 'all' => array(...), + * 'new' => array(...), + * 'obsolete' => array(...) + * ), + * ... + * ) * * @var array The array that stores 'all', 'new' and 'obsolete' messages */ diff --git a/src/Symfony/Component/Translation/Dumper/CsvFileDumper.php b/src/Symfony/Component/Translation/Dumper/CsvFileDumper.php index 18caa3657d2f5..36fd5b382cd30 100644 --- a/src/Symfony/Component/Translation/Dumper/CsvFileDumper.php +++ b/src/Symfony/Component/Translation/Dumper/CsvFileDumper.php @@ -38,7 +38,7 @@ public function format(MessageCatalogue $messages, $domain = 'messages') */ public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) { - $handle = fopen('php://memory', 'rb+'); + $handle = fopen('php://memory', 'r+b'); foreach ($messages->all($domain) as $source => $target) { fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure); diff --git a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php index 6303125b83f37..4c513c24f9bd7 100644 --- a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php @@ -42,85 +42,85 @@ public function testCollect() { $collectedMessages = array( array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), - 'transChoiceNumber' => 3, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array('%count%' => 3), + 'transChoiceNumber' => 3, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), - 'transChoiceNumber' => 3, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array('%count%' => 3), + 'transChoiceNumber' => 3, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 4, '%foo%' => 'bar'), - 'transChoiceNumber' => 4, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array('%count%' => 4, '%foo%' => 'bar'), + 'transChoiceNumber' => 4, ), ); $expectedMessages = array( array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'count' => 1, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'count' => 1, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'count' => 1, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'count' => 1, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'count' => 3, - 'parameters' => array( - array('%count%' => 3), - array('%count%' => 3), - array('%count%' => 4, '%foo%' => 'bar'), - ), - 'transChoiceNumber' => 3, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'count' => 3, + 'parameters' => array( + array('%count%' => 3), + array('%count%' => 3), + array('%count%' => 4, '%foo%' => 'bar'), + ), + 'transChoiceNumber' => 3, ), ); diff --git a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php index cc196223ccfa8..1cdd33b395f0d 100644 --- a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php +++ b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php @@ -31,49 +31,49 @@ public function testCollectMessages() $expectedMessages = array(); $expectedMessages[] = array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'parameters' => array(), + 'transChoiceNumber' => null, ); $expectedMessages[] = array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array(), + 'transChoiceNumber' => null, ); $expectedMessages[] = array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array(), - 'transChoiceNumber' => 0, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array(), + 'transChoiceNumber' => 0, ); $expectedMessages[] = array( - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar_ru', + 'translation' => 'bar (ru)', + 'locale' => 'ru', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array(), + 'transChoiceNumber' => null, ); $expectedMessages[] = array( - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array('foo' => 'bar'), - 'transChoiceNumber' => null, + 'id' => 'bar_ru', + 'translation' => 'bar (ru)', + 'locale' => 'ru', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array('foo' => 'bar'), + 'transChoiceNumber' => null, ); $this->assertEquals($expectedMessages, $collector->getCollectedMessages()); diff --git a/src/Symfony/Component/Validator/Constraint.php b/src/Symfony/Component/Validator/Constraint.php index 70a11ef8c98c7..45d4bcf41a4b8 100644 --- a/src/Symfony/Component/Validator/Constraint.php +++ b/src/Symfony/Component/Validator/Constraint.php @@ -70,11 +70,7 @@ abstract class Constraint public static function getErrorName($errorCode) { if (!isset(static::$errorNames[$errorCode])) { - throw new InvalidArgumentException(sprintf( - 'The error code "%s" does not exist for constraint of type "%s".', - $errorCode, - \get_called_class() - )); + throw new InvalidArgumentException(sprintf('The error code "%s" does not exist for constraint of type "%s".', $errorCode, \get_called_class())); } return static::$errorNames[$errorCode]; @@ -137,9 +133,7 @@ public function __construct($options = null) $option = $this->getDefaultOption(); if (null === $option) { - throw new ConstraintDefinitionException( - sprintf('No default option is configured for constraint %s', \get_class($this)) - ); + throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint %s', \get_class($this))); } if (array_key_exists($option, $knownOptions)) { @@ -151,17 +145,11 @@ public function __construct($options = null) } if (\count($invalidOptions) > 0) { - throw new InvalidOptionsException( - sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), - $invalidOptions - ); + throw new InvalidOptionsException(sprintf('The options "%s" do not exist in constraint %s', implode('", "', $invalidOptions), \get_class($this)), $invalidOptions); } if (\count($missingOptions) > 0) { - throw new MissingOptionsException( - sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), - array_keys($missingOptions) - ); + throw new MissingOptionsException(sprintf('The options "%s" must be set for constraint %s', implode('", "', array_keys($missingOptions)), \get_class($this)), array_keys($missingOptions)); } } diff --git a/src/Symfony/Component/Validator/ConstraintViolationInterface.php b/src/Symfony/Component/Validator/ConstraintViolationInterface.php index 9889b92fe31b6..0ab53b0fef61e 100644 --- a/src/Symfony/Component/Validator/ConstraintViolationInterface.php +++ b/src/Symfony/Component/Validator/ConstraintViolationInterface.php @@ -19,11 +19,9 @@ * element in the validation graph and the root element that was originally * passed to the validator. For example, take the following graph: * - *
- * (Person)---(firstName: string)
- *      \
- *   (address: Address)---(street: string)
- * 
+ * (Person)---(firstName: string) + * \ + * (address: Address)---(street: string) * * If the Person object is validated and validation fails for the * "firstName" property, the generated violation has the Person diff --git a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php index c2a6e685f95be..15afebb0bc4ca 100644 --- a/src/Symfony/Component/Validator/Constraints/AbstractComparison.php +++ b/src/Symfony/Component/Validator/Constraints/AbstractComparison.php @@ -35,10 +35,7 @@ public function __construct($options = null) } if (\is_array($options) && !isset($options['value'])) { - throw new ConstraintDefinitionException(sprintf( - 'The %s constraint requires the "value" option to be set.', - \get_class($this) - )); + throw new ConstraintDefinitionException(sprintf('The %s constraint requires the "value" option to be set.', \get_class($this))); } parent::__construct($options); diff --git a/src/Symfony/Component/Validator/Constraints/CallbackValidator.php b/src/Symfony/Component/Validator/Constraints/CallbackValidator.php index 8401f8e6ebd96..d4b440f197ab3 100644 --- a/src/Symfony/Component/Validator/Constraints/CallbackValidator.php +++ b/src/Symfony/Component/Validator/Constraints/CallbackValidator.php @@ -33,10 +33,7 @@ public function validate($object, Constraint $constraint) } if (null !== $constraint->callback && null !== $constraint->methods) { - throw new ConstraintDefinitionException( - 'The Callback constraint supports either the option "callback" '. - 'or "methods", but not both at the same time.' - ); + throw new ConstraintDefinitionException('The Callback constraint supports either the option "callback" or "methods", but not both at the same time.'); } // has to be an array so that we can differentiate between callables diff --git a/src/Symfony/Component/Validator/Constraints/Composite.php b/src/Symfony/Component/Validator/Constraints/Composite.php index 2f2b8d29a0e64..d233f06335e1a 100644 --- a/src/Symfony/Component/Validator/Constraints/Composite.php +++ b/src/Symfony/Component/Validator/Constraints/Composite.php @@ -99,13 +99,7 @@ public function __construct($options = null) $excessGroups = array_diff($constraint->groups, $this->groups); if (\count($excessGroups) > 0) { - throw new ConstraintDefinitionException(sprintf( - 'The group(s) "%s" passed to the constraint %s '. - 'should also be passed to its containing constraint %s', - implode('", "', $excessGroups), - \get_class($constraint), - \get_class($this) - )); + throw new ConstraintDefinitionException(sprintf('The group(s) "%s" passed to the constraint %s should also be passed to its containing constraint %s', implode('", "', $excessGroups), \get_class($constraint), \get_class($this))); } } else { $constraint->groups = $this->groups; diff --git a/src/Symfony/Component/Validator/Constraints/FileValidator.php b/src/Symfony/Component/Validator/Constraints/FileValidator.php index bb96e2c9a18d8..33c784b68cddd 100644 --- a/src/Symfony/Component/Validator/Constraints/FileValidator.php +++ b/src/Symfony/Component/Validator/Constraints/FileValidator.php @@ -58,7 +58,7 @@ public function validate($value, Constraint $constraint) $binaryFormat = $constraint->binaryFormat; } else { $limitInBytes = $iniLimitSize; - $binaryFormat = true; + $binaryFormat = null === $constraint->binaryFormat ? true : $constraint->binaryFormat; } list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); diff --git a/src/Symfony/Component/Validator/Constraints/GroupSequence.php b/src/Symfony/Component/Validator/Constraints/GroupSequence.php index fb3b706a8f32a..d2c4d4ab1f3f9 100644 --- a/src/Symfony/Component/Validator/Constraints/GroupSequence.php +++ b/src/Symfony/Component/Validator/Constraints/GroupSequence.php @@ -145,10 +145,7 @@ public function offsetGet($offset) @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); if (!isset($this->groups[$offset])) { - throw new OutOfBoundsException(sprintf( - 'The offset "%s" does not exist.', - $offset - )); + throw new OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset)); } return $this->groups[$offset]; diff --git a/src/Symfony/Component/Validator/Constraints/Traverse.php b/src/Symfony/Component/Validator/Constraints/Traverse.php index 0b74d98d463ec..4572c9b2193c4 100644 --- a/src/Symfony/Component/Validator/Constraints/Traverse.php +++ b/src/Symfony/Component/Validator/Constraints/Traverse.php @@ -26,10 +26,7 @@ class Traverse extends Constraint public function __construct($options = null) { if (\is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s', __CLASS__)); } parent::__construct($options); diff --git a/src/Symfony/Component/Validator/Constraints/Valid.php b/src/Symfony/Component/Validator/Constraints/Valid.php index 23e4f38f40200..35a8edcc0e570 100644 --- a/src/Symfony/Component/Validator/Constraints/Valid.php +++ b/src/Symfony/Component/Validator/Constraints/Valid.php @@ -32,10 +32,7 @@ class Valid extends Constraint public function __construct($options = null) { if (\is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); + throw new ConstraintDefinitionException(sprintf('The option "groups" is not supported by the constraint %s', __CLASS__)); } if (\is_array($options) && array_key_exists('deep', $options)) { diff --git a/src/Symfony/Component/Validator/ExecutionContextInterface.php b/src/Symfony/Component/Validator/ExecutionContextInterface.php index 2f352fa6809dc..08979cb964f6c 100644 --- a/src/Symfony/Component/Validator/ExecutionContextInterface.php +++ b/src/Symfony/Component/Validator/ExecutionContextInterface.php @@ -16,21 +16,17 @@ * * For example, let's validate the following object graph: * - *
- * (Person)---($firstName: string)
- *      \
- *   ($address: Address)---($street: string)
- * 
+ * (Person)---($firstName: string) + * \ + * ($address: Address)---($street: string) * * We validate the Person instance, which becomes the "root" of the * validation run (see {@link getRoot}). The state of the context after the * first step will be like this: * - *
- * (Person)---($firstName: string)
- *    ^ \
- *   ($address: Address)---($street: string)
- * 
+ * (Person)---($firstName: string) + * ^ \ + * ($address: Address)---($street: string) * * The validator is stopped at the Person node, both the root and the * value (see {@link getValue}) of the context point to the Person @@ -41,11 +37,9 @@ * After advancing to the property $firstName of the Person * instance, the state of the context looks like this: * - *
- * (Person)---($firstName: string)
- *      \              ^
- *   ($address: Address)---($street: string)
- * 
+ * (Person)---($firstName: string) + * \ ^ + * ($address: Address)---($street: string) * * The validator is stopped at the property $firstName. The root still * points to the Person instance, because this is where the validation @@ -56,12 +50,10 @@ * $street property of the Address instance, the context state * looks like this: * - *
- * (Person)---($firstName: string)
- *      \
- *   ($address: Address)---($street: string)
- *                               ^
- * 
+ * (Person)---($firstName: string) + * \ + * ($address: Address)---($street: string) + * ^ * * The validator is stopped at the property $street. The root still * points to the Person instance, but the property path is now @@ -128,19 +120,14 @@ public function addViolationAt($subPath, $message, array $parameters = array(), * argument which is appended to the current property path when a violation * is created. For example, take the following object graph: * - *
-     * (Person)---($address: Address)---($phoneNumber: PhoneNumber)
-     *                     ^
-     * 
+ * (Person)---($address: Address)---($phoneNumber: PhoneNumber) * * When the execution context stops at the Person instance, the * property path is "address". When you validate the PhoneNumber * instance now, pass "phoneNumber" as sub path to correct the property path * to "address.phoneNumber": * - *
-     * $context->validate($address->phoneNumber, 'phoneNumber');
-     * 
+ * $context->validate($address->phoneNumber, 'phoneNumber'); * * Any violations generated during the validation will be added to the * violation list that you can access with {@link getViolations}. @@ -167,19 +154,14 @@ public function validate($value, $subPath = '', $groups = null, $traverse = fals * Use the parameter $subPath to adapt the property path for the * validated value. For example, take the following object graph: * - *
-     * (Person)---($address: Address)---($street: string)
-     *                     ^
-     * 
+ * (Person)---($address: Address)---($street: string) * * When the validator validates the Address instance, the * property path stored in the execution context is "address". When you * manually validate the property $street now, pass the sub path * "street" to adapt the full property path to "address.street": * - *
-     * $context->validate($address->street, new NotNull(), 'street');
-     * 
+ * $context->validate($address->street, new NotNull(), 'street'); * * @param mixed $value The value to validate * @param Constraint|Constraint[] $constraints The constraint(s) to validate against @@ -290,9 +272,7 @@ public function getPropertyName(); * * For example, take the following object graph: * - *
-     * (Person)---($address: Address)---($street: string)
-     * 
+ * (Person)---($address: Address)---($street: string) * * When the Person instance is passed to the validator, the * property path is initially empty. When the $address property diff --git a/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php b/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php index 62e8a5ed0d4f7..5894397da4deb 100644 --- a/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php +++ b/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Validator; +use Symfony\Component\Validator\Constraints\GroupSequence; + /** * Defines the interface for a group sequence provider. */ @@ -20,7 +22,7 @@ interface GroupSequenceProviderInterface * Returns which validation groups should be used for a certain state * of the object. * - * @return array An array of validation groups + * @return string[]|GroupSequence An array of validation groups */ public function getGroupSequence(); } diff --git a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php index 694a102859ccf..c3a6544ed47eb 100644 --- a/src/Symfony/Component/Validator/Mapping/ClassMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/ClassMetadata.php @@ -222,17 +222,11 @@ public function getDefaultGroup() public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Valid) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint "%s" cannot be put on classes.', \get_class($constraint))); } if ($constraint instanceof Traverse) { @@ -491,7 +485,7 @@ public function getConstrainedProperties() /** * Sets the default group sequence for this class. * - * @param array $groupSequence An array of group names + * @param string[]|GroupSequence $groupSequence An array of group names * * @return $this * diff --git a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php index fce49d2373fc9..2e4330fcf623b 100644 --- a/src/Symfony/Component/Validator/Mapping/GenericMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/GenericMetadata.php @@ -127,11 +127,7 @@ public function __clone() public function addConstraint(Constraint $constraint) { if ($constraint instanceof Traverse) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" can only be put on classes. Please use '. - '"Symfony\Component\Validator\Constraints\Valid" instead.', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint "%s" can only be put on classes. Please use "Symfony\Component\Validator\Constraints\Valid" instead.', \get_class($constraint))); } if ($constraint instanceof Valid) { diff --git a/src/Symfony/Component/Validator/Mapping/MemberMetadata.php b/src/Symfony/Component/Validator/Mapping/MemberMetadata.php index 8184f3f889801..565f2f4d40744 100644 --- a/src/Symfony/Component/Validator/Mapping/MemberMetadata.php +++ b/src/Symfony/Component/Validator/Mapping/MemberMetadata.php @@ -89,10 +89,7 @@ public function accept(ValidationVisitorInterface $visitor, $value, $group, $pro public function addConstraint(Constraint $constraint) { if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint %s cannot be put on properties or getters', - \get_class($constraint) - )); + throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', \get_class($constraint))); } parent::addConstraint($constraint); diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf index a9d6b0812bf9d..0c61d15715b50 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.ja.xlf @@ -318,6 +318,14 @@ Error エラー + + This is not a valid UUID. + 有効なUUIDではありません。 + + + This value should be a multiple of {{ compared_value }}. + {{ compared_value }}の倍数でなければなりません。 + diff --git a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php index add06817d0e81..6e2199ce02a14 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php @@ -455,11 +455,17 @@ public function uploadedFileErrorProvider() '{{ suffix }}' => 'bytes', ), '1'); + // access FileValidator::factorizeSizes() private method to format max file size + $reflection = new \ReflectionClass(\get_class(new FileValidator())); + $method = $reflection->getMethod('factorizeSizes'); + $method->setAccessible(true); + list($sizeAsString, $limit, $suffix) = $method->invokeArgs(new FileValidator(), array(0, UploadedFile::getMaxFilesize(), false)); + // it correctly parses the maxSize option and not only uses simple string comparison // 1000M should be bigger than the ini value $tests[] = array(UPLOAD_ERR_INI_SIZE, 'uploadIniSizeErrorMessage', array( - '{{ limit }}' => UploadedFile::getMaxFilesize() / 1048576, - '{{ suffix }}' => 'MiB', + '{{ limit }}' => $limit, + '{{ suffix }}' => $suffix, ), '1000M'); // it correctly parses the maxSize option and not only uses simple string comparison diff --git a/src/Symfony/Component/Validator/Validator.php b/src/Symfony/Component/Validator/Validator.php index 67d5cc32cc681..c151d92e3a4a4 100644 --- a/src/Symfony/Component/Validator/Validator.php +++ b/src/Symfony/Component/Validator/Validator.php @@ -34,13 +34,8 @@ class Validator implements ValidatorInterface, Mapping\Factory\MetadataFactoryIn private $translationDomain; private $objectInitializers; - public function __construct( - MetadataFactoryInterface $metadataFactory, - ConstraintValidatorFactoryInterface $validatorFactory, - TranslatorInterface $translator, - $translationDomain = 'validators', - array $objectInitializers = array() - ) { + public function __construct(MetadataFactoryInterface $metadataFactory, ConstraintValidatorFactoryInterface $validatorFactory, TranslatorInterface $translator, $translationDomain = 'validators', array $objectInitializers = array()) + { $this->metadataFactory = $metadataFactory; $this->validatorFactory = $validatorFactory; $this->translator = $translator; @@ -175,12 +170,7 @@ public function validateValue($value, $constraints, $groups = null) // // * Otherwise the validated group is propagated. - throw new ValidatorException( - sprintf( - 'The constraint %s cannot be validated. Use the method validate() instead.', - \get_class($constraint) - ) - ); + throw new ValidatorException(sprintf('The constraint %s cannot be validated. Use the method validate() instead.', \get_class($constraint))); } $context->validateValue($value, $constraint, '', $groups); diff --git a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php index 1cc96c834e6f6..c8b545b54b4a6 100644 --- a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\ConstraintViolationListInterface; /** @@ -39,12 +40,9 @@ public function atPath($path); * If no constraint is passed, the constraint * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ @@ -54,10 +52,9 @@ public function validate($value, $constraints = null, $groups = null); * Validates a property of an object against the constraints specified * for this property. * - * @param object $object The object - * @param string $propertyName The name of the validated property - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object $object The object + * @param string $propertyName The name of the validated property + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ @@ -67,12 +64,10 @@ public function validateProperty($object, $propertyName, $groups = null); * Validates a value against the constraints specified for an object's * property. * - * @param object|string $objectOrClass The object or its class name - * @param string $propertyName The name of the property - * @param mixed $value The value to validate against the - * property's constraints - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the property's constraints + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ diff --git a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index 3e46cd2f000a9..14456d8c9114c 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -162,11 +162,7 @@ public function validate($value, $constraints = null, $groups = null) return $this; } - throw new RuntimeException(sprintf( - 'Cannot validate values of type "%s" automatically. Please '. - 'provide a constraint.', - \gettype($value) - )); + throw new RuntimeException(sprintf('Cannot validate values of type "%s" automatically. Please provide a constraint.', \gettype($value))); } /** @@ -179,12 +175,7 @@ public function validateProperty($object, $propertyName, $groups = null) if (!$classMetadata instanceof ClassMetadataInterface) { // Cannot be UnsupportedMetadataException because of BC with // Symfony < 2.5 - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata) - )); + throw new ValidatorException(sprintf('The metadata factory should return instances of "\Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); @@ -230,12 +221,7 @@ public function validatePropertyValue($objectOrClass, $propertyName, $value, $gr if (!$classMetadata instanceof ClassMetadataInterface) { // Cannot be UnsupportedMetadataException because of BC with // Symfony < 2.5 - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata) - )); + throw new ValidatorException(sprintf('The metadata factory should return instances of "\Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); @@ -289,9 +275,9 @@ public function getViolations() /** * Normalizes the given group or list of groups to an array. * - * @param mixed $groups The groups to normalize + * @param string|GroupSequence|(string|GroupSequence)[] $groups The groups to normalize * - * @return array A group array + * @return (string|GroupSequence)[] A group array */ protected function normalizeGroups($groups) { @@ -312,7 +298,7 @@ protected function normalizeGroups($groups) * * @param object $object The object to cascade * @param string $propertyPath The current property path - * @param string[] $groups The validated groups + * @param (string|GroupSequence)[] $groups The validated groups * @param int $traversalStrategy The strategy for traversing the * cascaded object * @param ExecutionContextInterface $context The current execution context @@ -331,12 +317,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa $classMetadata = $this->metadataFactory->getMetadataFor($object); if (!$classMetadata instanceof ClassMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The metadata factory should return instances of '. - '"Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata) - )); + throw new UnsupportedMetadataException(sprintf('The metadata factory should return instances of "Symfony\Component\Validator\Mapping\ClassMetadataInterface", got: "%s".', \is_object($classMetadata) ? \get_class($classMetadata) : \gettype($classMetadata))); } $this->validateClassNode( @@ -380,7 +361,7 @@ private function validateObject($object, $propertyPath, array $groups, $traversa * * @param iterable $collection The collection * @param string $propertyPath The current property path - * @param string[] $groups The validated groups + * @param (string|GroupSequence)[] $groups The validated groups * @param bool $stopRecursion Whether to disable * recursive iteration. For * backwards compatibility @@ -460,7 +441,7 @@ private function validateEachObjectIn($collection, $propertyPath, array $groups, * the object * @param string $propertyPath The property path leading * to the object - * @param string[] $groups The groups in which the + * @param (string|GroupSequence)[] $groups The groups in which the * object should be validated * @param string[]|null $cascadedGroups The groups in which * cascaded objects should @@ -572,12 +553,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m // returns two metadata objects, not just one foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { if (!$propertyMetadata instanceof PropertyMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The property metadata instances should implement '. - '"Symfony\Component\Validator\Mapping\PropertyMetadataInterface", '. - 'got: "%s".', - \is_object($propertyMetadata) ? \get_class($propertyMetadata) : \gettype($propertyMetadata) - )); + throw new UnsupportedMetadataException(sprintf('The property metadata instances should implement "Symfony\Component\Validator\Mapping\PropertyMetadataInterface", got: "%s".', \is_object($propertyMetadata) ? \get_class($propertyMetadata) : \gettype($propertyMetadata))); } $propertyValue = $propertyMetadata->getPropertyValue($object); @@ -618,11 +594,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m if (!$object instanceof \Traversable) { // Must throw a ConstraintDefinitionException for backwards // compatibility reasons with Symfony < 2.5 - throw new ConstraintDefinitionException(sprintf( - 'Traversal was enabled for "%s", but this class '. - 'does not implement "\Traversable".', - \get_class($object) - )); + throw new ConstraintDefinitionException(sprintf('Traversal was enabled for "%s", but this class does not implement "\Traversable".', \get_class($object))); } $this->validateEachObjectIn( @@ -658,7 +630,7 @@ private function validateClassNode($object, $cacheKey, ClassMetadataInterface $m * value * @param string $propertyPath The property path leading * to the value - * @param string[] $groups The groups in which the + * @param (string|GroupSequence)[] $groups The groups in which the * value should be validated * @param string[]|null $cascadedGroups The groups in which * cascaded objects should diff --git a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php index 5bac2e88987f6..78157465ab5ce 100644 --- a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Validator; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; @@ -29,12 +30,9 @@ interface ValidatorInterface extends MetadataFactoryInterface * If no constraint is passed, the constraint * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * - * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate - * against - * @param array|null $groups The validation groups to - * validate. If none is given, - * "Default" is assumed + * @param mixed $value The value to validate + * @param Constraint|Constraint[] $constraints The constraint(s) to validate against + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return ConstraintViolationListInterface A list of constraint violations * If the list is empty, validation @@ -46,10 +44,9 @@ public function validate($value, $constraints = null, $groups = null); * Validates a property of an object against the constraints specified * for this property. * - * @param object $object The object - * @param string $propertyName The name of the validated property - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object $object The object + * @param string $propertyName The name of the validated property + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return ConstraintViolationListInterface A list of constraint violations * If the list is empty, validation @@ -61,12 +58,10 @@ public function validateProperty($object, $propertyName, $groups = null); * Validates a value against the constraints specified for an object's * property. * - * @param object|string $objectOrClass The object or its class name - * @param string $propertyName The name of the property - * @param mixed $value The value to validate against the - * property's constraints - * @param array|null $groups The validation groups to validate. If - * none is given, "Default" is assumed + * @param object|string $objectOrClass The object or its class name + * @param string $propertyName The name of the property + * @param mixed $value The value to validate against the property's constraints + * @param string|GroupSequence|(string|GroupSequence)[]|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return ConstraintViolationListInterface A list of constraint violations * If the list is empty, validation diff --git a/src/Symfony/Component/Yaml/Yaml.php b/src/Symfony/Component/Yaml/Yaml.php index 595fbef07f889..3f93cba9ef55f 100644 --- a/src/Symfony/Component/Yaml/Yaml.php +++ b/src/Symfony/Component/Yaml/Yaml.php @@ -23,11 +23,10 @@ class Yaml /** * Parses YAML into a PHP value. * - * Usage: - * - * $array = Yaml::parse(file_get_contents('config.yml')); - * print_r($array); - * + * Usage: + * + * $array = Yaml::parse(file_get_contents('config.yml')); + * print_r($array); * * As this method accepts both plain strings and file names as an input, * you must validate the input before calling this method. Passing a file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy