From 88cfc7129353d0decada0f6682bd1bcc77bb7c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Wed, 29 Oct 2025 16:31:49 -0300 Subject: [PATCH 1/3] Upgrade Psalm to version 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- composer.json | 7 ++++--- psalm-baseline.xml | 27 ++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 5a643f3..2b66f28 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "@phpunit" ], "update:baselines": [ - "@php phpstan analyse --generate-baseline" + "@php phpstan analyse --generate-baseline", + "@php psalm --set-baseline=psalm-baseline.xml" ] }, "require": { @@ -45,8 +46,8 @@ "phpstan/phpstan-phpunit": "^1.4", "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpunit": "^10.5", - "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.15" + "psalm/plugin-phpunit": "^0.19.5", + "vimeo/psalm": "^6.13" }, "autoload": { "psr-4": { diff --git a/psalm-baseline.xml b/psalm-baseline.xml index dd96329..c872cfb 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,6 +1,9 @@ - + + + + shpFile]]> shxFile]]> @@ -13,6 +16,12 @@ + + + + + + shpFile]]> @@ -30,6 +39,9 @@ + + + @@ -142,9 +154,22 @@ + + + + + + + + records[0]->shpData['parts']]]> + + + + + From 942272df88b5d633efebf7cbf99ae3c2a9a422d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Wed, 29 Oct 2025 16:50:28 -0300 Subject: [PATCH 2/3] Upgrade PHPStan to version 2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- composer.json | 8 +-- phpstan-baseline.neon | 121 ++++++++++++++++++++++++++++++++---------- 2 files changed, 96 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index 2b66f28..04e5bbe 100644 --- a/composer.json +++ b/composer.json @@ -41,10 +41,10 @@ "require-dev": { "phpmyadmin/coding-standard": "^4.0", "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^1.12", - "phpstan/phpstan-deprecation-rules": "^1.2", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.6", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", "phpunit/phpunit": "^10.5", "psalm/plugin-phpunit": "^0.19.5", "vimeo/psalm": "^6.13" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 4c1320d..fcea6bf 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,136 +1,199 @@ parameters: ignoreErrors: - - message: "#^Foreach overwrites \\$i with its key variable\\.$#" + message: '#^Foreach overwrites \$i with its key variable\.$#' + identifier: foreach.keyOverwrite count: 1 path: examples/read.php - - message: "#^Cannot cast mixed to int\\.$#" + message: '#^Cannot cast mixed to int\.$#' + identifier: cast.int count: 1 path: src/ShapeFile.php - - message: "#^Casting to int something that's already int\\.$#" + message: '#^Casting to int something that''s already int\.$#' + identifier: cast.useless count: 1 path: src/ShapeFile.php - - message: "#^Only booleans are allowed in a negated boolean, resource\\|false given\\.$#" + message: '#^Loose comparison via "\!\=" is not allowed\.$#' + identifier: notEqual.notAllowed + count: 3 + path: src/ShapeFile.php + + - + message: '#^Loose comparison via "\=\=" is not allowed\.$#' + identifier: equal.notAllowed + count: 1 + path: src/ShapeFile.php + + - + message: '#^Only booleans are allowed in a negated boolean, resource\|false given\.$#' + identifier: booleanNot.exprNotBoolean count: 1 path: src/ShapeFile.php - - message: "#^Only numeric types are allowed in \\+, int\\|null given on the left side\\.$#" + message: '#^Only numeric types are allowed in \+, int\|null given on the left side\.$#' + identifier: plus.leftNonNumeric count: 2 path: src/ShapeFile.php - - message: "#^Only numeric types are allowed in \\+, int\\|null given on the right side\\.$#" + message: '#^Only numeric types are allowed in \+, int\|null given on the right side\.$#' + identifier: plus.rightNonNumeric count: 1 path: src/ShapeFile.php - - message: "#^Parameter \\#1 \\$stream of function feof expects resource, resource\\|false given\\.$#" + message: '#^Parameter \#1 \$stream of function feof expects resource, resource\|false given\.$#' + identifier: argument.type count: 1 path: src/ShapeFile.php - - message: "#^Parameter \\#1 \\$string of function strtoupper expects string, mixed given\\.$#" + message: '#^Parameter \#1 \$string of function strtoupper expects string, mixed given\.$#' + identifier: argument.type count: 1 path: src/ShapeFile.php - - message: "#^Parameter \\#1 \\$string of function substr expects string, string\\|false given\\.$#" + message: '#^Parameter \#1 \$string of function substr expects string, string\|false given\.$#' + identifier: argument.type count: 6 path: src/ShapeFile.php - - message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\ShapeFile\\\\Util\\:\\:packDouble\\(\\) expects float, mixed given\\.$#" + message: '#^Parameter \#1 \$value of static method PhpMyAdmin\\ShapeFile\\Util\:\:packDouble\(\) expects float, mixed given\.$#' + identifier: argument.type count: 1 path: src/ShapeFile.php - - message: "#^Parameter \\#2 \\$length of function fread expects int\\<1, max\\>, int\\<0, max\\> given\\.$#" + message: '#^Parameter \#2 \$length of function fread expects int\<1, max\>, int\<0, max\> given\.$#' + identifier: argument.type count: 1 path: src/ShapeFile.php - - message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#" + message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#' + identifier: foreach.nonIterable count: 4 path: src/ShapeRecord.php - - message: "#^Cannot access an offset on mixed\\.$#" + message: '#^Binary operation "\*" between mixed and 2 results in an error\.$#' + identifier: binaryOp.invalid + count: 1 + path: src/ShapeRecord.php + + - + message: '#^Binary operation "\+" between 1 and mixed results in an error\.$#' + identifier: binaryOp.invalid + count: 2 + path: src/ShapeRecord.php + + - + message: '#^Cannot access an offset on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 4 path: src/ShapeRecord.php - - message: "#^Cannot access offset 'points' on mixed\\.$#" - count: 15 + message: '#^Cannot access offset ''points'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 11 path: src/ShapeRecord.php - - message: "#^Cannot access offset int on mixed\\.$#" - count: 12 + message: '#^Cannot access offset int on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 8 path: src/ShapeRecord.php - - message: "#^Cannot access offset int\\<\\-1, max\\> on mixed\\.$#" + message: '#^Cannot access offset int\<\-1, max\> on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 2 path: src/ShapeRecord.php - - message: "#^Cannot access offset int\\<0, max\\> on mixed\\.$#" + message: '#^Cannot access offset int\<0, max\> on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 12 path: src/ShapeRecord.php - - message: "#^Cannot access offset int\\<1, max\\> on mixed\\.$#" + message: '#^Cannot access offset int\<1, max\> on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 2 path: src/ShapeRecord.php - - message: "#^Cannot access offset string on mixed\\.$#" + message: '#^Cannot access offset string on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible count: 4 path: src/ShapeRecord.php - - message: "#^Cannot call method hasMeasure\\(\\) on PhpMyAdmin\\\\ShapeFile\\\\ShapeFile\\|null\\.$#" + message: '#^Cannot call method hasMeasure\(\) on PhpMyAdmin\\ShapeFile\\ShapeFile\|null\.$#' + identifier: method.nonObject count: 2 path: src/ShapeRecord.php - - message: "#^Cannot call method readSHP\\(\\) on PhpMyAdmin\\\\ShapeFile\\\\ShapeFile\\|null\\.$#" + message: '#^Cannot call method readSHP\(\) on PhpMyAdmin\\ShapeFile\\ShapeFile\|null\.$#' + identifier: method.nonObject count: 1 path: src/ShapeRecord.php - - message: "#^Cannot cast mixed to int\\.$#" + message: '#^Cannot cast mixed to int\.$#' + identifier: cast.int + count: 2 + path: src/ShapeRecord.php + + - + message: '#^Cannot use \-\- on mixed\.$#' + identifier: preDec.type count: 2 path: src/ShapeRecord.php - - message: "#^Parameter \\#1 \\$data of method PhpMyAdmin\\\\ShapeFile\\\\ShapeRecord\\:\\:savePoint\\(\\) expects array, mixed given\\.$#" + message: '#^Parameter \#1 \$data of method PhpMyAdmin\\ShapeFile\\ShapeRecord\:\:savePoint\(\) expects array\, mixed given\.$#' + identifier: argument.type count: 2 path: src/ShapeRecord.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, mixed given\.$#' + identifier: argument.type count: 16 path: src/ShapeRecord.php - - message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\ShapeFile\\\\Util\\:\\:packDouble\\(\\) expects float, mixed given\\.$#" + message: '#^Parameter \#1 \$value of static method PhpMyAdmin\\ShapeFile\\Util\:\:packDouble\(\) expects float, mixed given\.$#' + identifier: argument.type count: 11 path: src/ShapeRecord.php - - message: "#^Property PhpMyAdmin\\\\ShapeFile\\\\ShapeRecord\\:\\:\\$size \\(int\\) does not accept \\(float\\|int\\)\\.$#" + message: '#^Possibly invalid array key type mixed\.$#' + identifier: offsetAccess.invalidOffset + count: 2 + path: src/ShapeRecord.php + + - + message: '#^Property PhpMyAdmin\\ShapeFile\\ShapeRecord\:\:\$size \(int\) does not accept \(float\|int\)\.$#' + identifier: assign.propertyType count: 1 path: src/ShapeRecord.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#" + message: '#^Parameter \#1 \$value of function count expects array\|Countable, mixed given\.$#' + identifier: argument.type count: 1 path: tests/ShapeFileTest.php From c7694ccdec203a2067660d184b1f752eaeb9abf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Wed, 29 Oct 2025 16:55:51 -0300 Subject: [PATCH 3/3] Move PHP 8.5 tests to experimental MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maurício Meneghini Fauth --- .github/workflows/tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b2cd9ed..7aeb04d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,12 +11,14 @@ jobs: continue-on-error: ${{ matrix.experimental }} strategy: matrix: - php-version: ['8.2', '8.3', '8.4', '8.5'] + php-version: ['8.2', '8.3', '8.4'] php-extensions: ['dbase', ':dbase'] os: [ubuntu-latest] experimental: [false] composer-options: [''] include: + - { php-version: '8.5', php-extensions: 'dbase', composer-options: '--ignore-platform-req=php+', experimental: true, os: ubuntu-latest } + - { php-version: '8.5', php-extensions: ':dbase', composer-options: '--ignore-platform-req=php+', experimental: true, os: ubuntu-latest } - { php-version: '8.6', php-extensions: 'dbase', composer-options: '--ignore-platform-req=php+', experimental: true, os: ubuntu-latest } - { php-version: '8.6', php-extensions: ':dbase', composer-options: '--ignore-platform-req=php+', experimental: true, os: ubuntu-latest } steps: