Giter Club home page Giter Club logo

Comments (6)

samsonasik avatar samsonasik commented on June 17, 2024

I am not sure if this should be handled as that part of ArrayDimFetch definition, which by lookup of the whole class, should be used, and probably very rare of not follow the definition.

from rector.

staabm avatar staabm commented on June 17, 2024

I am not sure I got your point.

my thinking was, that getTokens() returns a native array and we can't know its key or value types. therefore I think the $activeTokens[$this->tokenid] dim fetch returns a mixed (in native type world) and therefore we have 2 property assignments in __construct. one with string and one with mixed which should lead to skipping instead of adding a type.

from rector.

samsonasik avatar samsonasik commented on June 17, 2024

The getTokens(): array define @return array<string, string> which it return typed array, so, array data should be string, yes, that can be wrong, but likely rare imo.

If that not always an array of string, the $_SESSION[self::$sessionName] can be not an array as well, so the definition should follow.

from rector.

staabm avatar staabm commented on June 17, 2024

I think the lesson learned from a year ago was, that phpdoc are oftentimes wrong and we shouldn't trust them?

from rector.

samsonasik avatar samsonasik commented on June 17, 2024

I see, but still, an array<> and array{} something that obvious, define by hand, and less copy paste error i guess, as that check by another assign and definition.

If the definition is overlapped between property and assignment, phpstan already catch early.

Yes, that's not perfect, but imo, that seems a way to make it typed.

from rector.

samsonasik avatar samsonasik commented on June 17, 2024

I am going to close it, the type is obvious looking by the whole class, with if else native data assigned.

PHP Array doesn't have native structured type, and writing correct array{} definition is another effort to be correct iterate definition in PHPStan, little wrong and it already catched by PHPStan, that after that, should be followed.

from rector.

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.