Loading coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php +2 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,8 @@ class FunctionCommentSniff implements Sniff && $typeHint !== '\stdClass' // As of PHP 7.2, object is a valid type hint. && $typeHint !== 'object' // As of PHP 8.0, mixed is a valid type hint. && $typeHint !== 'mixed' ) { $error = 'Unknown type hint "%s" found for %s'; $data = [ Loading tests/Drupal/Commenting/FunctionCommentUnitTest.inc +10 −0 Original line number Diff line number Diff line Loading @@ -516,3 +516,13 @@ function test37(array $matches, array $sub_key, $to) { function test38($a, $b) { yield from [$a, $b]; } /** * Allow "mixed" as real type hint (PHP 8.0). * * @param mixed $arg * Something here. */ function test39(mixed $arg) { return $arg; } tests/Drupal/Commenting/FunctionCommentUnitTest.inc.fixed +10 −0 Original line number Diff line number Diff line Loading @@ -542,3 +542,13 @@ function test37(array $matches, array $sub_key, $to) { function test38($a, $b) { yield from [$a, $b]; } /** * Allow "mixed" as real type hint (PHP 8.0). * * @param mixed $arg * Something here. */ function test39(mixed $arg) { return $arg; } Loading
coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php +2 −0 Original line number Diff line number Diff line Loading @@ -780,6 +780,8 @@ class FunctionCommentSniff implements Sniff && $typeHint !== '\stdClass' // As of PHP 7.2, object is a valid type hint. && $typeHint !== 'object' // As of PHP 8.0, mixed is a valid type hint. && $typeHint !== 'mixed' ) { $error = 'Unknown type hint "%s" found for %s'; $data = [ Loading
tests/Drupal/Commenting/FunctionCommentUnitTest.inc +10 −0 Original line number Diff line number Diff line Loading @@ -516,3 +516,13 @@ function test37(array $matches, array $sub_key, $to) { function test38($a, $b) { yield from [$a, $b]; } /** * Allow "mixed" as real type hint (PHP 8.0). * * @param mixed $arg * Something here. */ function test39(mixed $arg) { return $arg; }
tests/Drupal/Commenting/FunctionCommentUnitTest.inc.fixed +10 −0 Original line number Diff line number Diff line Loading @@ -542,3 +542,13 @@ function test37(array $matches, array $sub_key, $to) { function test38($a, $b) { yield from [$a, $b]; } /** * Allow "mixed" as real type hint (PHP 8.0). * * @param mixed $arg * Something here. */ function test39(mixed $arg) { return $arg; }