This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/UPGRADE-3.4.md
Christian Flothmann baa1e7f677 minor #22913 [Yaml] Deprecate tags using colon (GuilhemN)
This PR was squashed before being merged into the 3.4 branch (closes #22913).

Discussion
----------

[Yaml] Deprecate tags using colon

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

Using a colon in a tag doesn't look like yaml and causes trouble (see https://github.com/symfony/symfony/pull/22878), so I propose to just deprecate these tags in favor of more consistent tags.

```yml
- !php/const:PHP_INT_MAX
- !php/object:O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}
```
would become
```yml
- !php/const PHP_INT_MAX
- !php/object O:30:"Symfony\Component\Yaml\Tests\A":1:{s:1:"a";s:3:"foo";}
```

Commits
-------

9815af3 [Yaml] Deprecate tags using colon
2017-08-04 15:29:48 +02:00

6.2 KiB

UPGRADE FROM 3.3 to 3.4

DependencyInjection

  • Relying on service auto-registration while autowiring is deprecated and won't be supported in Symfony 4.0. Explicitly inject your dependencies or create services whose ids are their fully-qualified class name.

    Before:

    namespace App\Controller;
    
    use App\Mailer;
    
    class DefaultController
    {
        public function __construct(Mailer $mailer) {
            // ...
        }
    
        // ...
    }
    
    services:
        App\Controller\DefaultController:
            autowire: true
    

    After:

    // same PHP code
    
    services:
        App\Controller\DefaultController:
            autowire: true
    
        # or
        # App\Controller\DefaultController:
        #     arguments: { $mailer: "@App\Mailer" }
    
        App\Mailer:
            autowire: true
    
  • Top-level anonymous services in XML are deprecated and will throw an exception in Symfony 4.0.

Debug

  • Support for stacked errors in the ErrorHandler is deprecated and will be removed in Symfony 4.0.

Filesystem

  • The Symfony\Component\Filesystem\LockHandler class has been deprecated, use the Symfony\Component\Lock\Store\FlockStore class or the Symfony\Component\Lock\Store\FlockStore\SemaphoreStore class directly instead.

Finder

  • The Symfony\Component\Finder\Iterator\FilterIterator class has been deprecated and will be removed in 4.0 as it used to fix a bug which existed before version 5.5.23/5.6.7.

FrameworkBundle

  • The doctrine/cache dependency has been removed; require it via composer require doctrine/cache if you are using Doctrine cache in your project.

  • The validator.mapping.cache.doctrine.apc service has been deprecated.

  • The symfony/stopwatch dependency has been removed, require it via composer require symfony/stopwatch in your dev environment.

  • Using the KERNEL_DIR environment variable or the automatic guessing based on the phpunit.xml / phpunit.xml.dist file location is deprecated since 3.4. Set the KERNEL_CLASS environment variable to the fully-qualified class name of your Kernel instead. Not setting the KERNEL_CLASS environment variable will throw an exception on 4.0 unless you override the KernelTestCase::createKernel() or KernelTestCase::getKernelClass() method.

  • The KernelTestCase::getPhpUnitXmlDir() and KernelTestCase::getPhpUnitCliConfigArgument() methods are deprecated since 3.4 and will be removed in 4.0.

  • The --no-prefix option of the translation:update command is deprecated and will be removed in 4.0. Use the --prefix option with an empty string as value instead (e.g. --prefix="")

  • The Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheClearerPass class has been deprecated and will be removed in 4.0. Use the Symfony\Component\HttpKernel\DependencyInjection\AddCacheClearerPass class instead.

  • The Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AddCacheWarmerPass class has been deprecated and will be removed in 4.0. Use the Symfony\Component\HttpKernel\DependencyInjection\AddCacheWarmerPass class instead.

  • The Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationDumperPass class has been deprecated and will be removed in 4.0. Use the Symfony\Component\Translation\DependencyInjection\TranslationDumperPass class instead.

  • The Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslationExtractorPass class has been deprecated and will be removed in 4.0. Use the Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass class instead.

  • The Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TranslatorPass class has been deprecated and will be removed in 4.0. Use the Symfony\Component\Translation\DependencyInjection\TranslatorPass class instead.

Process

  • The Symfony\Component\Process\ProcessBuilder class has been deprecated, use the Symfony\Component\Process\Process class directly instead.

SecurityBundle

  • Using voters that do not implement the VoterInterfaceis now deprecated in the AccessDecisionManager and this functionality will be removed in 4.0.

  • FirewallContext::getListeners() now returns \Traversable|array

TwigBridge

  • deprecated the Symfony\Bridge\Twig\Form\TwigRenderer class, use the FormRenderer class from the Form component instead

  • deprecated Symfony\Bridge\Twig\Command\DebugCommand::set/getTwigEnvironment and the ability to pass a command name as first argument

  • deprecated Symfony\Bridge\Twig\Command\LintCommand::set/getTwigEnvironment and the ability to pass a command name as first argument

TwigBundle

  • deprecated the Symfony\Bundle\TwigBundle\Command\DebugCommand class, use the DebugCommand class from the Twig bridge instead

  • deprecated relying on the ContainerAwareInterface implementation for Symfony\Bundle\TwigBundle\Command\LintCommand

Validator

  • Not setting the strict option of the Choice constraint to true is deprecated and will throw an exception in Symfony 4.0.

Yaml

  • using the !php/object: tag is deprecated and won't be supported in 4.0. Use the !php/object tag (without the colon) instead.

  • using the !php/const: tag is deprecated and won't be supported in 4.0. Use the !php/const tag (without the colon) instead.

    Before:

    !php/const:PHP_INT_MAX
    

    After:

    !php/const PHP_INT_MAX
    
  • Support for the !str tag is deprecated, use the !!str tag instead.

  • Using the non-specific tag ! is deprecated and will have a different behavior in 4.0. Use a plain integer or !!float instead.

  • Using the Yaml::PARSE_KEYS_AS_STRINGS flag is deprecated as it will be removed in 4.0.

    Before:

    $yaml = <<<YAML
    null: null key
    true: boolean true
    2.0: float key
    YAML;
    
    Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
    

    After:

    $yaml = <<<YAML
    "null": null key
    "true": boolean true
    "2.0": float key
    YAML;
    
    Yaml::parse($yaml);