Skip to content
Draft
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
18 changes: 0 additions & 18 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,22 @@
use Rector\CodeQuality\Rector\FuncCall\CompactToVariablesRector;
use Rector\CodeQuality\Rector\FuncCall\SortCallLikeNamedArgsRector;
use Rector\CodeQuality\Rector\Identical\StrlenZeroToIdenticalEmptyStringRector;
use Rector\CodingStyle\Rector\ArrowFunction\ArrowFunctionDelegatingCallToFirstClassCallableRector;
use Rector\CodingStyle\Rector\Closure\ClosureDelegatingCallToFirstClassCallableRector;
use Rector\CodingStyle\Rector\FuncCall\ClosureFromCallableToFirstClassCallableRector;
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
use Rector\CodingStyle\Rector\FuncCall\FunctionFirstClassCallableRector;
use Rector\Config\RectorConfig;
use Rector\Php55\Rector\Class_\ClassConstantToSelfClassRector;
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
use Rector\Php56\Rector\FuncCall\PowToExpRector;
use Rector\Php70\Rector\FuncCall\RandomFunctionRector;
use Rector\Php70\Rector\MethodCall\ThisCallOnStaticMethodToStaticCallRector;
use Rector\Php70\Rector\Ternary\TernaryToNullCoalescingRector;
use Rector\Php71\Rector\BinaryOp\BinaryOpBetweenNumberAndStringRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php80\Rector\Class_\StringableForToStringRector;
use Rector\Php80\Rector\ClassConstFetch\ClassOnThisVariableObjectRector;
use Rector\Php80\Rector\FuncCall\ClassOnObjectRector;
use Rector\Php80\Rector\Switch_\ChangeSwitchToMatchRector;
use Rector\Php80\Rector\Ternary\GetDebugTypeRector;
use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector;
use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;
use Rector\Php82\Rector\Class_\ReadOnlyClassRector;
use Rector\Php83\Rector\ClassConst\AddTypeToConstRector;
use Rector\Php83\Rector\ClassMethod\AddOverrideAttributeToOverriddenMethodsRector;
use Rector\Php83\Rector\FuncCall\DynamicClassConstFetchRector;
Expand Down Expand Up @@ -95,31 +86,22 @@
AddOverrideAttributeToOverriddenMethodsRector::class,
AddTypeToConstRector::class,
ArrayToFirstClassCallableRector::class,
ArrowFunctionDelegatingCallToFirstClassCallableRector::class,
BinaryOpBetweenNumberAndStringRector::class,
ChangeSwitchToMatchRector::class,
ClassConstantToSelfClassRector::class,
ClassOnObjectRector::class,
ClassOnThisVariableObjectRector::class,
ClassPropertyAssignToConstructorPromotionRector::class,
ClosureDelegatingCallToFirstClassCallableRector::class,
ClosureFromCallableToFirstClassCallableRector::class,
ClosureToArrowFunctionRector::class,
DeprecatedAnnotationToDeprecatedAttributeRector::class,
DynamicClassConstFetchRector::class,
FunctionFirstClassCallableRector::class,
GetDebugTypeRector::class,
NullToStrictStringFuncCallArgRector::class,
PowToExpRector::class,
RandomFunctionRector::class,
ReadOnlyClassRector::class,
ReadOnlyPropertyRector::class,
RemoveExtraParametersRector::class,
ReturnNeverTypeRector::class,
StringClassNameToClassConstantRector::class,
StringableForToStringRector::class,
TernaryToNullCoalescingRector::class,
ThisCallOnStaticMethodToStaticCallRector::class,
'tests/Foundation/fixtures/bad-syntax-strategy.php',
])
->withRules([
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Collections/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,7 @@ public function values()
*/
public function zip($items)
{
$arrayableItems = array_map(fn ($items) => $this->getArrayableItems($items), func_get_args());
$arrayableItems = array_map($this->getArrayableItems(...), func_get_args());

$params = array_merge([fn () => $this->newInstance(func_get_args()), $this->items], $arrayableItems);

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Collections/Traits/EnumeratesValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ protected function operatorForWhere($key, $operator = null, $value = null)
};
});

