From aead21f81de76a6b7cec0d89106af3e1da9fbc44 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Tue, 4 Feb 2025 14:34:03 +0300 Subject: [PATCH 1/3] Add Yii Assets 5 support and disable Yii Config composer plugin --- composer.json | 4 +- config/.merge-plan.php | 203 ----------------------------------------- 2 files changed, 2 insertions(+), 205 deletions(-) delete mode 100644 config/.merge-plan.php diff --git a/composer.json b/composer.json index 9fcf9aa..cabfa47 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "psr/http-message": "^1.1", "psr/http-server-handler": "^1.0", "psr/http-server-middleware": "^1.0", - "yiisoft/assets": "^4.0", + "yiisoft/assets": "^4.0|^5.0", "yiisoft/data-response": "^2.0", "yiisoft/http": "^1.1", "yiisoft/router": "^3.1", @@ -119,7 +119,7 @@ "allow-plugins": { "infection/extension-installer": true, "composer/package-versions-deprecated": true, - "yiisoft/config": true + "yiisoft/config": false } }, "scripts": { diff --git a/config/.merge-plan.php b/config/.merge-plan.php deleted file mode 100644 index 2dc3c82..0000000 --- a/config/.merge-plan.php +++ /dev/null @@ -1,203 +0,0 @@ - [ - 'params' => [ - 'yiisoft/assets' => [ - 'config/params.php', - ], - 'yiisoft/yii-view-renderer' => [ - 'config/params.php', - ], - 'yiisoft/router-fastroute' => [ - 'config/params.php', - ], - 'yiisoft/aliases' => [ - 'config/params.php', - ], - 'yiisoft/data-response' => [ - 'config/params.php', - ], - 'yiisoft/view' => [ - 'config/params.php', - ], - 'yiisoft/csrf' => [ - 'config/params.php', - ], - 'yiisoft/log-target-file' => [ - 'config/params.php', - ], - 'yiisoft/session' => [ - 'config/params.php', - ], - '/' => [ - 'params.php', - ], - ], - 'di-web' => [ - 'yiisoft/assets' => [ - 'config/di-web.php', - ], - 'yiisoft/yii-view-renderer' => [ - 'config/di-web.php', - ], - 'yiisoft/router-fastroute' => [ - 'config/di-web.php', - ], - 'yiisoft/data-response' => [ - 'config/di-web.php', - ], - 'yiisoft/view' => [ - 'config/di-web.php', - ], - 'yiisoft/csrf' => [ - 'config/di-web.php', - ], - 'yiisoft/error-handler' => [ - 'config/di-web.php', - ], - 'yiisoft/session' => [ - 'config/di-web.php', - ], - 'yiisoft/yii-event' => [ - 'config/di-web.php', - ], - '/' => [ - 'di-web.php', - ], - ], - 'events-web' => [ - 'yiisoft/yii-view-renderer' => [ - 'config/events-web.php', - ], - 'yiisoft/log' => [ - 'config/events-web.php', - ], - ], - 'di' => [ - 'yiisoft/router-fastroute' => [ - 'config/di.php', - ], - 'yiisoft/aliases' => [ - 'config/di.php', - ], - 'yiisoft/router' => [ - 'config/di.php', - ], - 'yiisoft/view' => [ - 'config/di.php', - ], - 'yiisoft/cache' => [ - 'config/di.php', - ], - 'yiisoft/log-target-file' => [ - 'config/di.php', - ], - 'yiisoft/yii-event' => [ - 'config/di.php', - ], - ], - 'events-console' => [ - 'yiisoft/log' => [ - 'config/events-console.php', - ], - 'yiisoft/yii-console' => [ - 'config/events-console.php', - ], - ], - 'params-console' => [ - 'yiisoft/yii-console' => [ - 'config/params-console.php', - ], - 'yiisoft/yii-event' => [ - 'config/params-console.php', - ], - ], - 'di-console' => [ - 'yiisoft/yii-console' => [ - 'config/di-console.php', - ], - 'yiisoft/yii-event' => [ - 'config/di-console.php', - ], - ], - 'params-web' => [ - 'yiisoft/yii-event' => [ - 'config/params-web.php', - ], - ], - 'routes' => [ - '/' => [ - 'routes.php', - ], - ], - ], - 'yii-debug-viewer-app' => [ - 'params' => [ - '/' => [ - 'app/params.php', - ], - ], - 'di' => [ - '/' => [ - 'app/di.php', - ], - ], - 'di-console' => [ - '/' => [ - '$di', - ], - ], - 'di-web' => [ - '/' => [ - '$di', - 'app/web.php', - ], - ], - 'events' => [ - '/' => [], - ], - 'events-web' => [ - '/' => [ - '$events', - ], - ], - 'events-console' => [ - '/' => [ - '$events', - ], - ], - 'di-providers' => [ - '/' => [], - ], - 'di-providers-web' => [ - '/' => [ - '$di-providers', - ], - ], - 'di-providers-console' => [ - '/' => [ - '$di-providers', - ], - ], - 'routes' => [ - '/' => [], - ], - 'bootstrap' => [ - '/' => [], - ], - 'bootstrap-web' => [ - '/' => [ - '$bootstrap', - ], - ], - 'bootstrap-console' => [ - '/' => [ - '$bootstrap', - ], - ], - ], -]; From 372d67b5420426ffb7515b09b9d06272ba98faa9 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Tue, 4 Feb 2025 14:59:46 +0300 Subject: [PATCH 2/3] fix psalm --- composer.json | 2 +- psalm.xml | 2 ++ src/Asset/DevPanelAsset.php | 13 +++++++++++++ src/Asset/ToolbarAsset.php | 13 +++++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index cabfa47..9d7a1dd 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "rector/rector": "^0.15.1", "roave/infection-static-analysis-plugin": "^1.21", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.18", + "vimeo/psalm": "^5.26.1", "yiisoft/aliases": "^3.0", "yiisoft/config": "^1.0", "yiisoft/di": "^1.1", diff --git a/psalm.xml b/psalm.xml index baa9178..3dcae7a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,6 +1,8 @@ + */ public array $js = [ ['/bundle.js', WebView::POSITION_END, 'type' => 'module'], ]; + + /** + * @psalm-var array + */ public array $css = [ '/bundle.css', ]; diff --git a/src/Asset/ToolbarAsset.php b/src/Asset/ToolbarAsset.php index 45bc281..f13aca2 100644 --- a/src/Asset/ToolbarAsset.php +++ b/src/Asset/ToolbarAsset.php @@ -5,14 +5,27 @@ namespace Yiisoft\Yii\Debug\Viewer\Asset; use Yiisoft\Assets\AssetBundle; +use Yiisoft\Assets\AssetManager; use Yiisoft\View\WebView; +/** + * @psalm-import-type CssFile from AssetManager + * @psalm-import-type JsFile from AssetManager + */ final class ToolbarAsset extends AssetBundle { public bool $cdn = true; + + /** + * @psalm-var array + */ public array $js = [ ['/bundle.js', WebView::POSITION_END, 'type' => 'module'], ]; + + /** + * @psalm-var array + */ public array $css = [ '/bundle.css', ]; From b9d7aba6b358eb509448995ff15e96a161f95cd7 Mon Sep 17 00:00:00 2001 From: Sergei Predvoditelev Date: Tue, 4 Feb 2025 15:02:46 +0300 Subject: [PATCH 3/3] bump php --- .github/workflows/build.yml | 4 +++- .github/workflows/composer-require-checker.yml | 4 +++- .github/workflows/rector.yml | 2 +- .github/workflows/static.yml | 4 +++- README.md | 2 +- composer.json | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8506ea1..70f1073 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,8 @@ on: - 'psalm.xml' push: + branches: + - master paths-ignore: - 'docs/**' - 'README.md' @@ -28,4 +30,4 @@ jobs: os: >- ['ubuntu-latest', 'windows-latest'] php: >- - ['8.0', '8.1'] + ['8.1', '8.2', '8.3'] diff --git a/.github/workflows/composer-require-checker.yml b/.github/workflows/composer-require-checker.yml index ae5893f..822591f 100644 --- a/.github/workflows/composer-require-checker.yml +++ b/.github/workflows/composer-require-checker.yml @@ -11,6 +11,8 @@ on: - 'psalm.xml' push: + branches: + - master paths-ignore: - 'docs/**' - 'README.md' @@ -30,4 +32,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0', '8.1'] + ['8.1', '8.2', '8.3'] diff --git a/.github/workflows/rector.yml b/.github/workflows/rector.yml index adacd73..2f1499c 100644 --- a/.github/workflows/rector.yml +++ b/.github/workflows/rector.yml @@ -18,4 +18,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0'] + ['8.3'] diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 96b2679..873eeb5 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -10,6 +10,8 @@ on: - 'phpunit.xml.dist' push: + branches: + - master paths-ignore: - 'docs/**' - 'README.md' @@ -28,4 +30,4 @@ jobs: os: >- ['ubuntu-latest'] php: >- - ['8.0', '8.1'] + ['8.1', '8.2', '8.3'] diff --git a/README.md b/README.md index fcc45da..58e2a5b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The package ... ## Requirements -- PHP 8.0 or higher. +- PHP 8.1 or higher. ## Installation diff --git a/composer.json b/composer.json index 9d7a1dd..82913b9 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "nyholm/psr7": "^1.3", "psr/http-message": "^1.1", "psr/http-server-handler": "^1.0",