mirror of
https://github.com/pestphp/pest.git
synced 2026-03-09 09:17:23 +01:00
chore: code refactor
This commit is contained in:
@ -50,7 +50,7 @@ final class HigherOrderMessage
|
||||
}
|
||||
|
||||
if ($this->hasHigherOrderCallable()) {
|
||||
return (new HigherOrderCallables($target))->{$this->name}(...$this->arguments);
|
||||
return new HigherOrderCallables($target)->{$this->name}(...$this->arguments);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@ -31,7 +31,7 @@ final class HigherOrderMessageCollection
|
||||
*/
|
||||
public function addWhen(callable $condition, string $filename, int $line, string $name, ?array $arguments): void
|
||||
{
|
||||
$this->messages[] = (new HigherOrderMessage($filename, $line, $name, $arguments))->when($condition);
|
||||
$this->messages[] = new HigherOrderMessage($filename, $line, $name, $arguments)->when($condition);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -38,7 +38,7 @@ final class HigherOrderTapProxy
|
||||
return $this->target->{$property};
|
||||
}
|
||||
|
||||
$className = (new ReflectionClass($this->target))->getName();
|
||||
$className = new ReflectionClass($this->target)->getName();
|
||||
|
||||
if (str_starts_with($className, 'P\\')) {
|
||||
$className = substr($className, 2);
|
||||
@ -60,7 +60,7 @@ final class HigherOrderTapProxy
|
||||
$filename = Backtrace::file();
|
||||
$line = Backtrace::line();
|
||||
|
||||
return (new HigherOrderMessage($filename, $line, $methodName, $arguments))
|
||||
return new HigherOrderMessage($filename, $line, $methodName, $arguments)
|
||||
->call($this->target);
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ final class Reflection
|
||||
*/
|
||||
public static function getFunctionArguments(Closure $function): array
|
||||
{
|
||||
$parameters = (new ReflectionFunction($function))->getParameters();
|
||||
$parameters = new ReflectionFunction($function)->getParameters();
|
||||
$arguments = [];
|
||||
|
||||
foreach ($parameters as $parameter) {
|
||||
@ -206,7 +206,7 @@ final class Reflection
|
||||
|
||||
public static function getFunctionVariable(Closure $function, string $key): mixed
|
||||
{
|
||||
return (new ReflectionFunction($function))->getStaticVariables()[$key] ?? null;
|
||||
return new ReflectionFunction($function)->getStaticVariables()[$key] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user