Git Product home page Git Product logo

Comments (4)

widoz avatar widoz commented on June 9, 2024

From the changelog

T_RETURN_TYPE Token

The T_RETURN_TYPE token has been deprecated and will be removed in version 4.

The token was used to ensure array/self/parent/callable return types were tokenized consistently. But for namespaced return types, only the last part of the string (the class name) was tokenized as T_RETURN_TYPE. This was not consistent and so return types are now left using their original token types so they are not skipped by sniffs. The exception are array return types, which are tokenized as T_STRING instead of T_ARRAY, as they are used for type hints.

Sniffs referencing this token type will continue to run without error until version 4, but will not find any T_RETUTN_TYPE tokens.

To get the return type of a function, use the File::getMethodProperties() method, which now contains a return_type array index. This index contains the return type of the function or closer, or a blank string if not specified. If the return type is nullable, the return type will contain the leading? and a nullable_return_type array index in the return value will also be set to true. If the return type contains namespace information, it will be cleaned of whitespace and comments. To access the original return value string, use the main tokens array.

I guess in this case we have not to switch to a previous version but update our sniffers.

from php-coding-standards.

Chrico avatar Chrico commented on June 9, 2024

Changed the version in current master. Will be included in next release 0.13.2

from php-coding-standards.

gmazzap avatar gmazzap commented on June 9, 2024

@Chrico this is not really "the" solution.

First of all the version requirement should not be fixed, 3.2.* is ok.1

But most importantly, if PHPCS have deprecated the argument we need to update our code to reflect that and use the new way to things.

So changing the version might be a temporary solution, but not the final one.

So this is issue need to stay open waiting for a better fix.


1 My bad, misread the diff, you're not requiring a fixed version.

from php-coding-standards.

Chrico avatar Chrico commented on June 9, 2024

That's why i just created - for now - a bugfix release, so we can continue to work without loading it by hand. It seems that Codesniffer has a breaking change in it, which we should handle to be compliant with future releases.

from php-coding-standards.

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.