From b6e46fbeec9e538bdc4b914006870839ada4f7c0 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Mon, 9 Jun 2025 20:53:26 -0600 Subject: [PATCH 1/3] Bump phpstan to 1.12.x Signed-off-by: Matthew Peveler --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4fa95419e..4d9165449 100644 --- a/composer.json +++ b/composer.json @@ -74,7 +74,7 @@ "cs-check": "phpcs", "cs-fix": "phpcbf", "stan": "phpstan analyse", - "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:~1.9.0 && mv composer.backup composer.json", + "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:~1.12.0 && mv composer.backup composer.json", "lowest": "validate-prefer-lowest", "lowest-setup": "composer update --prefer-lowest --prefer-stable --prefer-dist --no-interaction && cp composer.json composer.backup && composer require --dev dereuromark/composer-prefer-lowest && mv composer.backup composer.json", "test": "phpunit --colors=always" From b16b175360bbd499511df8d8b3a05818a24087db Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Sun, 26 Oct 2025 20:27:27 +0000 Subject: [PATCH 2/3] fix phpstan failures --- phpstan-baseline.neon | 5 ----- src/Phinx/Db/Adapter/SQLiteAdapter.php | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 97e75659b..b6fe2d324 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Variable \\$tval on left side of \\?\\? always exists and is not nullable\\.$#" - count: 1 - path: src/Phinx/Config/Config.php - - message: "#^Expression on left side of \\?\\? is not nullable\\.$#" count: 1 diff --git a/src/Phinx/Db/Adapter/SQLiteAdapter.php b/src/Phinx/Db/Adapter/SQLiteAdapter.php index e4f9b3a02..2b0cbedba 100644 --- a/src/Phinx/Db/Adapter/SQLiteAdapter.php +++ b/src/Phinx/Db/Adapter/SQLiteAdapter.php @@ -1168,8 +1168,8 @@ protected function calculateNewTableColumns(string $tableName, string|false $col $writeColumns[] = $writeName; } - $selectColumns = array_filter($selectColumns, 'strlen'); - $writeColumns = array_filter($writeColumns, 'strlen'); + $selectColumns = array_filter($selectColumns, fn($v) => strlen($v) > 0); + $writeColumns = array_filter($writeColumns, fn($v) => strlen($v) > 0); $selectColumns = array_map([$this, 'quoteColumnName'], $selectColumns); $writeColumns = array_map([$this, 'quoteColumnName'], $writeColumns); From 1b1e938e70c7a41a60b8115e9484ce004ef7d670 Mon Sep 17 00:00:00 2001 From: Matthew Peveler Date: Sun, 26 Oct 2025 20:30:59 +0000 Subject: [PATCH 3/3] handle false values --- src/Phinx/Db/Adapter/SQLiteAdapter.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Phinx/Db/Adapter/SQLiteAdapter.php b/src/Phinx/Db/Adapter/SQLiteAdapter.php index 2b0cbedba..f6f7759c2 100644 --- a/src/Phinx/Db/Adapter/SQLiteAdapter.php +++ b/src/Phinx/Db/Adapter/SQLiteAdapter.php @@ -1168,8 +1168,8 @@ protected function calculateNewTableColumns(string $tableName, string|false $col $writeColumns[] = $writeName; } - $selectColumns = array_filter($selectColumns, fn($v) => strlen($v) > 0); - $writeColumns = array_filter($writeColumns, fn($v) => strlen($v) > 0); + $selectColumns = array_filter($selectColumns, fn($v) => $v && strlen($v) > 0); + $writeColumns = array_filter($writeColumns, fn($v) => $v && strlen($v) > 0); $selectColumns = array_map([$this, 'quoteColumnName'], $selectColumns); $writeColumns = array_map([$this, 'quoteColumnName'], $writeColumns);