Summary
QuantumManager::driverAlias(string|UnitEnum|null $driver) already centralizes "resolve $driver to a string, falling back to getDefaultDriver() when null, and unwrapping enums" (src/QuantumManager.php:52-61), and is used by driver() for exactly this purpose. circuit(?string $driver = null) and batch(array $circuits, ?string $driver = null) each independently re-implement the null-fallback half of that same logic inline as $driver ?? $this->getDefaultDriver(), rather than delegating to driverAlias().
Where
src/QuantumManager.php:52-61 (driverAlias() — the existing centralized logic)
src/QuantumManager.php:69-75 (circuit() — line 74: $driver ?? $this->getDefaultDriver())
src/QuantumManager.php:80-89 (batch() — line 87: $driver ?? $this->getDefaultDriver())
Note: because circuit()/batch() type their own $driver parameter as ?string (not string|UnitEnum|null like driver()'s), the enum-unwrapping half of driverAlias() is not reachable through these two methods today — only the null-coalescing half is actually duplicated.
Refactor proposal
Have circuit() and batch() call $this->driverAlias($driver) instead of repeating $driver ?? $this->getDefaultDriver() inline, so there is exactly one place that knows how an absent driver name resolves to the default.
Severity: low
Summary
QuantumManager::driverAlias(string|UnitEnum|null $driver)already centralizes "resolve$driverto a string, falling back togetDefaultDriver()when null, and unwrapping enums" (src/QuantumManager.php:52-61), and is used bydriver()for exactly this purpose.circuit(?string $driver = null)andbatch(array $circuits, ?string $driver = null)each independently re-implement the null-fallback half of that same logic inline as$driver ?? $this->getDefaultDriver(), rather than delegating todriverAlias().Where
src/QuantumManager.php:52-61(driverAlias()— the existing centralized logic)src/QuantumManager.php:69-75(circuit()— line 74:$driver ?? $this->getDefaultDriver())src/QuantumManager.php:80-89(batch()— line 87:$driver ?? $this->getDefaultDriver())Note: because
circuit()/batch()type their own$driverparameter as?string(notstring|UnitEnum|nulllikedriver()'s), the enum-unwrapping half ofdriverAlias()is not reachable through these two methods today — only the null-coalescing half is actually duplicated.Refactor proposal
Have
circuit()andbatch()call$this->driverAlias($driver)instead of repeating$driver ?? $this->getDefaultDriver()inline, so there is exactly one place that knows how an absent driver name resolves to the default.Severity: low