Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

like image 428
M. Marc Avatar asked Mar 29 '16 10:03

M. Marc


3 Answers

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%"
like image 200
Renato Mefi Avatar answered Nov 15 '22 10:11

Renato Mefi


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.

like image 22
axiac Avatar answered Nov 15 '22 11:11

axiac


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

New in Symfony 2.8: YAML deprecations

like image 22
Breith Avatar answered Nov 15 '22 12:11

Breith