Comments (4)
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.
Changed the version in current master. Will be included in next release 0.13.2
from php-coding-standards.
@Chrico this is not really "the" solution.
First of all the version requirement should not be fixed, 13.2.*
is ok.
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.
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)
- [Feature Request]: Add check for Emacs UTF-8 file header HOT 1
- [Question] When using phpcbf there is a bug for the rule that leaves the first line with opening php tag HOT 3
- Review Squiz.Scope.MethodScope.Missing rule in interfaces and PhpAnnotator conflict HOT 1
- [Feature Request]: Add check for whitespace after type casting HOT 3
- [Feature Request]: Bump squizlabs/php_codesniffer HOT 1
- [Feature Request]: Add a rule against unused imports HOT 2
- [Feature Request]: Add rules for arrow functions
- [Feature Request]: Add more tests for array spread operator
- [Feature Request]: Add a sniff for unused services HOT 2
- [Feature Request]: Update dependencies to be compatible with PHP 8
- [Feature Request]: Get rid of Neutron PHP Standard
- [Feature Request]: Configure Dependabot HOT 2
- [Feature Request]: Evaluate which "Slevomat" coding standard sniffs to use HOT 2
- [Feature Request]: Embrace PHPCSUtils
- [Upgrade]: Modernize existing sniffs
- [Feature Request]: Add a sniff to enforce property type HOT 2
- [Feature Request]: Replace cyclomatic complexity with Cognitive Complexity
- Having trouble finding a working composer.json configuration HOT 1
- [Feature Request]: Enforce no spaces in array brackets
- [Feature Request]: Enforce no space after negation operator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-coding-standards.