@@ -28,8 +28,8 @@ class Connection
2828 private SqlPreprocessor $ preprocessor ;
2929 private ?PDO $ pdo = null ;
3030
31- /** @var callable (array, ResultSet): array */
32- private $ rowNormalizer = [Helpers::class, ' normalizeRow ' ] ;
31+ /** @var ?\Closure (array<string, mixed>, ResultSet): array<string, mixed> */
32+ private ? \ Closure $ rowNormalizer ;
3333 private ?string $ sql = null ;
3434 private int $ transactionDepth = 0 ;
3535
@@ -42,9 +42,9 @@ public function __construct(
4242 private readonly ?string $ password = null ,
4343 private readonly array $ options = [],
4444 ) {
45- if ( !empty ($ options ['newDateTime ' ])) {
46- $ this -> rowNormalizer = fn ($ row , $ resultSet ) => Helpers::normalizeRow ($ row , $ resultSet , DateTime::class);
47- }
45+ $ this -> rowNormalizer = !empty ($ options ['newDateTime ' ])
46+ ? fn (array $ row , ResultSet $ resultSet ): array => Helpers::normalizeRow ($ row , $ resultSet , DateTime::class)
47+ : Helpers:: normalizeRow (...);
4848 if (empty ($ options ['lazy ' ])) {
4949 $ this ->connect ();
5050 }
@@ -134,7 +134,7 @@ public function getReflection(): Reflection
134134 */
135135 public function setRowNormalizer (?callable $ normalizer ): static
136136 {
137- $ this ->rowNormalizer = $ normalizer ;
137+ $ this ->rowNormalizer = $ normalizer ? $ normalizer (...) : null ;
138138 return $ this ;
139139 }
140140
0 commit comments