Skip to content

Commit

Permalink
Use short array deconstruction syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabus committed Oct 28, 2020
1 parent 363cca0 commit b0887cf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions DebugClassLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
$hasCall = $refl->hasMethod('__call');
$hasStaticCall = $refl->hasMethod('__callStatic');
foreach (self::$method[$use] as $method) {
list($interface, $name, $static, $description) = $method;
[$interface, $name, $static, $description] = $method;
if ($static ? $hasStaticCall : $hasCall) {
continue;
}
Expand Down Expand Up @@ -556,12 +556,12 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
}

if ($parent && isset(self::$finalMethods[$parent][$method->name])) {
list($declaringClass, $message) = self::$finalMethods[$parent][$method->name];
[$declaringClass, $message] = self::$finalMethods[$parent][$method->name];
$deprecations[] = sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $className);
}

if (isset(self::$internalMethods[$class][$method->name])) {
list($declaringClass, $message) = self::$internalMethods[$class][$method->name];
[$declaringClass, $message] = self::$internalMethods[$class][$method->name];
if (strncmp($ns, $declaringClass, $len)) {
$deprecations[] = sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $className);
}
Expand Down Expand Up @@ -601,7 +601,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
}

if (null !== ($returnType = self::$returnTypes[$class][$method->name] ?? self::MAGIC_METHODS[$method->name] ?? null) && !$method->hasReturnType() && !($doc && preg_match('/\n\s+\* @return +(\S+)/', $doc))) {
list($normalizedType, $returnType, $declaringClass, $declaringFile) = \is_string($returnType) ? [$returnType, $returnType, '', ''] : $returnType;
[$normalizedType, $returnType, $declaringClass, $declaringFile] = \is_string($returnType) ? [$returnType, $returnType, '', ''] : $returnType;

if ('void' === $normalizedType) {
$canAddReturnType = false;
Expand Down Expand Up @@ -669,7 +669,7 @@ public function checkAnnotations(\ReflectionClass $refl, string $class): array
$definedParameters[$parameter->name] = true;
}
}
foreach ($matches as list(, $parameterType, $parameterName)) {
foreach ($matches as [, $parameterType, $parameterName]) {
if (!isset($definedParameters[$parameterName])) {
$parameterType = trim($parameterType);
self::$annotatedParameters[$class][$method->name][$parameterName] = sprintf('The "%%s::%s()" method will require a new "%s$%s" argument in the next major version of its %s "%s", not defining it is deprecated.', $method->name, $parameterType ? $parameterType.' ' : '', $parameterName, interface_exists($className) ? 'interface' : 'parent class', $className);
Expand Down Expand Up @@ -940,10 +940,10 @@ private function patchMethod(\ReflectionMethod $method, string $returnType, stri
continue;
}

list($namespace, $useOffset, $useMap) = $useStatements[$file] ?? $useStatements[$file] = self::getUseStatements($file);
[$namespace, $useOffset, $useMap] = $useStatements[$file] ?? $useStatements[$file] = self::getUseStatements($file);

if ('\\' !== $type[0]) {
list($declaringNamespace, , $declaringUseMap) = $useStatements[$declaringFile] ?? $useStatements[$declaringFile] = self::getUseStatements($declaringFile);
[$declaringNamespace, , $declaringUseMap] = $useStatements[$declaringFile] ?? $useStatements[$declaringFile] = self::getUseStatements($declaringFile);

$p = strpos($type, '\\', 1);
$alias = $p ? substr($type, 0, $p) : $type;
Expand Down

0 comments on commit b0887cf

Please sign in to comment.