diff --git a/.travis.yml b/.travis.yml
index 0e626582b9e79..423d9260b6a9b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -51,6 +51,7 @@ before_install:
# A sigchild-enabled-PHP is used to test the Process component on the lowest PHP matrix line
- if [[ ! $deps && $PHP = ${MIN_PHP%.*} && ! -d php-$MIN_PHP/sapi ]]; then wget http://museum.php.net/php5/php-$MIN_PHP.tar.bz2 -O - | tar -xj; (cd php-$MIN_PHP; ./configure --enable-sigchild --enable-pcntl; make -j2); fi
- if [[ ! $PHP = hhvm* ]]; then INI_FILE=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; else INI_FILE=/etc/hhvm/php.ini; fi
+ - if [[ ! $skip ]]; then echo date.timezone = Europe/Paris >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo memory_limit = -1 >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo session.gc_probability = 0 >> $INI_FILE; fi
- if [[ ! $skip ]]; then echo opcache.enable_cli = 1 >> $INI_FILE; fi
diff --git a/CHANGELOG-3.1.md b/CHANGELOG-3.1.md
index 07d0350ddfada..228cbff557b8e 100644
--- a/CHANGELOG-3.1.md
+++ b/CHANGELOG-3.1.md
@@ -7,6 +7,33 @@ in 3.1 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/v3.1.0...v3.1.1
+* 3.1.7 (2016-11-21)
+
+ * bug #20550 [YAML] Fix processing timestamp strings with timezone (myesain)
+ * bug #20543 [DI] Fix error when trying to resolve a DefinitionDecorator (nicolas-grekas)
+ * bug #20544 [PhpUnitBridge] Fix time-sensitive tests that use data providers (julienfalque)
+ * bug #20484 bumped min version of Twig to 1.28 (fabpot)
+ * bug #20519 [Debug] Remove GLOBALS from exception context to avoid endless recursion (Seldaek)
+ * bug #20455 [ClassLoader] Fix ClassCollectionLoader inlining with __halt_compiler (giosh94mhz)
+ * bug #20307 [Form] Fix Date\TimeType marked as invalid on request with single_text and zero seconds (LuisDeimos)
+ * bug #20480 [FrameworkBundle] Register the ArrayDenormalizer (dunglas)
+ * bug #20286 [Serializer] Fix DataUriNormalizer's regex (dunglas)
+ * bug #20466 [Translation] fixed nested fallback catalogue using multiple locales. (aitboudad)
+ * bug #20465 [#18637][TranslationDebug] workaround for getFallbackLocales. (aitboudad)
+ * bug #20453 [Cache] Make directory hashing case insensitive (nicolas-grekas)
+ * bug #20440 [TwigBridge][TwigBundle][HttpKernel] prefer getSourceContext() over getSource() (xabbuh)
+ * bug #20287 Properly format value in UniqueEntityValidator (alcaeus)
+ * bug #20422 [Translation][fallback] add missing resources in parent catalogues. (aitboudad)
+ * bug #20378 [Form] Fixed show float values as choice value in ChoiceType (yceruto)
+ * bug #20294 Improved the design of the metrics in the profiler (javiereguiluz)
+ * bug #20375 [HttpFoundation][Session] Fix memcache session handler (klandaika)
+ * bug #20377 [Console] Fix infinite loop on missing input (chalasr)
+ * bug #20372 [Console] simplified code (fabpot)
+ * bug #20342 [Form] Fix UrlType transforms valid protocols (ogizanagi)
+ * bug #20292 Enhance GAE compat by removing some realpath() (nicolas-grekas)
+ * bug #20326 [VarDumper] Fix dumping Twig source in stack traces (nicolas-grekas)
+ * bug #20321 Compatibility with Twig 1.27 (xkobal)
+
* 3.1.6 (2016-10-27)
* bug #20291 [Yaml] Fix 7.1 compat (nicolas-grekas)
diff --git a/CHANGELOG-3.2.md b/CHANGELOG-3.2.md
index 80a81116bae33..b2de770775c93 100644
--- a/CHANGELOG-3.2.md
+++ b/CHANGELOG-3.2.md
@@ -7,9 +7,32 @@ in 3.2 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/v3.2.0...v3.2.1
-* 3.2.0-RC1 (2016-11-17)
+* 3.2.0-RC2 (2016-11-27)
- *
+ * bug #20601 [FrameworkBundle] Don't rely on any parent definition for "cache.annotations" (nicolas-grekas)
+ * bug #20638 Fix legacy tests that do not trigger any depreciation (julienfalque)
+ * bug #20374 [FrameworkBundle] Improve performance of ControllerNameParser (enumag)
+ * bug #20474 [Routing] Fail properly when a route parameter name cannot be used as a PCRE subpattern name (fancyweb)
+ * bug #20616 [Bridge/Doctrine] Use cache.prefix.seed parameter for generating cache namespace (nicolas-grekas)
+ * bug #20566 [DI] Initialize properties before method calls (ro0NL)
+ * bug #20583 [Workflow] Fixed graphviz dumper for state machine (lyrixx)
+ * bug #20621 [HttpKernel] Fix exception when serializing request attributes (nicolas-grekas)
+ * bug #20609 [DI] Fixed custom services definition BC break introduced in ec7e70fb… (kiler129)
+ * bug #20598 [DI] Aliases should preserve the aliased invalid behavior (nicolas-grekas)
+ * bug #20600 [Process] Fix process continuing after reached timeout using getIterator() (chalasr)
+ * bug #20603 [HttpKernel] Deprecate checking for cacheable HTTP methods in Request::isMethodSafe() (nicolas-grekas)
+ * bug #20602 [HttpKernel] Revert BC breaking change of Request::isMethodSafe() (nicolas-grekas)
+ * bug #20610 [FrameworkBundle] Add framework.cache.prefix_seed for predictible cache key prefixes (nicolas-grekas)
+ * bug #20595 [WebProfilerBundle] Fix deprecated uses of profiler_dump (nicolas-grekas)
+ * bug #20589 [SecurityBundle] Fix FirewallConfig nullable arguments (ogizanagi)
+ * bug #20590 [DI] Allow null as default env value (sroze)
+ * bug #20499 [Doctrine][Form] support large integers (xabbuh)
+ * bug #20559 [FrameworkBundle] Avoid warming up the validator cache for non-existent class (Seldaek)
+ * bug #20576 [Process] Do feat test before enabling TTY mode (nicolas-grekas)
+ * bug #20577 [FrameworkBundle] Mark cache.default_*_provider services private (nicolas-grekas)
+ * bug #20550 [YAML] Fix processing timestamp strings with timezone (myesain)
+ * bug #20543 [DI] Fix error when trying to resolve a DefinitionDecorator (nicolas-grekas)
+ * bug #20544 [PhpUnitBridge] Fix time-sensitive tests that use data providers (julienfalque)
* 3.2.0-RC1 (2016-11-17)
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 41c883159c8e2..c5fb26e0e91d8 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -22,16 +22,16 @@ Symfony is the result of the work of many people who made the code better
- Abdellatif Ait boudad (aitboudad)
- Pascal Borreli (pborreli)
- Wouter De Jong (wouterj)
- - Joseph Bielawski (stloyd)
- Romain Neutron (romain)
+ - Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Lukas Kahwe Smith (lsmith)
- Martin Hasoň (hason)
- Jeremy Mikola (jmikola)
- Jean-François Simon (jfsimon)
+ - Grégoire Pineau (lyrixx)
- Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw)
- - Grégoire Pineau (lyrixx)
- Eriksen Costa (eriksencosta)
- Jules Pietri (heah)
- Sarah Khalil (saro0h)
@@ -45,11 +45,11 @@ Symfony is the result of the work of many people who made the code better
- stealth35 (stealth35)
- Alexander Mols (asm89)
- Bulat Shakirzyanov (avalanche123)
+ - Robin Chalas (chalas_r)
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
- Miha Vrhovnik
- Diego Saint Esteben (dii3g0)
- - Robin Chalas (chalas_r)
- Ener-Getick (energetick)
- Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
@@ -84,19 +84,19 @@ 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)
+ - Roland Franssen (ro0)
+ - Dariusz Ruminski
- Jáchym Toušek (enumag)
- Arnaud Le Blanc (arnaud-lb)
- Jérôme Tamarelle (gromnan)
- Michal Piotrowski (eventhorizon)
- Tim Nagel (merk)
- - Dariusz Ruminski
- Brice BERNARD (brikou)
- Alexander M. Turek (derrabus)
- marc.weistroff
- Issei Murasawa (issei_m)
- lenar
- Włodzimierz Gajda (gajdaw)
- - Roland Franssen (ro0)
- Baptiste Clavié (talus)
- Alexander Schwenn (xelaris)
- Florian Voutzinos (florianv)
@@ -132,6 +132,7 @@ Symfony is the result of the work of many people who made the code better
- Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
- jwdeitch
+ - Tobias Nyholm (tobias)
- Joel Wurtz (brouznouf)
- Philipp Wahala (hifi)
- Vyacheslav Pavlov
@@ -145,12 +146,14 @@ Symfony is the result of the work of many people who made the code better
- Clemens Tolboom
- Helmer Aaviksoo
- Hiromi Hishida (77web)
+ - Yonel Ceruto González (yonelceruto)
- Richard van Laak (rvanlaak)
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram)
- Artur Kotyrba
+ - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent)
- Warnar Boekkooi (boekkooi)
- Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator)
@@ -160,13 +163,12 @@ Symfony is the result of the work of many people who made the code better
- Richard Miller (mr_r_miller)
- Mario A. Alvarez Garcia (nomack84)
- Dennis Benkert (denderello)
- - jeremyFreeAgent (Jérémy Romey) (jeremyfreeagent)
- Benjamin Dulau (dbenjamin)
- Mathieu Lemoine (lemoinem)
- Andreas Hucks (meandmymonkey)
- Noel Guilbert (noel)
- Lars Strojny (lstrojny)
- - Yonel Ceruto González (yonelceruto)
+ - Maxime STEINHAUSSER
- Stepan Anchugov (kix)
- bronze1man
- sun (sun)
@@ -236,7 +238,6 @@ Symfony is the result of the work of many people who made the code better
- Grégoire Paris (greg0ire)
- Leo Feyer
- Chekote
- - Tobias Nyholm (tobias)
- Thomas Adam
- Albert Casademont (acasademont)
- Jhonny Lidfors (jhonne)
@@ -245,6 +246,7 @@ Symfony is the result of the work of many people who made the code better
- Nikita Konstantinov
- Wodor Wodorski
- Thomas Lallement (raziel057)
+ - Giorgio Premi
- Matthieu Napoli (mnapoli)
- Beau Simensen (simensen)
- Michael Hirschler (mvhirsch)
@@ -295,7 +297,6 @@ Symfony is the result of the work of many people who made the code better
- Mark Challoner (markchalloner)
- Gregor Harlan (gharlan)
- Gennady Telegin (gtelegin)
- - Giorgio Premi
- Ben Davies (bendavies)
- Erin Millard
- Artur Melo (restless)
@@ -393,7 +394,6 @@ Symfony is the result of the work of many people who made the code better
- Christian Schmidt
- Marcin Sikoń (marphi)
- Dominik Zogg (dominik.zogg)
- - Maxime STEINHAUSSER
- Marek Pietrzak
- Chad Sikorra (chadsikorra)
- franek (franek)
@@ -439,6 +439,7 @@ Symfony is the result of the work of many people who made the code better
- Vicent Soria Durá (vicentgodella)
- Nicolas Dewez (nicolas_dewez)
- Anthony Ferrara
+ - Victor Bocharsky (bocharsky_bw)
- Ioan Negulescu
- Jakub Škvára (jskvara)
- Andrew Udvare (audvare)
@@ -611,7 +612,6 @@ Symfony is the result of the work of many people who made the code better
- Andrew Tchircoff (andrewtch)
- michaelwilliams
- 1emming
- - Victor Bocharsky (bocharsky_bw)
- Leevi Graham (leevigraham)
- Jordan Deitch
- Casper Valdemar Poulsen
@@ -769,6 +769,7 @@ Symfony is the result of the work of many people who made the code better
- fabios
- Sander Coolen (scoolen)
- Nicolas Le Goff (nlegoff)
+ - Andreas Braun
- Ben Oman
- Manuele Menozzi
- Anton Babenko (antonbabenko)
@@ -858,6 +859,7 @@ Symfony is the result of the work of many people who made the code better
- rpg600
- Péter Buri (burci)
- Davide Borsatto (davide.borsatto)
+ - Indra Gunawan (guind)
- kaiwa
- Charles Sanquer (csanquer)
- Albert Ganiev (helios-ag)
@@ -969,6 +971,7 @@ Symfony is the result of the work of many people who made the code better
- Sandro Hopf
- Łukasz Makuch
- George Giannoulopoulos
+ - Luis Ramirez (luisdeimos)
- Daniel Richter (richtermeister)
- ChrisC
- Ilya Biryukov
@@ -985,6 +988,7 @@ Symfony is the result of the work of many people who made the code better
- Pete Mitchell (peterjmit)
- Tom Corrigan (tomcorrigan)
- Martin Pärtel
+ - Noah Heck (myesain)
- Patrick Daley (padrig)
- Xavier Briand (xavierbriand)
- Max Summe
@@ -1041,6 +1045,7 @@ Symfony is the result of the work of many people who made the code better
- Sebastian Ionescu
- Thomas Ploch
- Simon Neidhold
+ - Xavier HAUSHERR
- Valentin VALCIU
- Kevin Dew
- James Cowgill
@@ -1163,6 +1168,7 @@ Symfony is the result of the work of many people who made the code better
- Koalabaerchen
- michalmarcinkowski
- Warwick
+ - VJ
- Chris
- JakeFr
- Simon Sargeant
@@ -1236,6 +1242,7 @@ Symfony is the result of the work of many people who made the code better
- Joel Marcey
- David Christmann
- root
+ - Wouter J
- James Hudson
- Tom Maguire
- David Zuelke
@@ -1312,6 +1319,7 @@ Symfony is the result of the work of many people who made the code better
- Jelle Bekker (jbekker)
- Ian Jenkins (jenkoian)
- Jorge Martin (jorgemartind)
+ - Julien Falque (julienfalque)
- Kevin Herrera (kherge)
- Luis Ramón López López (lrlopez)
- Muriel (metalmumu)
@@ -1379,6 +1387,7 @@ Symfony is the result of the work of many people who made the code better
- Jörg Rühl
- wesleyh
- sergey
+ - Karim Miladi
- Michael Genereux
- patrick-mcdougle
- Dariusz Czech
@@ -1559,6 +1568,7 @@ Symfony is the result of the work of many people who made the code better
- Sergey Fedotov
- Michael
- fh-github@fholzhauer.de
+ - Jan Emrich
- Mark Topper
- Xavier REN
- Zander Baldwin
diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md
index a93cfbf2f09e2..866bd981cce79 100644
--- a/UPGRADE-3.0.md
+++ b/UPGRADE-3.0.md
@@ -253,6 +253,9 @@ UPGRADE FROM 2.x to 3.0
closures, but the closure is now resolved in the type instead of in the
loader.
+ * Using the entity provider with a Doctrine repository implementing `UserProviderInterface` is not supported anymore.
+ You should make the repository implement `UserLoaderInterface` instead.
+
### EventDispatcher
* The method `getListenerPriority($eventName, $listener)` has been added to the
diff --git a/appveyor.yml b/appveyor.yml
index 4f7133a0df779..63f7319e191ee 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -29,7 +29,7 @@ install:
- cd ..
- copy /Y php.ini-development php.ini-min
- echo max_execution_time=1200 >> php.ini-min
- - echo date.timezone="UTC" >> php.ini-min
+ - echo date.timezone="America/Los_Angeles" >> php.ini-min
- echo extension_dir=ext >> php.ini-min
- copy /Y php.ini-min php.ini-max
- echo zend_extension=php_opcache.dll >> php.ini-max
diff --git a/src/Symfony/Bridge/Doctrine/CHANGELOG.md b/src/Symfony/Bridge/Doctrine/CHANGELOG.md
index f187e970f98fe..3dcb8770ec8cc 100644
--- a/src/Symfony/Bridge/Doctrine/CHANGELOG.md
+++ b/src/Symfony/Bridge/Doctrine/CHANGELOG.md
@@ -18,6 +18,12 @@ CHANGELOG
* removed passing a query builder closure to `ORMQueryBuilderLoader`
* removed `loader` and `property` options of the `DoctrineType`
+2.8.0
+-----
+
+ * deprecated using the entity provider with a Doctrine repository implementing UserProviderInterface
+ * added UserLoaderInterface for loading users through Doctrine.
+
2.7.0
-----
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
index 3a6a877e1fc4e..b9cac9f71845a 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
@@ -384,9 +384,14 @@ protected function loadCacheDriver($cacheName, $objectManagerName, array $cacheD
if (!isset($cacheDriver['namespace'])) {
// generate a unique namespace for the given application
- $env = $container->getParameter('kernel.root_dir').$container->getParameter('kernel.environment');
- $hash = hash('sha256', $env);
- $namespace = 'sf2'.$this->getMappingResourceExtension().'_'.$objectManagerName.'_'.$hash;
+ if ($container->hasParameter('cache.prefix.seed')) {
+ $seed = '.'.$container->getParameterBag()->resolveValue($container->getParameter('cache.prefix.seed'));
+ } else {
+ $seed = '_'.$container->getParameter('kernel.root_dir');
+ }
+ $seed .= '.'.$container->getParameter('kernel.name').'.'.$container->getParameter('kernel.environment').'.'.$container->getParameter('kernel.debug');
+ $hash = hash('sha256', $seed);
+ $namespace = 'sf_'.$this->getMappingResourceExtension().'_'.$objectManagerName.'_'.$hash;
$cacheDriver['namespace'] = $namespace;
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
index 9531b892f2465..6501f8393e994 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
@@ -70,7 +70,7 @@ public function getEntitiesByIds($identifier, array $values)
// Filter out non-integer values (e.g. ""). If we don't, some
// databases such as PostgreSQL fail.
$values = array_values(array_filter($values, function ($v) {
- return (string) $v === (string) (int) $v;
+ return (string) $v === (string) (int) $v || ctype_digit($v);
}));
} elseif ('guid' === $metadata->getTypeOfField($identifier)) {
$parameterType = Connection::PARAM_STR_ARRAY;
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
index 4bfb789c97cdf..a14b786b8d737 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
@@ -67,7 +67,7 @@ public function testFilterNonIntegerValues()
$query->expects($this->once())
->method('setParameter')
- ->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3), Connection::PARAM_INT_ARRAY)
+ ->with('ORMQueryBuilderLoader_getEntitiesByIds_id', array(1, 2, 3, '9223372036854775808'), Connection::PARAM_INT_ARRAY)
->willReturn($query);
$qb = $this->getMockBuilder('Doctrine\ORM\QueryBuilder')
@@ -83,7 +83,7 @@ public function testFilterNonIntegerValues()
->from('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity', 'e');
$loader = new ORMQueryBuilderLoader($qb);
- $loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo'));
+ $loader->getEntitiesByIds('id', array(1, '', 2, 3, 'foo', '9223372036854775808'));
}
public function testEmbeddedIdentifierName()
diff --git a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php
index a8977312bdae7..0d873732636a9 100644
--- a/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php
+++ b/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php
@@ -25,8 +25,8 @@ class SymfonyTestsListener extends \PHPUnit_Framework_BaseTestListener
private $skippedFile = false;
private $wasSkipped = array();
private $isSkipped = array();
- private $expectedDeprecations;
- private $gatheredDeprecations;
+ private $expectedDeprecations = array();
+ private $gatheredDeprecations = array();
private $previousErrorHandler;
/**
@@ -181,7 +181,8 @@ public function endTest(\PHPUnit_Framework_Test $test, $time)
$test->getTestResultObject()->addFailure($test, $e, $time);
}
- $this->expectedDeprecations = $this->gatheredDeprecations = $this->previousErrorHandler = null;
+ $this->expectedDeprecations = $this->gatheredDeprecations = array();
+ $this->previousErrorHandler = null;
}
if (-2 < $this->state && $test instanceof \PHPUnit_Framework_TestCase) {
$groups = \PHPUnit_Util_Test::getGroups(get_class($test), $test->getName(false));
diff --git a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php
index 2e1c86e508998..ce5104dc41cc5 100644
--- a/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php
+++ b/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/ValidatorCacheWarmer.php
@@ -68,7 +68,9 @@ public function warmUp($cacheDir)
foreach ($this->extractSupportedLoaders($loaders) as $loader) {
foreach ($loader->getMappedClasses() as $mappedClass) {
- $metadataFactory->getMetadataFor($mappedClass);
+ if ($metadataFactory->hasMetadataFor($mappedClass)) {
+ $metadataFactory->getMetadataFor($mappedClass);
+ }
}
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
index 39f7ac2f541c3..22811c6558894 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/ConfigDebugCommand.php
@@ -47,6 +47,10 @@ protected function configure()
+ *
+ * @internal
*/
trait FilesystemAdapterTrait
{
diff --git a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
index 4bc80ee30022e..c3cbd3bef7e54 100644
--- a/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
+++ b/src/Symfony/Component/Cache/Tests/Adapter/AdapterTestCase.php
@@ -28,8 +28,6 @@ public function testDefaultLifeTime()
{
if (isset($this->skippedTests[__FUNCTION__])) {
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
-
- return;
}
$cache = $this->createCachePool(2);
@@ -51,8 +49,6 @@ public function testNotUnserializable()
{
if (isset($this->skippedTests[__FUNCTION__])) {
$this->markTestSkipped($this->skippedTests[__FUNCTION__]);
-
- return;
}
$cache = $this->createCachePool();
diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
index ae81fe36fdef6..58a38048f7530 100644
--- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php
@@ -424,7 +424,7 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV
}
if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) {
- return $this->get($this->aliasDefinitions[$id]);
+ return $this->get($this->aliasDefinitions[$id], $invalidBehavior);
}
try {
@@ -835,6 +835,10 @@ public function findDefinition($id)
*/
private function createService(Definition $definition, $id, $tryProxy = true)
{
+ if ($definition instanceof DefinitionDecorator) {
+ throw new RuntimeException(sprintf('Constructing service "%s" from a parent definition is not supported at build time.', $id));
+ }
+
if ($definition->isSynthetic()) {
throw new RuntimeException(sprintf('You have requested a synthetic service ("%s"). The DIC does not know how to construct this service.', $id));
}
@@ -897,15 +901,15 @@ private function createService(Definition $definition, $id, $tryProxy = true)
$this->shareService($definition, $service, $id);
}
- foreach ($definition->getMethodCalls() as $call) {
- $this->callMethod($service, $call);
- }
-
$properties = $this->resolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getProperties())));
foreach ($properties as $name => $value) {
$service->$name = $value;
}
+ foreach ($definition->getMethodCalls() as $call) {
+ $this->callMethod($service, $call);
+ }
+
if ($callable = $definition->getConfigurator()) {
if (is_array($callable)) {
$callable[0] = $parameterBag->resolveValue($callable[0]);
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 58666ef9478cc..46878eb7af51c 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -347,8 +347,8 @@ private function addServiceInlinedDefinitions($id, $definition)
$code .= $this->addNewInstance($sDefinition, '$'.$name, ' = ', $id);
if (!$this->hasReference($id, $sDefinition->getMethodCalls(), true) && !$this->hasReference($id, $sDefinition->getProperties(), true)) {
- $code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
$code .= $this->addServiceProperties(null, $sDefinition, $name);
+ $code .= $this->addServiceMethodCalls(null, $sDefinition, $name);
$code .= $this->addServiceConfigurator(null, $sDefinition, $name);
}
@@ -517,8 +517,8 @@ private function addServiceInlinedDefinitionsSetup($id, Definition $definition)
}
$name = (string) $this->definitionVariables->offsetGet($iDefinition);
- $code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
$code .= $this->addServiceProperties(null, $iDefinition, $name);
+ $code .= $this->addServiceMethodCalls(null, $iDefinition, $name);
$code .= $this->addServiceConfigurator(null, $iDefinition, $name);
}
@@ -678,8 +678,8 @@ private function addService($id, Definition $definition)
$this->addServiceInlinedDefinitions($id, $definition).
$this->addServiceInstance($id, $definition).
$this->addServiceInlinedDefinitionsSetup($id, $definition).
- $this->addServiceMethodCalls($id, $definition).
$this->addServiceProperties($id, $definition).
+ $this->addServiceMethodCalls($id, $definition).
$this->addServiceConfigurator($id, $definition).
$this->addServiceReturn($id, $definition)
;
diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
index 46d2a739dc5e5..d20e53531aa3b 100644
--- a/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
+++ b/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php
@@ -41,8 +41,8 @@ public function get($name)
if ($this->has($name)) {
$defaultValue = parent::get($name);
- if (!is_scalar($defaultValue)) {
- throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar, but "%s" given to "%s".', gettype($defaultValue), $name));
+ if (null !== $defaultValue && !is_scalar($defaultValue)) {
+ throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', gettype($defaultValue), $name));
}
}
@@ -96,8 +96,8 @@ public function resolve()
}
if (is_numeric($default = $this->parameters[$name])) {
$this->parameters[$name] = (string) $default;
- } elseif (null !== $default && !is_string($default)) {
- throw new RuntimeException(sprintf('The default value of env parameter "%s" must be string or null, %s given.', $env, gettype($default)));
+ } elseif (null !== $default && !is_scalar($default)) {
+ throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, gettype($default)));
}
}
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
index a833b9baf1755..155da75fb7958 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
@@ -20,6 +20,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
@@ -27,6 +28,7 @@
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag;
use Symfony\Component\Config\Resource\FileResource;
+use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition;
use Symfony\Component\ExpressionLanguage\Expression;
class ContainerBuilderTest extends \PHPUnit_Framework_TestCase
@@ -265,6 +267,18 @@ public function testSetReplacesAlias()
$this->assertSame($foo, $builder->get('alias'), '->set() replaces an existing alias');
}
+ public function testAliasesKeepInvalidBehavior()
+ {
+ $builder = new ContainerBuilder();
+
+ $aliased = new Definition('stdClass');
+ $aliased->addMethodCall('setBar', array(new Reference('bar', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)));
+ $builder->setDefinition('aliased', $aliased);
+ $builder->setAlias('alias', 'aliased');
+
+ $this->assertEquals(new \stdClass(), $builder->get('alias'));
+ }
+
public function testAddGetCompilerPass()
{
$builder = new ContainerBuilder();
@@ -412,6 +426,28 @@ public function testResolveServices()
$this->assertEquals($builder->get('foo'), $builder->resolveServices(new Expression('service("foo")')), '->resolveServices() resolves expressions');
}
+ /**
+ * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
+ * @expectedExceptionMessage Constructing service "foo" from a parent definition is not supported at build time.
+ */
+ public function testResolveServicesWithDecoratedDefinition()
+ {
+ $builder = new ContainerBuilder();
+ $builder->setDefinition('grandpa', new Definition('stdClass'));
+ $builder->setDefinition('parent', new DefinitionDecorator('grandpa'));
+ $builder->setDefinition('foo', new DefinitionDecorator('parent'));
+
+ $builder->get('foo');
+ }
+
+ public function testResolveServicesWithCustomDefinitionClass()
+ {
+ $builder = new ContainerBuilder();
+ $builder->setDefinition('foo', new CustomDefinition('stdClass'));
+
+ $this->assertInstanceOf('stdClass', $builder->get('foo'));
+ }
+
public function testMerge()
{
$container = new ContainerBuilder(new ParameterBag(array('bar' => 'foo')));
@@ -760,6 +796,20 @@ public function testLazyLoadedService()
$this->assertTrue($classInList);
}
+ public function testInitializePropertiesBeforeMethodCalls()
+ {
+ $container = new ContainerBuilder();
+ $container->register('foo', 'stdClass');
+ $container->register('bar', 'MethodCallClass')
+ ->setProperty('simple', 'bar')
+ ->setProperty('complex', new Reference('foo'))
+ ->addMethodCall('callMe');
+
+ $container->compile();
+
+ $this->assertTrue($container->get('bar')->callPassed(), '->compile() initializes properties before method calls');
+ }
+
public function testAutowiring()
{
$container = new ContainerBuilder();
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
index f6d4cdd6ac7c7..b4197d4326db3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php
@@ -321,4 +321,23 @@ public function testInlinedDefinitionReferencingServiceContainer()
$dumper = new PhpDumper($container);
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container');
}
+
+ public function testInitializePropertiesBeforeMethodCalls()
+ {
+ require_once self::$fixturesPath.'/includes/classes.php';
+
+ $container = new ContainerBuilder();
+ $container->register('foo', 'stdClass');
+ $container->register('bar', 'MethodCallClass')
+ ->setProperty('simple', 'bar')
+ ->setProperty('complex', new Reference('foo'))
+ ->addMethodCall('callMe');
+ $container->compile();
+
+ $dumper = new PhpDumper($container);
+ eval('?>'.$dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls')));
+
+ $container = new \Symfony_DI_PhpDumper_Test_Properties_Before_Method_Calls();
+ $this->assertTrue($container->get('bar')->callPassed(), '->dump() initializes properties before method calls');
+ }
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CustomDefinition.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CustomDefinition.php
new file mode 100644
index 0000000000000..65eea2106ed70
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/CustomDefinition.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\DependencyInjection\Tests\Fixtures;
+
+use Symfony\Component\DependencyInjection\Definition;
+
+class CustomDefinition extends Definition
+{
+}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
index 70c3d275b8898..48b687c1f4e53 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php
@@ -59,3 +59,20 @@ public function __construct(BarClass $bar)
$this->bar = $bar;
}
}
+
+class MethodCallClass
+{
+ public $simple;
+ public $complex;
+ private $callPassed = false;
+
+ public function callMe()
+ {
+ $this->callPassed = is_scalar($this->simple) && is_object($this->complex);
+ }
+
+ public function callPassed()
+ {
+ return $this->callPassed;
+ }
+}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
index 7c6760d2d2b3c..306375d1b5541 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php
@@ -228,11 +228,11 @@ protected function getFooService()
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo')), true, $this);
- $instance->setBar($this->get('bar'));
- $instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo'));
+ $instance->setBar($this->get('bar'));
+ $instance->initialize();
sc_configure($instance);
return $instance;
@@ -425,8 +425,8 @@ protected function getInlinedService()
{
$this->services['inlined'] = $instance = new \Bar();
- $instance->setBaz($this->get('baz'));
$instance->pub = 'pub';
+ $instance->setBaz($this->get('baz'));
return $instance;
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
index 2ccadfe16d384..f8b263c2a01f3 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php
@@ -224,11 +224,11 @@ protected function getFooService()
$this->services['foo'] = $instance = \Bar\FooClass::getInstance('foo', $a, array('bar' => 'foo is bar', 'foobar' => 'bar'), true, $this);
- $instance->setBar($this->get('bar'));
- $instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
+ $instance->setBar($this->get('bar'));
+ $instance->initialize();
sc_configure($instance);
return $instance;
@@ -275,8 +275,8 @@ protected function getFooWithInlineService()
$this->services['foo_with_inline'] = $instance = new \Foo();
- $a->setBaz($this->get('baz'));
$a->pub = 'pub';
+ $a->setBaz($this->get('baz'));
$instance->setBar($a);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
index 7d5f95df14889..5a166d963dc67 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
@@ -131,8 +131,8 @@ public function testLoadImports()
{
$container = new ContainerBuilder();
$resolver = new LoaderResolver(array(
- new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
- new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
+ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')),
+ new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yml')),
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
));
$loader->setResolver($resolver);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
index dccce3ac2e17a..fabaa4859c578 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
@@ -104,8 +104,8 @@ public function testLoadImports()
{
$container = new ContainerBuilder();
$resolver = new LoaderResolver(array(
- new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')),
- new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')),
+ new IniFileLoader($container, new FileLocator(self::$fixturesPath.'/ini')),
+ new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')),
new PhpFileLoader($container, new FileLocator(self::$fixturesPath.'/php')),
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')),
));
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
index 1a24b3d6e2663..c898038e39402 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/EnvPlaceholderParameterBagTest.php
@@ -130,7 +130,7 @@ public function testResolveEnvAllowsNull()
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
- * @expectedExceptionMessage The default value of env parameter "ARRAY_VAR" must be string or null, array given.
+ * @expectedExceptionMessage The default value of env parameter "ARRAY_VAR" must be scalar or null, array given.
*/
public function testResolveThrowsOnBadDefaultValue()
{
@@ -139,4 +139,26 @@ public function testResolveThrowsOnBadDefaultValue()
$bag->set('env(Array_Var)', array());
$bag->resolve();
}
+
+ public function testGetEnvAllowsNull()
+ {
+ $bag = new EnvPlaceholderParameterBag();
+ $bag->set('env(NULL_VAR)', null);
+ $bag->get('env(NULL_VAR)');
+ $bag->resolve();
+
+ $this->assertNull($bag->all()['env(null_var)']);
+ }
+
+ /**
+ * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
+ * @expectedExceptionMessage The default value of an env() parameter must be scalar or null, but "array" given to "env(ARRAY_VAR)".
+ */
+ public function testGetThrowsOnBadDefaultValue()
+ {
+ $bag = new EnvPlaceholderParameterBag();
+ $bag->set('env(ARRAY_VAR)', array());
+ $bag->get('env(ARRAY_VAR)');
+ $bag->resolve();
+ }
}
diff --git a/src/Symfony/Component/DomCrawler/Crawler.php b/src/Symfony/Component/DomCrawler/Crawler.php
index ea26b4df6625d..33a15900cad5e 100644
--- a/src/Symfony/Component/DomCrawler/Crawler.php
+++ b/src/Symfony/Component/DomCrawler/Crawler.php
@@ -930,7 +930,7 @@ public static function xpathLiteral($s)
}
}
- return sprintf('concat(%s)', implode($parts, ', '));
+ return sprintf('concat(%s)', implode(', ', $parts));
}
/**
diff --git a/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php b/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
index c429417c25f80..c479daa75ee78 100644
--- a/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
+++ b/src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
@@ -155,11 +155,11 @@ public function setValue($value)
/**
* Adds a choice to the current ones.
*
- * This method should only be used internally.
- *
* @param \DOMElement $node
*
* @throws \LogicException When choice provided is not multiple nor radio
+ *
+ * @internal
*/
public function addChoice(\DOMElement $node)
{
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
index 1aeac3ad264f0..c1ec8a4139114 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
@@ -1388,7 +1388,7 @@ public function testDumpFileWithFileScheme()
$scheme = 'file://';
$filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
- $this->filesystem->dumpFile($filename, 'bar', null);
+ $this->filesystem->dumpFile($filename, 'bar');
$this->assertFileExists($filename);
$this->assertSame('bar', file_get_contents($filename));
@@ -1399,7 +1399,7 @@ public function testDumpFileWithZlibScheme()
$scheme = 'compress.zlib://';
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
- $this->filesystem->dumpFile($filename, 'bar', null);
+ $this->filesystem->dumpFile($filename, 'bar');
// Zlib stat uses file:// wrapper so remove scheme
$this->assertFileExists(str_replace($scheme, '', $filename));
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
index 3295e3d85fe8c..af6443ac84054 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
@@ -87,7 +87,7 @@ public function testTransformWithRounding($input, $output, $roundingMode)
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -109,7 +109,7 @@ public function testReverseTransformEmpty()
public function testReverseTransformWithGrouping()
{
// Since we test against "de_DE", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
index 99e4c8a574cf2..0fa2df05641a4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
@@ -19,7 +19,7 @@ class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
public function testTransform()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -47,7 +47,7 @@ public function testTransformEmpty()
public function testReverseTransform()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
index 2452796a6935f..306cd225b20f2 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
@@ -42,7 +42,7 @@ public function provideTransformations()
public function testTransform($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -68,7 +68,7 @@ public function provideTransformationsWithGrouping()
public function testTransformWithGrouping($from, $to, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -80,7 +80,7 @@ public function testTransformWithGrouping($from, $to, $locale)
public function testTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -185,7 +185,7 @@ public function transformWithRoundingProvider()
public function testTransformWithRounding($scale, $input, $output, $roundingMode)
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -197,7 +197,7 @@ public function testTransformWithRounding($scale, $input, $output, $roundingMode
public function testTransformDoesNotRoundIfNoScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -212,7 +212,7 @@ public function testTransformDoesNotRoundIfNoScale()
public function testReverseTransform($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -227,7 +227,7 @@ public function testReverseTransform($to, $from, $locale)
public function testReverseTransformWithGrouping($to, $from, $locale)
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault($locale);
@@ -242,7 +242,7 @@ public function testReverseTransformWithGrouping($to, $from, $locale)
public function testReverseTransformWithGroupingAndFixedSpaces()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
@@ -254,7 +254,7 @@ public function testReverseTransformWithGroupingAndFixedSpaces()
public function testReverseTransformWithGroupingButWithoutGroupSeparator()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -374,7 +374,7 @@ public function testReverseTransformDoesNotRoundIfNoScale()
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -394,7 +394,7 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
{
// Since we test against "de_DE", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
@@ -409,7 +409,7 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
{
// Since we test against "de_DE", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
@@ -421,7 +421,7 @@ public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGro
public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('fr');
$transformer = new NumberToLocalizedStringTransformer();
@@ -433,7 +433,7 @@ public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupin
public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('bg');
$transformer = new NumberToLocalizedStringTransformer(null, true);
@@ -585,7 +585,7 @@ public function testReverseTransformDisallowsCenteredExtraCharacters()
public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
@@ -601,7 +601,7 @@ public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
@@ -628,7 +628,7 @@ public function testReverseTransformDisallowsTrailingExtraCharacters()
public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
{
// Since we test against other locales, we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('ru');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
index 99f06741b90d7..c0447656f3e51 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
@@ -53,7 +53,7 @@ public function testTransformWithInteger()
public function testTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -92,7 +92,7 @@ public function testReverseTransformWithInteger()
public function testReverseTransformWithScale()
{
// Since we test against "de_AT", we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
index fb7c4b0bde6f8..e006e075d4c78 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
@@ -19,7 +19,7 @@ class CountryTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
index 25e7fdddb9488..cd894a52c3260 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
@@ -19,7 +19,7 @@ class CurrencyTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
index 1ee36fe0d6660..9b33db2a654ac 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -70,7 +70,7 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
public function testSubmitFromSingleTextDateTime()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -91,7 +91,7 @@ public function testSubmitFromSingleTextDateTime()
public function testSubmitFromSingleTextString()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -112,7 +112,7 @@ public function testSubmitFromSingleTextString()
public function testSubmitFromSingleTextTimestamp()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -135,7 +135,7 @@ public function testSubmitFromSingleTextTimestamp()
public function testSubmitFromSingleTextRaw()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -399,7 +399,7 @@ public function testThrowExceptionIfDaysIsInvalid()
public function testSetDataWithNegativeTimezoneOffsetStringInput()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -421,7 +421,7 @@ public function testSetDataWithNegativeTimezoneOffsetStringInput()
public function testSetDataWithNegativeTimezoneOffsetDateTimeInput()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -495,7 +495,7 @@ public function testMonthsOptionShortFormat()
public function testMonthsOptionLongFormat()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -515,7 +515,7 @@ public function testMonthsOptionLongFormat()
public function testMonthsOptionLongFormatWithDifferentTimezone()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -621,7 +621,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
public function testPassDatePatternToView()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -634,7 +634,7 @@ public function testPassDatePatternToView()
public function testPassDatePatternToViewDifferentFormat()
{
// we test against "de_AT", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_AT');
@@ -682,7 +682,7 @@ public function testDontPassDatePatternIfText()
public function testDatePatternFormatWithQuotedStrings()
{
// we test against "es_ES", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('es_ES');
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
index dd1a7c549f082..c5a6236d1b13e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
@@ -18,7 +18,7 @@ class IntegerTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index cb59fa2001f48..ca03ef3205aa3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -19,7 +19,7 @@ class LanguageTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
index 8c56bcc9584f3..2a46755bdc64e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
@@ -19,7 +19,7 @@ class LocaleTypeTest extends TestCase
{
protected function setUp()
{
- IntlTestHelper::requireIntl($this);
+ IntlTestHelper::requireIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
index bd01f8eda2396..3938454c3a4a4 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
@@ -20,7 +20,7 @@ protected function setUp()
{
// we test against different locales, so we need the full
// implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
parent::setUp();
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
index 1020260d96849..b8675d2684679 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
@@ -21,7 +21,7 @@ protected function setUp()
parent::setUp();
// we test against "de_DE", so we need the full implementation
- IntlTestHelper::requireFullIntl($this);
+ IntlTestHelper::requireFullIntl($this, false);
\Locale::setDefault('de_DE');
}
diff --git a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
index 32f591c860698..534d74ea6f0e4 100644
--- a/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
+++ b/src/Symfony/Component/Form/Util/OrderedHashMapIterator.php
@@ -14,9 +14,9 @@
/**
* Iterator for {@link OrderedHashMap} objects.
*
- * This class is internal and should not be used.
- *
* @author Bernhard Schussek Request Headers
- {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestheaders, labels: ['Header', 'Value'] }, with_context = false) }}
+ {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.requestheaders, labels: ['Header', 'Value'], maxDepth: 1 }, with_context = false) }}
Request Content
@@ -183,7 +183,7 @@
Response Headers
- {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.responseheaders, labels: ['Header', 'Value'] }, with_context = false) }}
+ {{ include('@WebProfiler/Profiler/bag.html.twig', { bag: collector.responseheaders, labels: ['Header', 'Value'], maxDepth: 1 }, with_context = false) }}
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:
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php index 1dcef8c5cf39a..044a742db630a 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CountryValidatorTest.php @@ -92,7 +92,7 @@ public function getInvalidCountries() public function testValidateUsingCountrySpecificLocale() { // in order to test with "en_GB" - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('en_GB'); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php index 720bf7604ae2e..1286ff31f89f3 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/CurrencyValidatorTest.php @@ -60,7 +60,7 @@ public function testValidCurrencies($currency) **/ public function testValidCurrenciesWithCountrySpecificLocale($currency) { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('en_GB'); diff --git a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php index ba6433a1bdfa3..2980f2a233193 100644 --- a/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php +++ b/src/Symfony/Component/Validator/Tests/Constraints/LanguageValidatorTest.php @@ -91,7 +91,7 @@ public function getInvalidLanguages() public function testValidateUsingCountrySpecificLocale() { - IntlTestHelper::requireFullIntl($this); + IntlTestHelper::requireFullIntl($this, false); \Locale::setDefault('fr_FR'); $existingLanguage = 'en'; diff --git a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php index 916c4bd460622..3681b6f1391a8 100644 --- a/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php +++ b/src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php @@ -26,7 +26,7 @@ */ class GraphvizDumper implements DumperInterface { - private static $defaultOptions = array( + protected static $defaultOptions = array( 'graph' => array('ratio' => 'compress', 'rankdir' => 'LR'), 'node' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'fillcolor' => 'lightblue', 'fixedsize' => true, 'width' => 1), 'edge' => array('fontsize' => 9, 'fontname' => 'Arial', 'color' => '#333333', 'arrowhead' => 'normal', 'arrowsize' => 0.5), @@ -58,7 +58,10 @@ public function dump(Definition $definition, Marking $marking = null, array $opt .$this->endDot(); } - private function findPlaces(Definition $definition, Marking $marking = null) + /** + * @internal + */ + protected function findPlaces(Definition $definition, Marking $marking = null) { $places = array(); @@ -79,7 +82,10 @@ private function findPlaces(Definition $definition, Marking $marking = null) return $places; } - private function findTransitions(Definition $definition) + /** + * @internal + */ + protected function findTransitions(Definition $definition) { $transitions = array(); @@ -93,37 +99,38 @@ private function findTransitions(Definition $definition) return $transitions; } - private function addPlaces(array $places) + /** + * @internal + */ + protected function addPlaces(array $places) { $code = ''; foreach ($places as $id => $place) { - $code .= sprintf(" place_%s [label=\"%s\", shape=circle%s];\n", - $this->dotize($id), - $id, - $this->addAttributes($place['attributes']) - ); + $code .= sprintf(" place_%s [label=\"%s\", shape=circle%s];\n", $this->dotize($id), $id, $this->addAttributes($place['attributes'])); } return $code; } - private function addTransitions(array $transitions) + /** + * @internal + */ + protected function addTransitions(array $transitions) { $code = ''; foreach ($transitions as $place) { - $code .= sprintf(" transition_%s [label=\"%s\", shape=box%s];\n", - $this->dotize($place['name']), - $place['name'], - $this->addAttributes($place['attributes']) - ); + $code .= sprintf(" transition_%s [label=\"%s\", shape=box%s];\n", $this->dotize($place['name']), $place['name'], $this->addAttributes($place['attributes'])); } return $code; } - private function findEdges(Definition $definition) + /** + * @internal + */ + protected function findEdges(Definition $definition) { $dotEdges = array(); @@ -147,7 +154,10 @@ private function findEdges(Definition $definition) return $dotEdges; } - private function addEdges($edges) + /** + * @internal + */ + protected function addEdges(array $edges) { $code = ''; @@ -163,7 +173,10 @@ private function addEdges($edges) return $code; } - private function startDot(array $options) + /** + * @internal + */ + protected function startDot(array $options) { return sprintf("digraph workflow {\n %s\n node [%s];\n edge [%s];\n\n", $this->addOptions($options['graph']), @@ -172,12 +185,23 @@ private function startDot(array $options) ); } - private function endDot() + /** + * @internal + */ + protected function endDot() { return "}\n"; } - private function addAttributes($attributes) + /** + * @internal + */ + protected function dotize($id) + { + return strtolower(preg_replace('/[^\w]/i', '_', $id)); + } + + private function addAttributes(array $attributes) { $code = array(); @@ -188,7 +212,7 @@ private function addAttributes($attributes) return $code ? ', '.implode(', ', $code) : ''; } - private function addOptions($options) + private function addOptions(array $options) { $code = array(); @@ -198,9 +222,4 @@ private function addOptions($options) return implode(' ', $code); } - - private function dotize($id) - { - return strtolower(preg_replace('/[^\w]/i', '_', $id)); - } } diff --git a/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php b/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php new file mode 100644 index 0000000000000..9f68e1daf72f3 --- /dev/null +++ b/src/Symfony/Component/Workflow/Dumper/StateMachineGraphvizDumper.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Workflow\Dumper; + +use Symfony\Component\Workflow\Definition; +use Symfony\Component\Workflow\Marking; + +class StateMachineGraphvizDumper extends GraphvizDumper +{ + /** + * {@inheritdoc} + * + * Dumps the workflow as a graphviz graph. + * + * Available options: + * + * * graph: The default options for the whole graph + * * node: The default options for nodes (places) + * * edge: The default options for edges + */ + public function dump(Definition $definition, Marking $marking = null, array $options = array()) + { + $places = $this->findPlaces($definition, $marking); + $edges = $this->findEdges($definition); + + $options = array_replace_recursive(self::$defaultOptions, $options); + + return $this->startDot($options) + .$this->addPlaces($places) + .$this->addEdges($edges) + .$this->endDot() + ; + } + + /** + * @internal + */ + protected function findEdges(Definition $definition) + { + $edges = array(); + + foreach ($definition->getTransitions() as $transition) { + foreach ($transition->getFroms() as $from) { + foreach ($transition->getTos() as $to) { + $edges[$from][] = array( + 'name' => $transition->getName(), + 'to' => $to, + ); + } + } + } + + return $edges; + } + + /** + * @internal + */ + protected function addEdges(array $edges) + { + $code = ''; + + foreach ($edges as $id => $edges) { + foreach ($edges as $edge) { + $code .= sprintf(" place_%s -> place_%s [label=\"%s\" style=\"%s\"];\n", $this->dotize($id), $this->dotize($edge['to']), $edge['name'], 'solid'); + } + } + + return $code; + } +} diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php index 2b90ea8d5f197..01927b209c2ff 100644 --- a/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php +++ b/src/Symfony/Component/Workflow/Tests/Dumper/GraphvizDumperTest.php @@ -20,7 +20,7 @@ public function setUp() /** * @dataProvider provideWorkflowDefinitionWithoutMarking */ - public function testGraphvizDumperWithoutMarking($definition, $expected) + public function testDumpWithoutMarking($definition, $expected) { $dump = $this->dumper->dump($definition); @@ -30,7 +30,7 @@ public function testGraphvizDumperWithoutMarking($definition, $expected) /** * @dataProvider provideWorkflowDefinitionWithMarking */ - public function testWorkflowWithMarking($definition, $marking, $expected) + public function testDumpWithMarking($definition, $marking, $expected) { $dump = $this->dumper->dump($definition, $marking); @@ -40,9 +40,9 @@ public function testWorkflowWithMarking($definition, $marking, $expected) public function provideWorkflowDefinitionWithMarking() { yield array( - $this->createComplexWorkflow(), + $this->createComplexWorkflowDefinition(), new Marking(array('b' => 1)), - $this->createComplexWorkflowDumpWithMarking(), + $this->createComplexWorkflowDefinitionDumpWithMarking(), ); yield array( @@ -54,11 +54,11 @@ public function provideWorkflowDefinitionWithMarking() public function provideWorkflowDefinitionWithoutMarking() { - yield array($this->createComplexWorkflow(), $this->provideComplexWorkflowDumpWithoutMarking()); + yield array($this->createComplexWorkflowDefinition(), $this->provideComplexWorkflowDumpWithoutMarking()); yield array($this->createSimpleWorkflowDefinition(), $this->provideSimpleWorkflowDumpWithoutMarking()); } - public function createComplexWorkflowDumpWithMarking() + public function createComplexWorkflowDefinitionDumpWithMarking() { return 'digraph workflow { ratio="compress" rankdir="LR" diff --git a/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php new file mode 100644 index 0000000000000..c9a49b36f71e1 --- /dev/null +++ b/src/Symfony/Component/Workflow/Tests/Dumper/StateMachineGraphvizDumperTest.php @@ -0,0 +1,74 @@ +dumper = new StateMachineGraphvizDumper(); + } + + public function testDumpWithoutMarking() + { + $definition = $this->createComplexStateMachineDefinition(); + + $dump = $this->dumper->dump($definition); + + $expected = <<<'EOGRAPH' +digraph workflow { + ratio="compress" rankdir="LR" + node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; + edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; + + place_a [label="a", shape=circle, style="filled"]; + place_b [label="b", shape=circle]; + place_c [label="c", shape=circle]; + place_d [label="d", shape=circle]; + place_a -> place_b [label="t1" style="solid"]; + place_d -> place_b [label="t1" style="solid"]; + place_b -> place_c [label="t2" style="solid"]; + place_b -> place_d [label="t3" style="solid"]; +} + +EOGRAPH; + + $this->assertEquals($expected, $dump); + } + + public function testDumpWithMarking() + { + $definition = $this->createComplexStateMachineDefinition(); + $marking = new Marking(array('b' => 1)); + + $expected = <<<'EOGRAPH' +digraph workflow { + ratio="compress" rankdir="LR" + node [fontsize="9" fontname="Arial" color="#333333" fillcolor="lightblue" fixedsize="1" width="1"]; + edge [fontsize="9" fontname="Arial" color="#333333" arrowhead="normal" arrowsize="0.5"]; + + place_a [label="a", shape=circle, style="filled"]; + place_b [label="b", shape=circle, color="#FF0000", shape="doublecircle"]; + place_c [label="c", shape=circle]; + place_d [label="d", shape=circle]; + place_a -> place_b [label="t1" style="solid"]; + place_d -> place_b [label="t1" style="solid"]; + place_b -> place_c [label="t2" style="solid"]; + place_b -> place_d [label="t3" style="solid"]; +} + +EOGRAPH; + + $dump = $this->dumper->dump($definition, $marking); + + $this->assertEquals($expected, $dump); + } +} diff --git a/src/Symfony/Component/Workflow/Tests/StateMachineTest.php b/src/Symfony/Component/Workflow/Tests/StateMachineTest.php index 6aa3c60fc1cc6..7dca9a824d7c1 100644 --- a/src/Symfony/Component/Workflow/Tests/StateMachineTest.php +++ b/src/Symfony/Component/Workflow/Tests/StateMachineTest.php @@ -2,21 +2,16 @@ namespace Symfony\Component\Workflow\Tests; -use Symfony\Component\Workflow\Definition; use Symfony\Component\Workflow\Marking; use Symfony\Component\Workflow\StateMachine; -use Symfony\Component\Workflow\Transition; class StateMachineTest extends \PHPUnit_Framework_TestCase { + use WorkflowBuilderTrait; + public function testCan() { - $places = array('a', 'b', 'c', 'd'); - $transitions[] = new Transition('t1', 'a', 'b'); - $transitions[] = new Transition('t1', 'd', 'b'); - $transitions[] = new Transition('t2', 'b', 'c'); - $transitions[] = new Transition('t3', 'b', 'd'); - $definition = new Definition($places, $transitions); + $definition = $this->createComplexStateMachineDefinition(); $net = new StateMachine($definition); $subject = new \stdClass(); @@ -29,47 +24,18 @@ public function testCan() $subject->marking = 'b'; $this->assertFalse($net->can($subject, 't1')); - - // The graph looks like: - // - // +-------------------------------+ - // v | - // +---+ +----+ +----+ +----+ +---+ +----+ - // | a | --> | t1 | --> | b | --> | t3 | --> | d | --> | t1 | - // +---+ +----+ +----+ +----+ +---+ +----+ - // | - // | - // v - // +----+ +----+ - // | t2 | --> | c | - // +----+ +----+ } public function testCanWithMultipleTransition() { - $places = array('a', 'b', 'c'); - $transitions[] = new Transition('t1', 'a', 'b'); - $transitions[] = new Transition('t2', 'a', 'c'); - $definition = new Definition($places, $transitions); + $definition = $this->createComplexStateMachineDefinition(); $net = new StateMachine($definition); $subject = new \stdClass(); - // If you are in place "a" you should be able to apply "t1" and "t2" - $subject->marking = 'a'; - $this->assertTrue($net->can($subject, 't1')); + // If you are in place "b" you should be able to apply "t1" and "t2" + $subject->marking = 'b'; $this->assertTrue($net->can($subject, 't2')); - - // The graph looks like: - // - // +----+ +----+ +---+ - // | a | --> | t1 | --> | b | - // +----+ +----+ +---+ - // | - // | - // v - // +----+ +----+ - // | t2 | --> | c | - // +----+ +----+ + $this->assertTrue($net->can($subject, 't3')); } } diff --git a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php index 1b5fa67fdb083..30d2551fa1b0f 100644 --- a/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php +++ b/src/Symfony/Component/Workflow/Tests/Validator/WorkflowValidatorTest.php @@ -15,7 +15,7 @@ class WorkflowValidatorTest extends \PHPUnit_Framework_TestCase */ public function testSinglePlaceWorkflowValidatorAndComplexWorkflow() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); (new WorkflowValidator(true))->validate($definition, 'foo'); } diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php b/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php index d7b8de530445c..5e8db29061295 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowBuilderTrait.php @@ -7,7 +7,7 @@ trait WorkflowBuilderTrait { - private function createComplexWorkflow() + private function createComplexWorkflowDefinition() { $places = range('a', 'g'); @@ -33,7 +33,7 @@ private function createComplexWorkflow() // +----+ +----+ +----+ +----+ } - public function createSimpleWorkflowDefinition() + private function createSimpleWorkflowDefinition() { $places = range('a', 'c'); @@ -42,5 +42,38 @@ public function createSimpleWorkflowDefinition() $transitions[] = new Transition('t2', 'b', 'c'); return new Definition($places, $transitions); + + // The graph looks like: + // +---+ +----+ +---+ +----+ +---+ + // | a | --> | t1 | --> | b | --> | t2 | --> | c | + // +---+ +----+ +---+ +----+ +---+ + } + + private function createComplexStateMachineDefinition() + { + $places = array('a', 'b', 'c', 'd'); + + $transitions[] = new Transition('t1', 'a', 'b'); + $transitions[] = new Transition('t1', 'd', 'b'); + $transitions[] = new Transition('t2', 'b', 'c'); + $transitions[] = new Transition('t3', 'b', 'd'); + + $definition = new Definition($places, $transitions); + + return $definition; + + // The graph looks like: + // t1 + // +------------------+ + // v | + // +---+ t1 +-----+ t2 +---+ | + // | a | ----> | b | ----> | c | | + // +---+ +-----+ +---+ | + // | | + // | t3 | + // v | + // +-----+ | + // | d | -------------+ + // +-----+ } } diff --git a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php index 0a886752d5992..cb5256f412933 100644 --- a/src/Symfony/Component/Workflow/Tests/WorkflowTest.php +++ b/src/Symfony/Component/Workflow/Tests/WorkflowTest.php @@ -56,7 +56,7 @@ public function testGetMarkingWithImpossiblePlace() public function testGetMarkingWithEmptyInitialMarking() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); @@ -70,7 +70,7 @@ public function testGetMarkingWithEmptyInitialMarking() public function testGetMarkingWithExistingMarking() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $subject->marking = array('b' => 1, 'c' => 1); @@ -89,7 +89,7 @@ public function testGetMarkingWithExistingMarking() */ public function testCanWithUnexistingTransition() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); @@ -99,7 +99,7 @@ public function testCanWithUnexistingTransition() public function testCan() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); @@ -110,7 +110,7 @@ public function testCan() public function testCanWithGuard() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $eventDispatcher = new EventDispatcher(); @@ -128,7 +128,7 @@ public function testCanWithGuard() */ public function testApplyWithImpossibleTransition() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); @@ -138,7 +138,7 @@ public function testApplyWithImpossibleTransition() public function testApply() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $workflow = new Workflow($definition, new MultipleStateMarkingStore()); @@ -153,7 +153,7 @@ public function testApply() public function testApplyWithEventDispatcher() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $eventDispatcher = new EventDispatcherMock(); @@ -187,7 +187,7 @@ public function testApplyWithEventDispatcher() public function testGetEnabledTransitions() { - $definition = $this->createComplexWorkflow(); + $definition = $this->createComplexWorkflowDefinition(); $subject = new \stdClass(); $subject->marking = null; $eventDispatcher = new EventDispatcher(); diff --git a/src/Symfony/Component/Yaml/Inline.php b/src/Symfony/Component/Yaml/Inline.php index 37a0c8967b270..c6e5830bd5480 100644 --- a/src/Symfony/Component/Yaml/Inline.php +++ b/src/Symfony/Component/Yaml/Inline.php @@ -648,10 +648,8 @@ private static function evaluateScalar($scalar, $flags, $references = array()) return (float) str_replace(array(',', '_'), '', $scalar); case preg_match(self::getTimestampRegex(), $scalar): if (Yaml::PARSE_DATETIME & $flags) { - $date = new \DateTime($scalar); - $date->setTimeZone(new \DateTimeZone('UTC')); - - return $date; + // When no timezone is provided in the parsed date, YAML spec says we must assume UTC. + return new \DateTime($scalar, new \DateTimeZone('UTC')); } $timeZone = date_default_timezone_get(); diff --git a/src/Symfony/Component/Yaml/Tests/InlineTest.php b/src/Symfony/Component/Yaml/Tests/InlineTest.php index 3b580129c4fb7..33bda676f4dec 100644 --- a/src/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/src/Symfony/Component/Yaml/Tests/InlineTest.php @@ -561,7 +561,7 @@ public function testParseTimestampAsUnixTimestampByDefault($yaml, $year, $month, /** * @dataProvider getTimestampTests */ - public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second) + public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $hour, $minute, $second, $timezone) { $expected = new \DateTime($yaml); $expected->setTimeZone(new \DateTimeZone('UTC')); @@ -573,16 +573,18 @@ public function testParseTimestampAsDateTimeObject($yaml, $year, $month, $day, $ $expected->setTime($hour, $minute, $second); } - $this->assertEquals($expected, Inline::parse($yaml, Yaml::PARSE_DATETIME)); + $date = Inline::parse($yaml, Yaml::PARSE_DATETIME); + $this->assertEquals($expected, $date); + $this->assertSame($timezone, $date->format('O')); } public function getTimestampTests() { return array( - 'canonical' => array('2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1), - 'ISO-8601' => array('2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1), - 'spaced' => array('2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1), - 'date' => array('2001-12-15', 2001, 12, 15, 0, 0, 0), + 'canonical' => array('2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43.1, '+0000'), + 'ISO-8601' => array('2001-12-15t21:59:43.10-05:00', 2001, 12, 16, 2, 59, 43.1, '-0500'), + 'spaced' => array('2001-12-15 21:59:43.10 -5', 2001, 12, 16, 2, 59, 43.1, '-0500'), + 'date' => array('2001-12-15', 2001, 12, 15, 0, 0, 0, '+0000'), ); } @@ -594,7 +596,11 @@ public function testParseNestedTimestampListAsDateTimeObject($yaml, $year, $mont $expected = new \DateTime($yaml); $expected->setTimeZone(new \DateTimeZone('UTC')); $expected->setDate($year, $month, $day); - @$expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second)); + if (PHP_VERSION_ID >= 70100) { + $expected->setTime($hour, $minute, $second, 1000000 * ($second - (int) $second)); + } else { + $expected->setTime($hour, $minute, $second); + } $expectedNested = array('nested' => array($expected)); $yamlNested = "{nested: [$yaml]}";