diff --git a/src/RowInterfaceProvider.php b/src/RowInterfaceProvider.php index 4eb3387..e0cd8cd 100644 --- a/src/RowInterfaceProvider.php +++ b/src/RowInterfaceProvider.php @@ -48,18 +48,23 @@ public function get(): QueryInterface // For development // @codeCoverageIgnoreStart } catch (SqlFileNotFoundException $e) { - try { - $named = $e->sql; - $instance = $this->injector->getInstance(RowInterface::class, $named); - error_log(sprintf('Warning: #[Sql(\'%s\')] is not vald. Change to #[\\Ray\\Di\\Di\\Named(\'%s\')]', $named, $named)); - - return $instance; - } catch (Unbound $unbound) { - throw $e; - } - // @codeCoverageIgnoreEnd + return $this->handleSqlNotFound($e); } return new SqlQueryRow($this->pdo, $sql); } + + private function handleSqlNotFound($e) + { + try { + $named = $e->sql; + $instance = $this->injector->getInstance(RowInterface::class, $named); + error_log(sprintf('Warning: #[Sql(\'%s\')] is not vald. Change to #[\\Ray\\Di\\Di\\Named(\'%s\')]', $named, $named)); + + return $instance; + } catch (Unbound $unbound) { + throw $e; + } + // @codeCoverageIgnoreEnd + } }