File tree 2 files changed +4
-8
lines changed
2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change 8
8
` DbArrayHelper::populate() ` methods to ` array[] ` (@vjik )
9
9
- Enh #779 : Specify populate closure type in ` BatchQueryResultInterface ` (@vjik )
10
10
- Enh #778 : Deprecate unnecessary argument ` $rawSql ` of ` AbstractCommand::internalExecute() ` (@Tigrov )
11
+ - Enh #786 : Refactor ` AbstractSchema::getDataType() ` (@Tigrov )
11
12
- Enh #784 : Specify result type of ` ConstraintSchemaInterface::getTableIndexes() ` method to ` IndexConstraint[] ` (@vjik )
12
13
- Enh #784 : Remove unused code in ` AbstractSchema::getTableIndexes() ` (@vjik )
13
14
Original file line number Diff line number Diff line change @@ -134,19 +134,14 @@ public function getDefaultSchema(): string|null
134
134
135
135
public function getDataType (mixed $ data ): int
136
136
{
137
- /** @psalm-var array<string, int> $typeMap */
138
- $ typeMap = [
137
+ return match (gettype ($ data )) {
139
138
// php type => SQL data type
140
139
SchemaInterface::PHP_TYPE_BOOLEAN => DataType::BOOLEAN ,
141
140
SchemaInterface::PHP_TYPE_INTEGER => DataType::INTEGER ,
142
- SchemaInterface::PHP_TYPE_STRING => DataType::STRING ,
143
141
SchemaInterface::PHP_TYPE_RESOURCE => DataType::LOB ,
144
142
SchemaInterface::PHP_TYPE_NULL => DataType::NULL ,
145
- ];
146
-
147
- $ type = gettype ($ data );
148
-
149
- return $ typeMap [$ type ] ?? DataType::STRING ;
143
+ default => DataType::STRING ,
144
+ };
150
145
}
151
146
152
147
public function getRawTableName (string $ name ): string
You can’t perform that action at this time.
0 commit comments