@@ -30,8 +30,8 @@ class Connection
3030 private SqlPreprocessor $ preprocessor ;
3131 private ?PDO $ pdo = null ;
3232
33- /** @var callable (array, ResultSet): array */
34- private $ rowNormalizer = [Helpers::class, ' normalizeRow ' ] ;
33+ /** @var ?\Closure (array<string, mixed>, ResultSet): array<string, mixed> */
34+ private ? \ Closure $ rowNormalizer ;
3535 private ?string $ sql = null ;
3636 private int $ transactionDepth = 0 ;
3737
@@ -44,9 +44,9 @@ public function __construct(
4444 private readonly ?string $ password = null ,
4545 private readonly array $ options = [],
4646 ) {
47- if ( !empty ($ options ['newDateTime ' ])) {
48- $ this -> rowNormalizer = fn ($ row , $ resultSet ) => Helpers::normalizeRow ($ row , $ resultSet , DateTime::class);
49- }
47+ $ this -> rowNormalizer = !empty ($ options ['newDateTime ' ])
48+ ? fn (array $ row , ResultSet $ resultSet ): array => Helpers::normalizeRow ($ row , $ resultSet , DateTime::class)
49+ : Helpers:: normalizeRow (...);
5050 if (empty ($ options ['lazy ' ])) {
5151 $ this ->connect ();
5252 }
@@ -136,7 +136,7 @@ public function getReflection(): Reflection
136136 */
137137 public function setRowNormalizer (?callable $ normalizer ): static
138138 {
139- $ this ->rowNormalizer = $ normalizer ;
139+ $ this ->rowNormalizer = $ normalizer ? $ normalizer (...) : null ;
140140 return $ this ;
141141 }
142142
0 commit comments