Skip to content
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

PHP 8.2 | Squiz/VariableComment: allow for stand-alone null/true/false types and more #211

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
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,15 @@ public function processMemberVar(File $phpcsFile, $stackPtr)
T_WHITESPACE => T_WHITESPACE,
T_STRING => T_STRING,
T_NS_SEPARATOR => T_NS_SEPARATOR,
T_NAMESPACE => T_NAMESPACE,
T_NULLABLE => T_NULLABLE,
T_TYPE_UNION => T_TYPE_UNION,
T_TYPE_INTERSECTION => T_TYPE_INTERSECTION,
T_NULL => T_NULL,
T_TRUE => T_TRUE,
T_FALSE => T_FALSE,
T_SELF => T_SELF,
T_PARENT => T_PARENT,
];

for ($commentEnd = ($stackPtr - 1); $commentEnd >= 0; $commentEnd--) {
Expand Down
36 changes: 36 additions & 0 deletions src/Standards/Squiz/Tests/Commenting/VariableCommentUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,39 @@ class IntersectionTypes
*/
private \Iterator&\Countable $variableName;
}

class StandaloneNullTrueFalseTypes
{
/**
* @var null
*/
public null $variableName = null;

/**
* @var true
*/
protected true $variableName = true;

/**
* @var false
*/
private false $variableName = false;
}

class MoreMissingButSupportedTypes
{
/**
* @var parent
*/
public parent $variableName;

/**
* @var self
*/
protected self $variableName;

/**
* @var SomeClass
*/
private namespace\SomeClass $variableName;
}
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,39 @@ class IntersectionTypes
*/
private \Iterator&\Countable $variableName;
}

class StandaloneNullTrueFalseTypes
{
/**
* @var null
*/
public null $variableName = null;

/**
* @var true
*/
protected true $variableName = true;

/**
* @var false
*/
private false $variableName = false;
}

class MoreMissingButSupportedTypes
{
/**
* @var parent
*/
public parent $variableName;

/**
* @var self
*/
protected self $variableName;

/**
* @var SomeClass
*/
private namespace\SomeClass $variableName;
}