1818use Cake \Database \Exception ;
1919use Cake \Database \Schema \BaseSchema ;
2020use Cake \Database \Schema \Table ;
21+ use Cake \Database \Schema \TableSchema ;
22+
2123/**
2224 * Schema generation/reflection features for Firebird
2325 * Commands taken from http://www.alberton.info/firebird_sql_meta_info.html#.Vvv5wSbRJQt
@@ -28,7 +30,7 @@ class FirebirdSchema extends BaseSchema
2830 /**
2931 * {@inheritDoc}
3032 */
31- public function listTablesSql ($ config )
33+ public function listTablesSql (array $ config ): array
3234 {
3335 return [
3436 'SELECT RDB$RELATION_NAME
@@ -41,7 +43,7 @@ public function listTablesSql($config)
4143 /**
4244 * {@inheritDoc}
4345 */
44- public function describeColumnSql ($ tableName , $ config )
46+ public function describeColumnSql (string $ tableName , array $ config ): array
4547 {
4648 return ['SELECT trim(LOWER(r.RDB$FIELD_NAME)) AS FIELD_NAME,
4749 CASE f.RDB$FIELD_TYPE
@@ -85,7 +87,7 @@ public function describeColumnSql($tableName, $config)
8587 /**
8688 * {@inheritDoc}
8789 */
88- public function describeIndexSql ($ tableName , $ config )
90+ public function describeIndexSql (string $ tableName , array $ config ): array
8991 {
9092 return [
9193 'SELECT TRIM(i.RDB$INDEX_NAME) AS INDEX_NAME,
@@ -197,7 +199,7 @@ protected function _convertColumn($column)
197199 /**
198200 * {@inheritDoc}
199201 */
200- public function convertColumnDescription (Table $ table , $ row )
202+ public function convertColumnDescription (TableSchema $ table , array $ row ): void
201203 {
202204 $ field = $ this ->_convertColumn ($ row ['FIELD_TYPE ' ]);
203205 $ field += [
@@ -215,18 +217,18 @@ public function convertColumnDescription(Table $table, $row)
215217 /**
216218 * {@inheritDoc}
217219 */
218- public function convertIndexDescription (Table $ table , $ row )
220+ public function convertIndexDescription (TableSchema $ table , array $ row ): void
219221 {
220222 $ type = null ;
221223 $ columns = $ length = [];
222224
223225 if ($ row ['IS_PRIMARY_KEY ' ] == '1 ' ) {
224- $ name = $ type = Table ::CONSTRAINT_PRIMARY ;
226+ $ name = $ type = TableSchema ::CONSTRAINT_PRIMARY ;
225227 }
226228
227229 $ columns [] = trim ($ row ['COLUMN_NAME ' ]);
228230
229- if ($ type === Table ::CONSTRAINT_PRIMARY || $ type === Table ::CONSTRAINT_UNIQUE ) {
231+ if ($ type === TableSchema ::CONSTRAINT_PRIMARY || $ type === TableSchema ::CONSTRAINT_UNIQUE ) {
230232 $ table ->addConstraint ($ name , [
231233 'type ' => $ type ,
232234 'columns ' => $ columns
@@ -238,7 +240,7 @@ public function convertIndexDescription(Table $table, $row)
238240 /**
239241 * {@inheritDoc}
240242 */
241- public function describeForeignKeySql ($ tableName , $ config )
243+ public function describeForeignKeySql (string $ tableName , array $ config ): array
242244 {
243245 return ['SELECT DISTINCT
244246 LOWER(rc.RDB$CONSTRAINT_NAME) AS "CONSTRAINT_NAME",
@@ -263,10 +265,10 @@ public function describeForeignKeySql($tableName, $config)
263265 /**
264266 * {@inheritDoc}
265267 */
266- public function convertForeignKeyDescription (Table $ table , $ row )
268+ public function convertForeignKeyDescription (TableSchema $ table , $ row ): void
267269 {
268270 $ data = [
269- 'type ' => Table ::CONSTRAINT_FOREIGN ,
271+ 'type ' => TableSchema ::CONSTRAINT_FOREIGN ,
270272 'columns ' => [trim ($ row ['COLUMN_NAME ' ])],
271273 'references ' => [trim ($ row ['REFERENCED_TABLE_NAME ' ]), trim ($ row ['REFERENCED_COLUMN_NAME ' ])],
272274 'update ' => $ this ->_convertOnClause (trim ($ row ['UPDATE_RULE ' ])),
@@ -279,7 +281,7 @@ public function convertForeignKeyDescription(Table $table, $row)
279281 /**
280282 * {@inheritDoc}
281283 */
282- public function truncateTableSql (Table $ table )
284+ public function truncateTableSql (TableSchema $ table ): array
283285 {
284286 $ sql = sprintf ("DELETE FROM %s " , strtoupper ($ table ->name ()));
285287 return [$ sql ];
@@ -288,7 +290,7 @@ public function truncateTableSql(Table $table)
288290 /**
289291 * {@inheritDoc}
290292 */
291- public function columnSql (Table $ table , $ name )
293+ public function columnSql (TableSchema $ table , string $ name ): string
292294 {
293295 $ data = $ table ->getColumn ($ name );
294296 $ out = $ this ->_driver ->quoteIdentifier ($ name );
@@ -367,7 +369,7 @@ public function columnSql(Table $table, $name)
367369
368370 /**
369371 */
370- public function createTableSql (Table $ table , $ columns , $ constraints , $ indexes )
372+ public function createTableSql (TableSchema $ table , $ columns , $ constraints , $ indexes ): array
371373 {
372374 $ content = array_merge ($ columns , $ constraints );
373375 $ content = implode (", \n" , array_filter ($ content ));
@@ -383,10 +385,10 @@ public function createTableSql(Table $table, $columns, $constraints, $indexes)
383385 /**
384386 * {@inheritDoc}
385387 */
386- public function constraintSql (Table $ table , $ name )
388+ public function constraintSql (TableSchema $ table , string $ name ): string
387389 {
388390 $ data = $ table ->getConstraint ($ name );
389- if ($ data ['type ' ] === Table ::CONSTRAINT_PRIMARY ) {
391+ if ($ data ['type ' ] === TableSchema ::CONSTRAINT_PRIMARY ) {
390392 return sprintf ('CONSTRAINT pk_%s_0 PRIMARY KEY ("%s") ' , $ table ->name (), implode (', ' , $ data ['columns ' ]));
391393 }
392394
@@ -397,7 +399,7 @@ public function constraintSql(Table $table, $name)
397399 * @param Table $table
398400 * @return array
399401 */
400- public function dropTableSql (Table $ table )
402+ public function dropTableSql (TableSchema $ table ): array
401403 {
402404 $ sql = sprintf (
403405 'DROP TABLE %s ' ,
@@ -411,23 +413,23 @@ public function dropTableSql(Table $table)
411413 /**
412414 * {@inheritDoc}
413415 */
414- public function addConstraintSql (Table $ table )
416+ public function addConstraintSql (TableSchema $ table ) : array
415417 {
416418 return false ;
417419 }
418420
419421 /**
420422 * {@inheritDoc}
421423 */
422- public function dropConstraintSql (Table $ table )
424+ public function dropConstraintSql (TableSchema $ table ): array
423425 {
424426 return false ;
425427 }
426428
427429 /**
428430 * {@inheritDoc}
429431 */
430- public function indexSql (Table $ table , $ name )
432+ public function indexSql (TableSchema $ table , string $ name ): string
431433 {
432434 return false ;
433435 }
@@ -439,7 +441,7 @@ public function indexSql(Table $table, $name)
439441 * @param array $data Key data.
440442 * @return string
441443 */
442- protected function _keySql ($ prefix , $ data )
444+ protected function _keySql ($ prefix , $ data ): string | false
443445 {
444446 return false ;
445447 }
0 commit comments