Skip to content

PHP 8.2 | Generic/[Lower|Upper]CaseConstant: bug fix - ignore DNF property types #934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/Standards/Generic/Sniffs/PHP/LowerCaseConstantSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,23 @@ class LowerCaseConstantSniff implements Sniff
* @var array<int|string, int|string>
*/
private $propertyTypeTokens = [
T_CALLABLE => T_CALLABLE,
T_SELF => T_SELF,
T_PARENT => T_PARENT,
T_FALSE => T_FALSE,
T_TRUE => T_TRUE,
T_NULL => T_NULL,
T_STRING => T_STRING,
T_NAME_QUALIFIED => T_NAME_QUALIFIED,
T_NAME_FULLY_QUALIFIED => T_NAME_FULLY_QUALIFIED,
T_NAME_RELATIVE => T_NAME_RELATIVE,
T_NS_SEPARATOR => T_NS_SEPARATOR,
T_NAMESPACE => T_NAMESPACE,
T_TYPE_UNION => T_TYPE_UNION,
T_TYPE_INTERSECTION => T_TYPE_INTERSECTION,
T_NULLABLE => T_NULLABLE,
T_CALLABLE => T_CALLABLE,
T_SELF => T_SELF,
T_PARENT => T_PARENT,
T_FALSE => T_FALSE,
T_TRUE => T_TRUE,
T_NULL => T_NULL,
T_STRING => T_STRING,
T_NAME_QUALIFIED => T_NAME_QUALIFIED,
T_NAME_FULLY_QUALIFIED => T_NAME_FULLY_QUALIFIED,
T_NAME_RELATIVE => T_NAME_RELATIVE,
T_NS_SEPARATOR => T_NS_SEPARATOR,
T_NAMESPACE => T_NAMESPACE,
T_TYPE_UNION => T_TYPE_UNION,
T_TYPE_INTERSECTION => T_TYPE_INTERSECTION,
T_TYPE_OPEN_PARENTHESIS => T_TYPE_OPEN_PARENTHESIS,
T_TYPE_CLOSE_PARENTHESIS => T_TYPE_CLOSE_PARENTHESIS,
T_NULLABLE => T_NULLABLE,
];


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,7 @@ class TypedConstants {

// Global constants can not be typed.
const MYCONST = TRUE;

class SkipOverPHP82DNFTypes {
protected (\FullyQualified&Partially\Qualified)|TRUE $propertyC;
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,7 @@ class TypedConstants {

// Global constants can not be typed.
const MYCONST = true;

class SkipOverPHP82DNFTypes {
protected (\FullyQualified&Partially\Qualified)|TRUE $propertyC;
}
4 changes: 4 additions & 0 deletions src/Standards/Generic/Tests/PHP/UpperCaseConstantUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ class TypedThings {
}

$cl = function (int|false $param = null, Type|null $obj = new MyObj(false)) : string|false|null {};

class SkipOverPHP82DNFTypes {
protected (\FullyQualified&Partially\Qualified)|false $propertyC;
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ class TypedThings {
}

$cl = function (int|false $param = NULL, Type|null $obj = new MyObj(FALSE)) : string|false|null {};

class SkipOverPHP82DNFTypes {
protected (\FullyQualified&Partially\Qualified)|false $propertyC;
}