Skip to content

Commit d653cf1

Browse files
committed
php(8.4): Fixes for implicit nullability deprecation.
1 parent fb5ef82 commit d653cf1

File tree

9 files changed

+25
-16
lines changed

9 files changed

+25
-16
lines changed

tests/framework/base/ControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testRunAction(): void
5656
public function testCreateInlineAction(
5757
string $controllerClass,
5858
string $actionId,
59-
string $expectedActionMethod = null
59+
string|null $expectedActionMethod = null
6060
): void {
6161
$this->mockApplication();
6262
/** @var Controller $controller */

tests/framework/behaviors/AttributeBehaviorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function testPreserveNonEmptyValues(
105105
string $aliasExpected,
106106
bool $preserveNonEmptyValues,
107107
string $name,
108-
string $alias = null
108+
string|null $alias = null
109109
): void {
110110
$model = new ActiveRecordWithAttributeBehavior();
111111
$model->attributeBehavior->preserveNonEmptyValues = $preserveNonEmptyValues;

tests/framework/console/RequestTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public static function provider(): array
185185
* @param array $expected The expected result.
186186
* @param array|null $expectedException The expected exception.
187187
*/
188-
public function testResolve(array $params, array $expected, array $expectedException = null): void
188+
public function testResolve(array $params, array $expected, array|null $expectedException = null): void
189189
{
190190
if (isset($expectedException)) {
191191
$this->expectException($expectedException[0]);

tests/framework/di/ContainerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ public function testOptionalDependencies(): void
236236
{
237237
$container = new Container();
238238
// Test optional unresolvable dependency.
239-
$closure = fn(QuxInterface $test = null) => $test;
239+
$closure = fn(QuxInterface|null $test = null): QuxInterface|null => $test;
240240
$this->assertNull($container->invoke($closure));
241241
}
242242

tests/framework/filters/AccessRuleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function mockRequest(string $method = 'GET'): Request
4444
return $request;
4545
}
4646

47-
protected function mockUser(string $userid = null): User
47+
protected function mockUser(string|null $userid = null): User
4848
{
4949
$user = new User([
5050
'identityClass' => UserIdentity::class,

tests/framework/helpers/HtmlTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,8 +1652,12 @@ function (DynamicModel $model) {
16521652
/**
16531653
* @dataProvider errorSummaryDataProvider
16541654
*/
1655-
public function testErrorSummary(string $value, array $options, string $expectedHtml, \Closure $beforeValidate = null): void
1656-
{
1655+
public function testErrorSummary(
1656+
string $value,
1657+
array $options,
1658+
string $expectedHtml,
1659+
\Closure|null $beforeValidate = null
1660+
): void {
16571661
$model = new HtmlTestModel();
16581662
$model->name = $value;
16591663
if ($beforeValidate !== null) {

tests/framework/i18n/FormatterDateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ public static function dateInputs()
554554
* @param mixed $value
555555
* @param mixed|null $expectedException
556556
*/
557-
public function testIntlDateInput(string|bool $expected, string $value, string $expectedException = null): void
557+
public function testIntlDateInput(string|bool $expected, string $value, string|null $expectedException = null): void
558558
{
559559
$this->testDateInput($expected, $value, $expectedException);
560560
}
@@ -565,7 +565,7 @@ public function testIntlDateInput(string|bool $expected, string $value, string $
565565
* @param mixed $value
566566
* @param mixed|null $expectedException
567567
*/
568-
public function testDateInput(string|bool $expected, string $value, string $expectedException = null): void
568+
public function testDateInput(string|bool $expected, string $value, string|null $expectedException = null): void
569569
{
570570
if ($expectedException !== null) {
571571
$this->expectException($expectedException);

tests/framework/rest/IndexActionTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ public function testPrepareSearchQueryAttribute(): void
7575
* @param string $expectedRawSql
7676
*/
7777
public function testPrepareDataProviderWithPaginationAndSorting(
78-
\yii\data\Pagination|bool|array $pagination,
79-
\yii\data\Sort|bool|array $sort,
80-
int $expectedPaginationPageSize = null,
81-
int $expectedPaginationDefaultPageSize = null,
78+
Pagination|bool|array $pagination,
79+
Sort|bool|array $sort,
80+
int|null $expectedPaginationPageSize = null,
81+
int|null $expectedPaginationDefaultPageSize = null,
8282
array $expectedSortOrders = [],
83-
?array $expectedSortDefaultOrder = null
83+
array|null $expectedSortDefaultOrder = null
8484
): void {
8585
Yii::$app->getRequest()->setBodyParams([
8686
'per-page' => 11,

tests/framework/web/AssetBundleTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,13 @@ public static function registerFileDataProvider()
509509
* @param string|bool $appendTimestamp
510510
* @param string|null $webAlias
511511
*/
512-
public function testRegisterFileAppendTimestamp(string $type, string $path, bool $appendTimestamp, string $expected, string $webAlias = null): void
513-
{
512+
public function testRegisterFileAppendTimestamp(
513+
string $type,
514+
string $path,
515+
bool $appendTimestamp,
516+
string $expected,
517+
string|null $webAlias = null,
518+
): void {
514519
$originalAlias = Yii::getAlias('@web');
515520
if ($webAlias === null) {
516521
$webAlias = $originalAlias;

0 commit comments

Comments
 (0)