You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now they will be tokenized as one T_RETURN_TYPE token.
Also, the getMethodProperties() method will now return information on the return type.
Based on the existing unit tests, this following sniffs will need adjusting:
NewNullableTypes (test 10 / line 77)
ForbiddenClosureUseVariableNames (now throws an undefined offset on line 125 of the sniff)
Until those adjustments have been made, the builds will be broken.
Other than that, I think it would be prudent to review the following sniffs as I would have expected something to break there too, so those sniffs may need improvements anyway to also look at return type declarations or they may already have been set up in such a way that all is well:
ForbiddenNames (all three)
InternalInterfaces
NewClasses
NewInterfaces
NewLanguageConstructs (ns separator detection in type declarations)
NewReturnTypeDeclarations
If no improvements are needed for these sniffs, at the very least we need to make sure that return type declarations are covered in the unit tests for these sniffs.
Since I posted this, this change has been reverted and the T_RETURN_TYPE and T_ARRAY_HINT have been completely deprecated (to be removed in v 4.0).
So, while the actual change is now different, the principle of the issue still stands: we need to check whether any adjustments need to be made in PHPCompatibility to deal with these tokenizer changes.
More info in the upstream issue (referenced above).
Note to self: review the methods in the PHPCSHelper class to see if any of them may also need adjusting/updating.
PHPCS 3.3.0 will change the way class based return type declarations are tokenized.
Previously, a class based return type was tokenized as:
ClassName
=>T_STRING
NSName\NSSubName\ClassName
=>T_STRING
+T_NS_SEPARATOR
+T_STRING
+T_NS_SEPARATOR
+T_STRING
Now they will be tokenized as one
T_RETURN_TYPE
token.Also, the
getMethodProperties()
method will now return information on the return type.Based on the existing unit tests, this following sniffs will need adjusting:
NewNullableTypes
(test 10 / line 77)ForbiddenClosureUseVariableNames
(now throws anundefined offset
on line 125 of the sniff)Until those adjustments have been made, the builds will be broken.
Other than that, I think it would be prudent to review the following sniffs as I would have expected something to break there too, so those sniffs may need improvements anyway to also look at return type declarations or they may already have been set up in such a way that all is well:
ForbiddenNames
(all three)InternalInterfaces
NewClasses
NewInterfaces
NewLanguageConstructs
(ns separator detection in type declarations)NewReturnTypeDeclarations
If no improvements are needed for these sniffs, at the very least we need to make sure that return type declarations are covered in the unit tests for these sniffs.
Refs:
The text was updated successfully, but these errors were encountered: