Skip to content

Commit

Permalink
Use PluginManager::build() instead of get in order to support constru…
Browse files Browse the repository at this point in the history
…ctor options via `InvokableFactory`

Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jun 19, 2024
1 parent 3c4a814 commit f2bd3af
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Explode.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function setValidator($validator)
$name = $validator['name'];
$options = $validator['options'] ?? [];
/** @psalm-suppress MixedAssignment $validator */
$validator = $this->getValidatorPluginManager()->get($name, $options);
$validator = $this->getValidatorPluginManager()->build($name, $options);
}

if (! $validator instanceof ValidatorInterface) {
Expand Down
2 changes: 1 addition & 1 deletion src/StaticValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function execute(mixed $value, $classBaseName, array $options = []
}

$plugins = static::getPluginManager();
$validator = $plugins->get($classBaseName, $options);
$validator = $plugins->build($classBaseName, $options);

return $validator->isValid($value);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ValidatorChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function setPluginManager(ValidatorPluginManager $plugins)
public function plugin($name, ?array $options = null)
{
$plugins = $this->getPluginManager();
return $plugins->get($name, $options);
return $plugins->build($name, $options);
}

/**
Expand Down

0 comments on commit f2bd3af

Please sign in to comment.