Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit de50618

Browse files
committedJan 9, 2024
typos
1 parent 068663b commit de50618

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed
 

‎src/Processors/Traits/ProcessorTrait.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Chevere\VarDump\Interfaces\VarDumperInterface;
1818
use InvalidArgumentException;
1919
use function Chevere\Message\message;
20+
use function Chevere\Parameter\getType;
2021

2122
trait ProcessorTrait
2223
{
@@ -64,16 +65,20 @@ public function maxDepthReached(): string
6465
private function assertType(): void
6566
{
6667
$type = new Type($this->type());
67-
if (! $type->validate($this->varDumper->dumpable()->var())) {
68-
throw new InvalidArgumentException(
69-
(string) message(
70-
'Instance of `%className%` expects a type `%expected%` for the return value of `%method%`, type `%provided%` returned',
71-
className: static::class,
72-
expected: $this->type(),
73-
method: $this->varDumper::class . '::var()',
74-
provided: get_debug_type($this->varDumper->dumpable()->var()),
75-
)
76-
);
68+
if ($type->validate($this->varDumper->dumpable()->var())) {
69+
return;
7770
}
71+
$provided = getType($this->varDumper->dumpable()->var());
72+
$method = $this->varDumper::class . '::var()';
73+
74+
throw new InvalidArgumentException(
75+
(string) message(
76+
'Instance of `%className%` expects type `%expected%` for the return value of `%method%`, type `%provided%` returned',
77+
className: static::class,
78+
expected: $this->type(),
79+
method: $method,
80+
provided: $provided,
81+
)
82+
);
7883
}
7984
}

0 commit comments

Comments
 (0)
Please sign in to comment.