if (count($strings) < 2 && count(array_filter([$retrieved, $value], 'is_object')) == 1) {
if (count($strings) < 2 && count(array_filter([$retrieved, $value], is_object(...))) == 1) {
return in_array($operator, ['!=', '<>', '!==']);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ public function hasNamedScope($scope)
*/
public function callNamedScope($scope, array $parameters = [])
{
if ($this->isScopeMethodWithAttribute($scope)) {
if (static::isScopeMethodWithAttribute($scope)) {
return $this->{$scope}(...$parameters);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4566,7 +4566,7 @@ protected function forSubQuery()
public function getColumns()
{
return ! is_null($this->columns)
? array_map(fn ($column) => $this->grammar->getValue($column), $this->columns)
? array_map($this->grammar->getValue(...), $this->columns)
: [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function compileIndexHint(Builder $query, $indexHint)
{
$index = $indexHint->index;

$indexes = array_map('trim', explode(',', $index));
$indexes = array_map(trim(...), explode(',', $index));

foreach ($indexes as $i) {
if (! preg_match('/^[a-zA-Z0-9_$]+$/', $i)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Query/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ public function getOperators()
public static function customOperators(array $operators)
{
static::$customOperators = array_values(
array_merge(static::$customOperators, array_filter(array_filter($operators, 'is_string')))
array_merge(static::$customOperators, array_filter(array_filter($operators, is_string(...))))
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Client/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ protected function normalizeMultipartHeaders(array $multipart): array
protected function normalizeRequestOptionValue($value)
{
return match (true) {
is_array($value) => array_map(fn ($item) => $this->normalizeRequestOptionValue($item), $value),
is_array($value) => array_map($this->normalizeRequestOptionValue(...), $value),
$value instanceof Stringable => $value->toString(),
default => $value,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ResourceIdentificationException extends RuntimeException
*/
public static function attemptingToDetermineIdFor($resource)
{
$resourceType = is_object($resource) ? $resource::class : gettype($resource);
$resourceType = get_debug_type($resource);

return new self(sprintf(
'Unable to resolve resource object ID for [%s].', $resourceType
Expand All @@ -29,7 +29,7 @@ public static function attemptingToDetermineIdFor($resource)
*/
public static function attemptingToDetermineTypeFor($resource)
{
$resourceType = is_object($resource) ? $resource::class : gettype($resource);
$resourceType = get_debug_type($resource);

return new self(sprintf(
'Unable to resolve resource object type for [%s].', $resourceType
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/JsonSchema/Deserializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ protected function buildObject(array $schema, array $refs = []): Types\ObjectTyp

if (isset($schema['properties']) && is_array($schema['properties'])) {
$required = is_array($schema['required'] ?? null)
? array_flip(array_map('strval', $schema['required']))
? array_flip(array_map(strval(...), $schema['required']))
: [];

foreach ($schema['properties'] as $key => $definition) {
Expand Down Expand Up @@ -356,7 +356,7 @@ protected function resolveType(array $schema): array
if (is_array($type)) {
$nullable = in_array('null', $type, true);

$names = array_values(array_unique(array_map('strval', array_filter(
$names = array_values(array_unique(array_map(strval(...), array_filter(
$type,
static fn ($value) => $value !== 'null',
))));
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/JsonSchema/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function serialize(Types\Type $type): array

if ($type instanceof Types\AnyOfType) {
$attributes['anyOf'] = array_map(
static fn (Types\Type $schema) => static::serialize($schema),
static::serialize(...),
$attributes['schemas'],
);

Expand Down Expand Up @@ -80,10 +80,10 @@ public static function serialize(Types\Type $type): array
unset($attributes['properties']);
} else {
$required = array_map(
'strval',
strval(...),
array_keys(array_filter(
$attributes['properties'],
static fn (Types\Type $property) => static::isRequired($property),
static::isRequired(...),
))
);

Expand All @@ -92,7 +92,7 @@ public static function serialize(Types\Type $type): array
}

$attributes['properties'] = array_map(
static fn (Types\Type $property) => static::serialize($property),
static::serialize(...),
$attributes['properties'],
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/JsonSchema/Types/UnionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class UnionType extends Type
*/
public function __construct(array $types)
{
$names = array_map('strval', $types);
$names = array_map(strval(...), $types);

if (in_array('null', $names, true)) {
$this->nullable();
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Mail/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ protected function ensureAddressIsSafe($address)
*/
protected function ensureAddressesAreSafe(array $addresses)
{
return array_map(fn ($address) => $this->ensureAddressIsSafe($address), $addresses);
return array_map($this->ensureAddressIsSafe(...), $addresses);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/RouteSignatureParameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static function fromAction(array $action, $conditions = [])

return match (true) {
! empty($conditions['subClass']) => array_filter($parameters, fn ($p) => Reflector::isParameterSubclassOf($p, $conditions['subClass'])),
! empty($conditions['backedEnum']) => array_filter($parameters, fn ($p) => Reflector::isParameterBackedEnumWithStringBackingType($p)),
! empty($conditions['backedEnum']) => array_filter($parameters, Reflector::isParameterBackedEnumWithStringBackingType(...)),
default => $parameters,
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Routing/RouteUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ protected function getRouteQueryString(array $parameters)
*/
protected function getStringParameters(array $parameters)
{
return array_filter($parameters, 'is_string', ARRAY_FILTER_USE_KEY);
return array_filter($parameters, is_string(...), ARRAY_FILTER_USE_KEY);
}

/**
Expand All @@ -442,7 +442,7 @@ protected function getStringParameters(array $parameters)
*/
protected function getNumericParameters(array $parameters)
{
return array_filter($parameters, 'is_numeric', ARRAY_FILTER_USE_KEY);
return array_filter($parameters, is_numeric(...), ARRAY_FILTER_USE_KEY);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function to($path, $extra = [], $secure = null)
}

$tail = implode('/', array_map(
'rawurlencode', (array) $this->formatParameters($extra))
rawurlencode(...), (array) $this->formatParameters($extra))
);

// Once we have the scheme we will compile the "tail" by collapsing the values
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ protected static function summarize(int|float $number, int $precision = 0, ?int

$numberExponent = floor(log10($number));
$displayExponent = $numberExponent - ($numberExponent % 3);
$number /= pow(10, $displayExponent);
$number /= 10 ** $displayExponent;

$formatted = static::format($number, $precision, $maxPrecision);

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,7 @@ public static function studly($value, bool $normalize = false)

$words = preg_split('/\s+/u', static::replace(['-', '_'], ' ', $value), -1, PREG_SPLIT_NO_EMPTY);

$studlyWords = array_map(fn ($word) => static::ucfirst($word), $words);
$studlyWords = array_map(static::ucfirst(...), $words);

return static::$studlyCache[$key] = implode('', $studlyWords);
}
Expand Down
Loading
Loading