Unverified Commit 2daf0c29 authored by Mitch Portier's avatar Mitch Portier Committed by GitHub
Browse files

fix(FunctionComment): Add support for the "mixed" type (#3221889 by Arkener,...

fix(FunctionComment): Add support for the "mixed" type (#3221889 by Arkener, nils.destoop, srilakshmier)
parent f1d92858
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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  = [
+10 −0
Original line number Diff line number Diff line
@@ -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;
}
+10 −0
Original line number Diff line number Diff line
@@ -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;
}