Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1

5.2k Views Asked by At

All my services and parameters from services.yml are striked and I get the message "Not quoting a scalar starting with the "%" indicator character is deprecated since Symfony 3.1". But I am using Symfony 2.6 and I don't want to put the values in quotes since it is not needed for this version. This happened only after I updated my Symfony Plugin for PhpStorm 2016.1

What can I do to avoid this? (using PhpStorm 10 or using an older plugin is not an option)

3

There are 3 best solutions below

5
axiac On

The inspection you mention is not provided by PhpStorm 2016.1 but by the Symfony Plugin plugin.

As with any other inspection, it can be easily disabled if you press Alt-Enter* or click on the yellow bulb that appears at the start of the offending line then select Disable inspection from the submenu of Inspection 'Yaml escaped \ in quoted inspection' options.

You can also find this inspection in the Settings/Preference window, under Editor -> Inspections -> Symfony -> Twig.


* I am using PhpStorm on OSX and this is the key combination on the default keymap.

5
Renato Mefi On

What you need to do is embrace it with double quotes.

Before:

services:
  foo.class:
    class: Foo\Class
    arguments:
      - @some.service
      - %some.parameter%

After:

services:
  foo.class:
    class: Foo\Class
    arguments:
      - "@some.service"
      - "%some.parameter%"
3
Breith On

starting with the “%” is deprecated since the version 2.8 ;)

New in Symfony 2.8: YAML deprecations