Giter Club home page Giter Club logo

Comments (4)

azjezz avatar azjezz commented on May 22, 2024

back to vimeo/psalm#4145 😛

the issue here is that we can't declare Type::assert/Type::coerce as "pure", because not all implementations are pure ( for example IterableType::assert iterates over an iterable, which might not be immutable ).

so i suggest you add @psalm-suppress here.

from psl.

azjezz avatar azjezz commented on May 22, 2024

Also, i attempted to improve this by having the psalm plugin report the call as pure if the argument is pure/immutable, but that is not possible via the plugin system, and it seems psalm have a special case for internal php functions ( e.g: https://github.com/vimeo/psalm/blob/bd6efd7cf2b7e6fdf01b343be0c5bbb9aacdbbbb/src/Psalm/Internal/Codebase/Functions.php#L499 )

from psl.

Ocramius avatar Ocramius commented on May 22, 2024

Wow that's ugly :D

Guess we'll have to improve upstream before being able to declare it here: still like vimeo/psalm#4145 as an idea, but hard to bring it to life :-\

from psl.

azjezz avatar azjezz commented on May 22, 2024

yea, i will trying to play around with psalm to see if i can make it possible to have special "purity checkers" for function/method calls, this will allow to mark things like Type\string()->assert() pure without the need for vimeo/psalm#4145 using the plugin

from psl.

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.