Skip to content

Commit af7fb3f

Browse files
samsonasikMGatner
authored andcommitted
[Rector] Apply PHP 7.4 Requirement and syntax
1 parent 8449d13 commit af7fb3f

File tree

114 files changed

+286
-525
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+286
-525
lines changed

app/Config/Constants.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
defined('HOUR') || define('HOUR', 3600);
3939
defined('DAY') || define('DAY', 86400);
4040
defined('WEEK') || define('WEEK', 604800);
41-
defined('MONTH') || define('MONTH', 2592000);
42-
defined('YEAR') || define('YEAR', 31536000);
43-
defined('DECADE') || define('DECADE', 315360000);
41+
defined('MONTH') || define('MONTH', 2_592_000);
42+
defined('YEAR') || define('YEAR', 31_536_000);
43+
defined('DECADE') || define('DECADE', 315_360_000);
4444

4545
/*
4646
| --------------------------------------------------------------------------

app/Config/Events.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@
3232
ob_end_flush();
3333
}
3434

35-
ob_start(static function ($buffer) {
36-
return $buffer;
37-
});
35+
ob_start(static fn($buffer) => $buffer);
3836
}
3937

4038
/*

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "https://codeigniter.com",
66
"license": "MIT",
77
"require": {
8-
"php": "^7.3 || ^8.0",
8+
"php": "^7.4 || ^8.0",
99
"ext-curl": "*",
1010
"ext-intl": "*",
1111
"ext-json": "*",

rector.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Rector\CodingStyle\Rector\ClassMethod\MakeInheritedMethodVisibilitySameAsParentRector;
2828
use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector;
2929
use Rector\Core\Configuration\Option;
30-
use Rector\Core\ValueObject\PhpVersion;
3130
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector;
3231
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPromotedPropertyRector;
3332
use Rector\DeadCode\Rector\If_\UnwrapFutureCompatibleIfPhpVersionRector;
@@ -54,7 +53,7 @@
5453

5554
return static function (ContainerConfigurator $containerConfigurator): void {
5655
$containerConfigurator->import(SetList::DEAD_CODE);
57-
$containerConfigurator->import(LevelSetList::UP_TO_PHP_73);
56+
$containerConfigurator->import(LevelSetList::UP_TO_PHP_74);
5857
$containerConfigurator->import(PHPUnitSetList::PHPUNIT_SPECIFIC_METHOD);
5958
$containerConfigurator->import(PHPUnitSetList::PHPUNIT_80);
6059

@@ -119,7 +118,6 @@
119118

120119
// auto import fully qualified class names
121120
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
122-
$parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73);
123121

124122
$services = $containerConfigurator->services();
125123
$services->set(UnderscoreToCamelCaseVariableNameRector::class);

system/Autoloader/FileLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function search(string $path, string $ext = 'php', bool $prioritizeApp =
186186
}
187187

188188
if (! $prioritizeApp && ! empty($appPaths)) {
189-
$foundPaths = array_merge($foundPaths, $appPaths);
189+
$foundPaths = [...$foundPaths, ...$appPaths];
190190
}
191191

192192
// Remove any duplicates

system/BaseModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ public function __construct(?ValidationInterface $validation = null)
295295
/**
296296
* @var Validation $validation
297297
*/
298-
$validation = $validation ?? Services::validation(null, false);
298+
$validation ??= Services::validation(null, false);
299299
$this->validation = $validation;
300300

301301
$this->initialize();

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ protected function getResponseObject()
576576
* @param int $duration How long the Strict Transport Security
577577
* should be enforced for this URL.
578578
*/
579-
protected function forceSecureAccess($duration = 31536000)
579+
protected function forceSecureAccess($duration = 31_536_000)
580580
{
581581
if ($this->config->forceGlobalSecureRequests !== true) {
582582
return;

system/Commands/Generators/MigrateCreate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ class MigrateCreate extends BaseCommand
7777
public function run(array $params)
7878
{
7979
// Resolve arguments before passing to make:migration
80-
$params[0] = $params[0] ?? CLI::getSegment(2);
80+
$params[0] ??= CLI::getSegment(2);
8181

82-
$params['namespace'] = $params['namespace'] ?? CLI::getOption('namespace') ?? APP_NAMESPACE;
82+
$params['namespace'] ??= CLI::getOption('namespace') ?? APP_NAMESPACE;
8383

8484
if (array_key_exists('force', $params) || CLI::getOption('force')) {
8585
$params['force'] = null;

system/Commands/Help.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Help extends BaseCommand
7272
public function run(array $params)
7373
{
7474
$command = array_shift($params);
75-
$command = $command ?? 'help';
75+
$command ??= 'help';
7676
$commands = $this->commands->getCommands();
7777

7878
if (! $this->commands->verifyCommand($command, $commands)) {

system/Commands/Utilities/Environment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ final class Environment extends BaseCommand
7272
*
7373
* @var array<int, string>
7474
*/
75-
private static $knownTypes = [
75+
private static array $knownTypes = [
7676
'production',
7777
'development',
7878
];

0 commit comments

Comments
 (0)