Coder Social home page Coder Social logo

Comments (5)

ondrejmirtes avatar ondrejmirtes commented on September 15, 2024

Hi, this is not a bug. Your method should be declared such as:

protected function supports(string $attribute, mixed $subject): bool

Same as the parent. If you widen the type by omitting the parameter type on purpose, you should say in the PHPDoc what the type is supposed to be, such as @param mixed $attribute.

from phpstan-symfony.

luxemate avatar luxemate commented on September 15, 2024

@ondrejmirtes Symfony 4.4 doesn't have native types set, thus I also can't use native type in supports (because of the signature mismatch). But what symfony does have is the @param string $attribute set, which is ignored in the supports method, but is not ignored in the voteOnAttribute method (probably because of asserts in the stub).

But maybe I misinterpret the situation and with treatPhpDocTypesAsCertain: false it's required to add @param string $attribute to the supports method in a custom Voter. Though it seems a little bit redundant, as annotation was already added by the third-party vendor.

from phpstan-symfony.

ondrejmirtes avatar ondrejmirtes commented on September 15, 2024

@luxemate You've left out the information about Symfony 4.4 in your issue. I'd accept a PR that adds @param string $attribute into the stub.

from phpstan-symfony.

luxemate avatar luxemate commented on September 15, 2024

@ondrejmirtes I've created a new PR and added only @param string $attribute as you've suggested.

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.