GithubHelp home page GithubHelp logo

Comments (18)

Ocramius avatar Ocramius commented on August 15, 2024 5

Handled and tested: preparing release.

from collections.

Ocramius avatar Ocramius commented on August 15, 2024 4

As noted in #177 (comment), scavenging vendor/ for annotations is not a good idea. This is an issue to be reported in APIPlatform.

from collections.

stof avatar stof commented on August 15, 2024 2

Well, multiple Symfony component needs to be able to read metadata (potentially using annotations) from arbitrary classes (Validator and Serializer are the one coming to my mind right now).
And at least for these 2 components, it is very common to use them on object graphs involving Doctrine collections (as a common use case is to use them on your entities).
Most of the time, you won't need any metadata there, as you want to treat the collection with the standard handling of Traversable. But this does not mean that Symfony forbids defining a custom behavior, and so it still tries to find the metadata.

The fix for that would be to ignore the Psalm-specific tags in doctrine/annotations by default, as is done already for phpdoc tags.

from collections.

Ocramius avatar Ocramius commented on August 15, 2024 1

Yeah, currently patching doctrine/annotations, since - is not a valid class identifier anyway

from collections.

Ocramius avatar Ocramius commented on August 15, 2024 1

Please note: you'll need doctrine/collections 1.6.1 along with doctrine/annotations 1.6.1.

from collections.

stof avatar stof commented on August 15, 2024

hmm, regarding @template itself, ignoring it might cause issues with the \Sensio\Bundle\FrameworkExtraBundle\Configuration\Template annotation though, in case the ignore list is case sensitive

from collections.

Ocramius avatar Ocramius commented on August 15, 2024

Can you check if #186 fixes this, or if we still need to ignore these annotations?

from collections.

stof avatar stof commented on August 15, 2024

this won't fix it, as doctrine/annotations will still complain. But it will make it simpler to ignore it by default.

from collections.

Ocramius avatar Ocramius commented on August 15, 2024

Interesting that it parses @psalm - easier to skip indeed though :)

from collections.

stof avatar stof commented on August 15, 2024

@Ocramius doctrine/annotation will parse everything starting with @, unless explicitly configured to be ignored. That's how it works, so that it can report mistakes where you forgot to import the annotation.

from collections.

stof avatar stof commented on August 15, 2024

hmm, automatically excluding anything containing a - indeed solves it pretty nicely.

from collections.

trompette avatar trompette commented on August 15, 2024

Time to revive https://wiki.php.net/rfc/annotations or https://wiki.php.net/rfc/annotations_v2 ! 😉

from collections.

Ocramius avatar Ocramius commented on August 15, 2024

@trompette this has nothing to do with the current problem.

from collections.

Ocramius avatar Ocramius commented on August 15, 2024

Meanwhile, re-opening here, while working on the issue 👍

from collections.

Ocramius avatar Ocramius commented on August 15, 2024

I've provided doctrine/annotations#257 - give it a shot please :)

from collections.

jverdeyen avatar jverdeyen commented on August 15, 2024

Still has this error for me when using dev-master using it in a Symfony 4.2 app.

[Semantical Error] The annotation "@psalm" in class Doctrine\Common\Collections\AbstractLazyCollection was never imported. Did you maybe forget to add a "use" statement for this annotation?

from collections.

greg0ire avatar greg0ire commented on August 15, 2024

Using dev-master, will not help, this is not merged yet. @Ocramius, https://twitter.com/greg0ire/status/1089973726429499392?s=20

from collections.

greg0ire avatar greg0ire commented on August 15, 2024

@jverdeyen it is merged now, but in the 1.6 branch.

from collections.

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.