Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParameterBag get method autocomplete and warning #1706

Closed
werwolf666 opened this issue Sep 14, 2021 · 9 comments
Closed

ParameterBag get method autocomplete and warning #1706

werwolf666 opened this issue Sep 14, 2021 · 9 comments

Comments

@werwolf666
Copy link

If we use object $parameterBag that implements
Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface

and write $parameterBag->get('some_name') we have not correct behaviour.

If 'some_name' is name of service all works fine: this value could be autocompleted and Phpstorm not show warnings.

But if 'some_name' is name of parameter Phpstorm can't find this value: it not exists in autocomplete variants and Phpstorm show warning 'Missing Service'.

PhpStorm 2021.2.1 build PS-212.5080.71
Plugin version 0.23.212
Symfony 5.2.14

@S-Tian86
Copy link

Hi,

if you use this class is the same problem:
Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;

'mising service'

@arderyp
Copy link

arderyp commented Dec 1, 2021

I'm experiencing this too, and would love a solution.

@arderyp
Copy link

arderyp commented Jan 11, 2022

@Haehnchen I'd love to hear your feedback on this if you have time. Thanks in advance :)

@benjaminfunk
Copy link

same for Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface

@mrFleshka
Copy link

Please add support parameters for:

Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface

Haehnchen added a commit that referenced this issue Apr 6, 2022
#1706 fix method references and multi resolve
Haehnchen added a commit that referenced this issue Apr 6, 2022
@mrFleshka
Copy link

It works like a charm! THX!)

@S-Tian86
Copy link

S-Tian86 commented Apr 8, 2022

Mmm... for the class
Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface

Not working for me.

😥

Haehnchen added a commit that referenced this issue Apr 9, 2022
Haehnchen added a commit that referenced this issue Apr 9, 2022
@S-Tian86
Copy link

Hi, I tried, but I don't know.
For example this Work:

use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;

private ParameterBagInterface $parameterBag;
//...    
$token = $this->parameterBag->get('app.token');

But, this don't work:

use Symfony\Component\DependencyInjection\ParameterBag\ContainerBagInterface;

private ContainerBagInterface $containerBag;
//...    
$token = $this->containerBag->get('app.token');

In my services.yaml:

parameters:
    app.token: '%env(TOKEN)%'

Thx.

Saludos.

@Haehnchen
Copy link
Owner

its working, checked with latest release

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants