Skip to content
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 @@ -952,7 +952,7 @@ public static function suggestType($type)
// Also allow some more characters for special type hints supported by
// PHPStan:
// https://phpstan.org/writing-php-code/phpdoc-types#basic-types .
$type = preg_replace('/[^a-zA-Z0-9_\\\[\]\-<> ,"\{\}\?\':\*\|\&]/', '', $type);
$type = preg_replace('/[^a-zA-Z0-9_\\\[\]\-<> ,"\{\}\?\':\*\|\&\(\)]/', '', $type);

return $type;

Expand Down
7 changes: 7 additions & 0 deletions tests/Drupal/Commenting/VariableCommentUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,11 @@ class Test {
// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
public string $search_score;

/**
* Allow parentheses in the type declaration.
*
* @var (\Drupal\user\UserInterface&\PHPUnit\Framework\MockObject\MockObject)|null
*/
protected $userMock;

}
7 changes: 7 additions & 0 deletions tests/Drupal/Commenting/VariableCommentUnitTest.inc.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,11 @@ class Test {
// phpcs:ignore Drupal.NamingConventions.ValidVariableName.LowerCamelName
public string $search_score;

/**
* Allow parentheses in the type declaration.
*
* @var (\Drupal\user\UserInterface&\PHPUnit\Framework\MockObject\MockObject)|null
*/
protected $userMock;

}
Loading