Coder Social home page Coder Social logo

Comments (6)

alcaeus avatar alcaeus commented on September 15, 2024 2

I assume you configured a project.exception_listener in your container? The bundle checks the compiled container to infer return types of the has and get methods, which is why you'll get that error message.

from phpstan-symfony.

lookyman avatar lookyman commented on September 15, 2024 1

What if the different environments have different defined services?

You can pass different paths to respective environment containers in different configs and run PHPStan with those. For example, I always use a special phpstan.tests.neon config for my tests, which just includes the normal config and redefines the container path to the test one.

However, there is an other way, check out this part of the README.

from phpstan-symfony.

ToBee94 avatar ToBee94 commented on September 15, 2024

yes the service is defined in the config.

They are serveral problems:

The check ensures that the service has been loaded correctly and a check that the service was ever defined. What if the pass should only be used if the service has been defined?
Also what if I deregister the service in other passes or listener?

What if the different environments have different defined services?

from phpstan-symfony.

alcaeus avatar alcaeus commented on September 15, 2024

I'm not saying whether or not it's correct, I'm merely saying why you get the error. This is what this library does: it inspects your container and tells you that the service is there so you don't need to check for its existence.

from phpstan-symfony.

Wirone avatar Wirone commented on September 15, 2024

I got this error when I wanted to override some listener's priority and was checking if it's registered by using has(). I needed to check it because that listener is registered dynamically based on configuration - for current config it's always enabled.

I changed PHPStan's Symfony extension config by disabling constant_hassers and it's working :)

from phpstan-symfony.

github-actions avatar github-actions commented on September 15, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from phpstan-symfony.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.