Skip to content

Commit 402bbe9

Browse files
authored
refactor: fix missingType.return errors in system files (#9530)
1 parent bbb65b0 commit 402bbe9

33 files changed

+196
-403
lines changed

system/CodeIgniter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,9 @@ protected function display404errors(PageNotFoundException $e)
948948
$this->response->setStatusCode($e->getCode());
949949

950950
// Is there a 404 Override available?
951-
if ($override = $this->router->get404Override()) {
951+
$override = $this->router->get404Override();
952+
953+
if ($override !== null) {
952954
$returned = null;
953955

954956
if ($override instanceof Closure) {

system/ComposerScripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ final class ComposerScripts
6767
* This static method is called by Composer after every update event,
6868
* i.e., `composer install`, `composer update`, `composer remove`.
6969
*/
70-
public static function postUpdate()
70+
public static function postUpdate(): void
7171
{
7272
self::recursiveDelete(self::$path);
7373

system/Database/BaseBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3380,6 +3380,8 @@ public function resetQuery()
33803380
* Resets the query builder values. Called by the get() function
33813381
*
33823382
* @param array $qbResetItems An array of fields to reset
3383+
*
3384+
* @return void
33833385
*/
33843386
protected function resetRun(array $qbResetItems)
33853387
{
@@ -3390,6 +3392,8 @@ protected function resetRun(array $qbResetItems)
33903392

33913393
/**
33923394
* Resets the query builder values. Called by the get() function
3395+
*
3396+
* @return void
33933397
*/
33943398
protected function resetSelect()
33953399
{
@@ -3421,6 +3425,8 @@ protected function resetSelect()
34213425
* Resets the query builder "write" values.
34223426
*
34233427
* Called by the insert() update() insertBatch() updateBatch() and delete() functions
3428+
*
3429+
* @return void
34243430
*/
34253431
protected function resetWrite()
34263432
{

system/Database/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
use Config\Database as DbConfig;
1919

2020
/**
21-
* Class Config
22-
*
2321
* @see \CodeIgniter\Database\ConfigTest
2422
*/
2523
class Config extends BaseConfig
@@ -141,6 +139,8 @@ public static function seeder(?string $group = null)
141139

142140
/**
143141
* Ensures the database Connection Manager/Factory is loaded and ready to use.
142+
*
143+
* @return void
144144
*/
145145
protected static function ensureFactory()
146146
{

system/Database/Exceptions/DataException.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,33 @@ public static function forInvalidArgument(string $argument)
6565
return new static(lang('Database.invalidArgument', [$argument]));
6666
}
6767

68+
/**
69+
* @return DataException
70+
*/
6871
public static function forInvalidAllowedFields(string $model)
6972
{
7073
return new static(lang('Database.invalidAllowedFields', [$model]));
7174
}
7275

76+
/**
77+
* @return DataException
78+
*/
7379
public static function forTableNotFound(string $table)
7480
{
7581
return new static(lang('Database.tableNotFound', [$table]));
7682
}
7783

84+
/**
85+
* @return DataException
86+
*/
7887
public static function forEmptyInputGiven(string $argument)
7988
{
8089
return new static(lang('Database.forEmptyInputGiven', [$argument]));
8190
}
8291

92+
/**
93+
* @return DataException
94+
*/
8395
public static function forFindColumnHaveMultipleColumns()
8496
{
8597
return new static(lang('Database.forFindColumnHaveMultipleColumns'));

system/Database/Forge.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -984,6 +984,8 @@ protected function _processColumn(array $processedField): string
984984

985985
/**
986986
* Performs a data type mapping between different databases.
987+
*
988+
* @return void
987989
*/
988990
protected function _attributeType(array &$attributes)
989991
{
@@ -999,6 +1001,8 @@ protected function _attributeType(array &$attributes)
9991001
* if $attributes['TYPE'] is found in the array
10001002
* - array(TYPE => UTYPE) will change $field['type'],
10011003
* from TYPE to UTYPE in case of a match
1004+
*
1005+
* @return void
10021006
*/
10031007
protected function _attributeUnsigned(array &$attributes, array &$field)
10041008
{
@@ -1030,6 +1034,9 @@ protected function _attributeUnsigned(array &$attributes, array &$field)
10301034
$field['unsigned'] = ($this->unsigned === true) ? ' UNSIGNED' : '';
10311035
}
10321036

1037+
/**
1038+
* @return void
1039+
*/
10331040
protected function _attributeDefault(array &$attributes, array &$field)
10341041
{
10351042
if ($this->default === false) {
@@ -1051,13 +1058,19 @@ protected function _attributeDefault(array &$attributes, array &$field)
10511058
}
10521059
}
10531060

1061+
/**
1062+
* @return void
1063+
*/
10541064
protected function _attributeUnique(array &$attributes, array &$field)
10551065
{
10561066
if (! empty($attributes['UNIQUE']) && $attributes['UNIQUE'] === true) {
10571067
$field['unique'] = ' UNIQUE';
10581068
}
10591069
}
10601070

1071+
/**
1072+
* @return void
1073+
*/
10611074
protected function _attributeAutoIncrement(array &$attributes, array &$field)
10621075
{
10631076
if (! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === true
@@ -1254,6 +1267,8 @@ protected function _processForeignKeys(string $table, bool $asQuery = false): ar
12541267

12551268
/**
12561269
* Resets table creation vars
1270+
*
1271+
* @return void
12571272
*/
12581273
public function reset()
12591274
{

system/Database/Migration.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,15 @@ public function getDBGroup(): ?string
6464

6565
/**
6666
* Perform a migration step.
67+
*
68+
* @return void
6769
*/
6870
abstract public function up();
6971

7072
/**
7173
* Revert a migration step.
74+
*
75+
* @return void
7276
*/
7377
abstract public function down();
7478
}

system/Database/MigrationRunner.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ public function regress(int $targetBatch = 0, ?string $group = null)
317317
*
318318
* @param string $path Full path to a valid migration file
319319
* @param string $path Namespace of the target migration
320+
*
321+
* @return bool
320322
*/
321323
public function force(string $path, string $namespace, ?string $group = null)
322324
{
@@ -575,6 +577,8 @@ public function clearCliMessages()
575577

576578
/**
577579
* Truncates the history table.
580+
*
581+
* @return void
578582
*/
579583
public function clearHistory()
580584
{
@@ -587,6 +591,8 @@ public function clearHistory()
587591
* Add a history to the table.
588592
*
589593
* @param object $migration
594+
*
595+
* @return void
590596
*/
591597
protected function addHistory($migration, int $batch)
592598
{
@@ -614,6 +620,8 @@ protected function addHistory($migration, int $batch)
614620
* Removes a single history
615621
*
616622
* @param object $history
623+
*
624+
* @return void
617625
*/
618626
protected function removeHistory($history)
619627
{
@@ -752,6 +760,8 @@ public function getBatchEnd(int $batch): string
752760
/**
753761
* Ensures that we have created our migrations table
754762
* in the database.
763+
*
764+
* @return void
755765
*/
756766
public function ensureTable()
757767
{

system/Database/Postgre/Connection.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ public function insertID()
517517

518518
/**
519519
* Build a DSN from the provided parameters
520+
*
521+
* @return void
520522
*/
521523
protected function buildDSN()
522524
{

system/Database/Query.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ public function getOriginalQuery(): string
287287
* Escapes and inserts any binds into the finalQueryString property.
288288
*
289289
* @see https://regex101.com/r/EUEhay/5
290+
*
291+
* @return void
290292
*/
291293
protected function compileBinds()
292294
{

0 commit comments

Comments
 (0)