From 3a42da3c5fb1370bf0e763decd06a0c6d856b205 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 22 Feb 2018 13:34:56 +0100 Subject: [PATCH 1/2] Sync UPGRADE-3.0.md with 3.4 --- UPGRADE-3.0.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 131 insertions(+), 8 deletions(-) diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md index 05c9b402b6..f9524e7710 100644 --- a/UPGRADE-3.0.md +++ b/UPGRADE-3.0.md @@ -127,8 +127,14 @@ UPGRADE FROM 2.x to 3.0 $table->render(); ``` +* Parameters of `renderException()` method of the + `Symfony\Component\Console\Application` are type hinted. + You must add the type hint to your implementations. + ### DependencyInjection + * The method `remove` was added to `Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface`. + * The concept of scopes was removed, the removed methods are: - `Symfony\Component\DependencyInjection\ContainerBuilder::getScopes()` @@ -211,6 +217,22 @@ UPGRADE FROM 2.x to 3.0 removed: `ContainerBuilder::synchronize()`, `Definition::isSynchronized()`, and `Definition::setSynchronized()`. +### DomCrawler + + * The interface of the `Symfony\Component\DomCrawler\Crawler` changed. It does no longer implement `\Iterator` but `\IteratorAggregate`. If you rely on methods of the `\Iterator` interface, call the `getIterator` method of the `\IteratorAggregate` interface before. No changes are required in a `\Traversable`-aware control structure, such as `foreach`. + + Before: + + ```php + $crawler->current(); + ``` + + After: + + ```php + $crawler->getIterator()->current(); + ``` + ### DoctrineBridge * The `property` option of `DoctrineType` was removed in favor of the `choice_label` option. @@ -236,11 +258,22 @@ UPGRADE FROM 2.x to 3.0 ### EventDispatcher + * The method `getListenerPriority($eventName, $listener)` has been added to the + `EventDispatcherInterface`. * The interface `Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface` extends `Symfony\Component\EventDispatcher\EventDispatcherInterface`. ### Form + * The `getBlockPrefix()` method was added to the `FormTypeInterface` in replacement of + the `getName()` method which has been removed. + + * The `configureOptions()` method was added to the `FormTypeInterface` in replacement + of the `setDefaultOptions()` method which has been removed. + + * The `getBlockPrefix()` method was added to the `ResolvedFormTypeInterface` in + replacement of the `getName()` method which has been removed. + * The option `options` of the `CollectionType` has been removed in favor of the `entry_options` option. @@ -380,8 +413,8 @@ UPGRADE FROM 2.x to 3.0 $form = $this->createForm(MyType::class); ``` - * Passing custom data to forms now needs to be done - through the options resolver. + * Passing custom data to forms now needs to be done + through the options resolver. In the controller: @@ -392,7 +425,7 @@ UPGRADE FROM 2.x to 3.0 'method' => 'PUT', )); ``` - After: + After: ```php $form = $this->createForm(MyType::class, $entity, array( 'action' => $this->generateUrl('action_route'), @@ -401,13 +434,13 @@ UPGRADE FROM 2.x to 3.0 )); ``` In the form type: - + Before: ```php class MyType extends AbstractType { private $value; - + public function __construct($variableValue) { $this->value = $value; @@ -415,7 +448,7 @@ UPGRADE FROM 2.x to 3.0 // ... } ``` - + After: ```php public function buildForm(FormBuilderInterface $builder, array $options) @@ -423,7 +456,7 @@ UPGRADE FROM 2.x to 3.0 $value = $options['custom_value']; // ... } - + public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( @@ -431,7 +464,7 @@ UPGRADE FROM 2.x to 3.0 )); } ``` - + * The alias option of the `form.type_extension` tag was removed in favor of the `extended_type`/`extended-type` option. @@ -690,6 +723,11 @@ UPGRADE FROM 2.x to 3.0 be removed in Symfony 3.0. Use the `debug:config`, `debug:container`, `debug:router`, `debug:translation` and `lint:yaml` commands instead. + * The base `Controller`class is now abstract. + + * The visibility of all methods of the base `Controller` class has been changed from + `public` to `protected`. + * The `getRequest` method of the base `Controller` class has been deprecated since Symfony 2.4 and must be therefore removed in 3.0. The only reliable way to get the `Request` object is to inject it in the action method. @@ -816,6 +854,8 @@ UPGRADE FROM 2.x to 3.0 * The `RouterApacheDumperCommand` was removed. + * The `createEsi` method of `Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache` was removed. Use `createSurrogate` instead. + * The `templating.helper.router` service was moved to `templating_php.xml`. You have to ensure that the PHP templating engine is enabled to be able to use it: @@ -1009,6 +1049,12 @@ UPGRADE FROM 2.x to 3.0 ### Security + * The `vote()` method from the `VoterInterface` was changed to now accept arbitrary + types and not only objects. You can rely on the new abstract `Voter` class introduced + in 2.8 to ease integrating your own voters. + + * The `AbstractVoter` class was removed in favor of the new `Voter` class. + * The `Resources/` directory was moved to `Core/Resources/` * The `key` settings of `anonymous`, `remember_me` and `http_digest` are @@ -1206,6 +1252,68 @@ UPGRADE FROM 2.x to 3.0 * The `Translator::setFallbackLocale()` method has been removed in favor of `Translator::setFallbackLocales()`. + * The visibility of the `locale` property has been changed from protected to private. Rely on `getLocale` and `setLocale` + instead. + + Before: + + ```php + class CustomTranslator extends Translator + { + public function fooMethod() + { + // get locale + $locale = $this->locale; + + // update locale + $this->locale = $locale; + } + } + ``` + + After: + + ```php + class CustomTranslator extends Translator + { + public function fooMethod() + { + // get locale + $locale = $this->getLocale(); + + // update locale + $this->setLocale($locale); + } + } + ``` + + * The method `FileDumper::format()` was removed. You should use + `FileDumper::formatCatalogue()` instead. + + Before: + + ```php + class CustomDumper extends FileDumper + { + protected function format(MessageCatalogue $messages, $domain) + { + ... + } + } + ``` + + After: + + ```php + class CustomDumper extends FileDumper + { + public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) + { + ... + } + } + ``` + * The `getMessages()` method of the `Symfony\Component\Translation\Translator` class was removed. You should use the `getCatalogue()` method of the `Symfony\Component\Translation\TranslatorBagInterface`. @@ -1768,8 +1876,23 @@ UPGRADE FROM 2.x to 3.0 `Process::setInput()` and `Process::getInput()` that works the same way. * `Process::setInput()` and `ProcessBuilder::setInput()` do not accept non-scalar types. +### Monolog Bridge + + * `Symfony\Bridge\Monolog\Logger::emerg()` was removed. Use `emergency()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::crit()` was removed. Use `critical()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::err()` was removed. Use `error()` which is PSR-3 compatible. + * `Symfony\Bridge\Monolog\Logger::warn()` was removed. Use `warning()` which is PSR-3 compatible. + +### Swiftmailer Bridge + + * `Symfony\Bridge\Swiftmailer\DataCollector\MessageDataCollector` was removed. Use the `Symfony\Bundle\SwiftmailerBundle\DataCollector\MessageDataCollector` class instead. + ### HttpFoundation + * The precedence of parameters returned from `Request::get()` changed from "GET, PATH, BODY" to "PATH, GET, BODY" + + * `Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface` no longer implements the `IteratorAggregate` interface. Use the `all()` method instead of iterating over the flash bag. + * Removed the feature that allowed finding deep items in `ParameterBag::get()`. This may affect you when getting parameters from the `Request` class: From 30b691c57d00fe09630728aab63965157afdafc1 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 22 Feb 2018 13:51:03 +0100 Subject: [PATCH 2/2] [travis] fix passing $INI to tpecl() --- .travis.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index f07e7de568..1eaa6cefbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -107,6 +107,7 @@ before_install: tpecl () { local ext_name=$1 local ext_so=$2 + local INI=$3 local ext_dir=$(php -r "echo ini_get('extension_dir');") local ext_cache=php-ext/$(basename $ext_dir)/$ext_name @@ -139,11 +140,11 @@ before_install: # Install extra PHP extensions if [[ ! $skip && $PHP = 5.* ]]; then ([[ $deps ]] || tfold ext.symfony_debug 'cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo extension = $(pwd)/modules/symfony_debug.so >> '"$INI") - tfold ext.memcached tpecl memcached-2.1.0 memcached.so - tfold ext.apcu tpecl apcu-4.0.11 apcu.so + tfold ext.memcached tpecl memcached-2.1.0 memcached.so $INI + tfold ext.apcu tpecl apcu-4.0.11 apcu.so $INI elif [[ ! $skip && $PHP = 7.* ]]; then - tfold ext.apcu tpecl apcu-5.1.6 apcu.so - tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so + tfold ext.apcu tpecl apcu-5.1.6 apcu.so $INI + tfold ext.mongodb tpecl mongodb-1.4.0RC1 mongodb.so $INI fi install: