Skip to content

Commit 3d60ca8

Browse files
committed
📦 Use native union type for parameter
1 parent 0c522c1 commit 3d60ca8

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

src/ClientFactory/PluginClientFactory.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@
1919
final class PluginClientFactory
2020
{
2121
/**
22-
* @param Plugin[] $plugins
23-
* @param ClientFactory|callable $factory
24-
* @param array $config config to the client factory
25-
* @param array $pluginClientOptions config forwarded to the PluginClient
22+
* @param Plugin[] $plugins
23+
* @param array $config config to the client factory
24+
* @param array $pluginClientOptions config forwarded to the PluginClient
2625
*
2726
* @return PluginClient
2827
*/
29-
public static function createPluginClient(array $plugins, $factory, array $config, array $pluginClientOptions = [])
28+
public static function createPluginClient(array $plugins, ClientFactory|callable $factory, array $config, array $pluginClientOptions = [])
3029
{
3130
if ($factory instanceof ClientFactory) {
3231
$client = $factory->createClient($config);

src/Collector/ProfileClientFactory.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,12 @@ class ProfileClientFactory implements ClientFactory
2424
*/
2525
private $factory;
2626

27-
/**
28-
* @param ClientFactory|callable $factory
29-
*/
3027
public function __construct(
31-
$factory,
28+
ClientFactory|callable $factory,
3229
private readonly Collector $collector,
3330
private readonly Formatter $formatter,
3431
private readonly Stopwatch $stopwatch
3532
) {
36-
if (!$factory instanceof ClientFactory && !is_callable($factory)) {
37-
throw new \RuntimeException(sprintf('First argument to ProfileClientFactory::__construct must be a "%s" or a callable.', ClientFactory::class));
38-
}
3933
$this->factory = $factory;
4034
}
4135

0 commit comments

Comments
 (0)