fix: remove declare(strict_types=1)

This commit is contained in:
kenjis 2023-10-22 17:26:33 +09:00
parent 4b923d5dbf
commit db98b1194d
No known key found for this signature in database
GPG Key ID: BD254878922AF198
5 changed files with 9 additions and 10 deletions

View File

@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
@ -921,6 +919,8 @@ class CodeIgniter
// This is a Web request or PHP CLI request
$params = $this->router->params();
// The controller method param types may not be string.
// So cannot set `declare(strict_types=1)` in this file.
$output = method_exists($class, '_remap')
? $class->_remap($this->method, ...$params)
: $class->{$this->method}(...$params);

View File

@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
@ -166,6 +164,9 @@ class BaseConfig
$value = (float) $value;
}
// If the default value of the property is `null` and the type is not
// `string`, TypeError will happen.
// So cannot set `declare(strict_types=1)` in this file.
$property = $value;
}
}

View File

@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
@ -163,6 +161,8 @@ trait ControllerTestTrait
try {
ob_start();
// The controller method param types may not be string.
// So cannot set `declare(strict_types=1)` in this file.
$response = $this->controller->{$method}(...$params);
} catch (Throwable $e) {
$code = $e->getCode();

View File

@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
@ -618,6 +616,7 @@ class Parser extends View
}
// Filter it....
// We can't know correct param types, so can't set `declare(strict_types=1)`.
$replace = $this->config->filters[$filter]($replace, ...$param);
}

View File

@ -1,7 +1,5 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
@ -73,6 +71,7 @@ final class ExceptionsTest extends CIUnitTestCase
$maybeNull = PHP_VERSION_ID >= 80100 ? null : 'random string';
try {
// We test DEPRECATED error, so cannot set `declare(strict_types=1)` in this file.
strlen($maybeNull);
$this->assertLogContains('error', '[DEPRECATED] strlen(): ');
} catch (ErrorException $e) {