diff --git a/CHANGELOG.md b/CHANGELOG.md index 15facce8..0ad5024b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - fix: restore BSD-3-Clause detection without changing license terms. - ci: update shared workflows to `v2.0.6` and test PHP `8.6`. - ci: use shared quality and security defaults and remove redundant local linter configuration and Composer scripts. +- fix: handle nullable `ArrayDataProvider::$allModels` and align `Controller::actions()` stub types with Yii `22.0` for PHPStan. ## 0.2.3 November 15, 2026 diff --git a/composer.json b/composer.json index a910e17f..4c00ebaf 100644 --- a/composer.json +++ b/composer.json @@ -76,7 +76,15 @@ "autoload-dev": { "psr-4": { "yii\\debug\\tests\\": "tests" - } + }, + "exclude-from-classmap": [ + "tests/support/stub/inertia/CorePage.php", + "tests/support/stub/inertia/Page.php", + "tests/support/stub/inertia/Vite.php", + "tests/support/stub/vite/DevelopmentConfiguration.php", + "tests/support/stub/vite/ProductionConfiguration.php", + "tests/support/stub/vite/Vite.php" + ] }, "extra": { "branch-alias": { diff --git a/src/panels/ProfilingPanel.php b/src/panels/ProfilingPanel.php index 21440612..8a2ad65b 100644 --- a/src/panels/ProfilingPanel.php +++ b/src/panels/ProfilingPanel.php @@ -46,7 +46,7 @@ public function getDetail(): string $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams(), $this->getModels()); - $filteredRows = $this->filteredRows($dataProvider->allModels); + $filteredRows = $this->filteredRows($dataProvider->allModels ?? []); return Yii::$app->view->render( 'panels/profile/detail', diff --git a/tests/db/DbSearchTest.php b/tests/db/DbSearchTest.php index 157ce5b8..813f064d 100644 --- a/tests/db/DbSearchTest.php +++ b/tests/db/DbSearchTest.php @@ -74,6 +74,10 @@ public function testSearchAppliesPartialMatchOnQueryType(): void ], )->allModels; + self::assertIsArray( + $rows, + 'A partial type filter must return an array of models.', + ); self::assertCount( 1, $rows, @@ -121,6 +125,10 @@ public function testSearchAppliesQueryFilterAcrossSqlText(): void $rows = $provider->allModels; + self::assertIsArray( + $rows, + "Filtering on 'users' must return an array of models.", + ); self::assertCount( 1, $rows, diff --git a/tests/support/stub/router/controllers/BadController.php b/tests/support/stub/router/controllers/BadController.php index a4f5fea7..df4ade7b 100644 --- a/tests/support/stub/router/controllers/BadController.php +++ b/tests/support/stub/router/controllers/BadController.php @@ -23,7 +23,7 @@ public function actionOnly(): bool * The router never reaches this body {@see init()} throws first so the returned payload is irrelevant to the * scenario under test. Kept type-compliant with the parent contract. * - * @return array + * @return array */ #[Override] public function actions(): array