From 7b0ab07e2e97974ee73ffc4df02fb62841898f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 8 Sep 2026 12:52:33 +0200 Subject: [PATCH 1/6] :recycle: combine all static checks in one job --- .github/workflows/_static-analysis.yml | 13 +++++++ .../workflows/_static-dependency-checks.yml | 34 ------------------- .github/workflows/pull-request.yml | 3 -- 3 files changed, 13 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/_static-dependency-checks.yml diff --git a/.github/workflows/_static-analysis.yml b/.github/workflows/_static-analysis.yml index eeb10db0..6c63738e 100644 --- a/.github/workflows/_static-analysis.yml +++ b/.github/workflows/_static-analysis.yml @@ -18,6 +18,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer + - uses: ramsey/composer-install@v3 - name: Cache dependencies uses: actions/cache@v5 @@ -34,3 +35,15 @@ jobs: - name: Run lint run: | composer lint + + - name: License check + run: | + vendor/bin/license-checker check + + - name: Download Composer Unused + run: curl -OL https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar + + - name: check unused dependencies + # symfony/console is mistakenly flagged as unused since it is only used in the CLI, not the main app + # Exclude it from checks. + run: php composer-unused.phar --excludePackage=symfony/console diff --git a/.github/workflows/_static-dependency-checks.yml b/.github/workflows/_static-dependency-checks.yml deleted file mode 100644 index b6b2cea7..00000000 --- a/.github/workflows/_static-dependency-checks.yml +++ /dev/null @@ -1,34 +0,0 @@ -# -# Make sure dependencies are all properly integrated and used in the package -# -name: Analyze Dependencies - -on: - workflow_call: - -jobs: - analyze-dependencies: - name: Run dependencies analysis - runs-on: ubuntu-latest - strategy: - matrix: - php-version: - - 8.3 - steps: - - uses: actions/checkout@v4 - - name: Set up php ${{ matrix.php-version }} - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - - uses: ramsey/composer-install@v3 - - - name: Download archive - run: curl -OL https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar - - # symfony/console is mistakenly flagged as unused since it is only used in the CLI, not the main app, so we ignore it. - - name: check unused dependencies - run: php composer-unused.phar --excludePackage=symfony/console - - - name: License check - run: | - vendor/bin/license-checker check diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 1a2c06cb..57321fa0 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -13,9 +13,6 @@ jobs: static-analysis: uses: ./.github/workflows/_static-analysis.yml needs: workflow-lint - static-dependency-checks: - uses: ./.github/workflows/_static-dependency-checks.yml - needs: static-analysis test-units: uses: ./.github/workflows/_test-units.yml needs: static-analysis From cafa3fca7dd7b0dc46eeb82cef1f7d0a6349aa12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 8 Sep 2026 13:14:51 +0200 Subject: [PATCH 2/6] :bug: fix for mb_str_pad not existing in php 8.1 --- src/V1/Parsing/Standard/TaxField.php | 12 ++++++++---- src/V1/Parsing/SummaryHelperV1.php | 10 +++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/V1/Parsing/Standard/TaxField.php b/src/V1/Parsing/Standard/TaxField.php index 8225131e..bcb0a735 100644 --- a/src/V1/Parsing/Standard/TaxField.php +++ b/src/V1/Parsing/Standard/TaxField.php @@ -4,6 +4,8 @@ namespace Mindee\V1\Parsing\Standard; +use Mindee\V1\Parsing\SummaryHelperV1; + use function array_key_exists; use function is_scalar; @@ -92,10 +94,12 @@ public function toTableLine(): string { $printable = $this->printableValues(); - return '| ' . mb_str_pad($printable['basis'], 13, ' ', STR_PAD_RIGHT, "UTF-8") - . ' | ' . mb_str_pad($printable['code'], 6, ' ', STR_PAD_RIGHT, "UTF-8") - . ' | ' . mb_str_pad($printable['rate'], 8, ' ', STR_PAD_RIGHT, "UTF-8") - . ' | ' . mb_str_pad($printable['value'], 13, ' ', STR_PAD_RIGHT, "UTF-8") . ' |'; + $outStr = "| "; + $outStr .= SummaryHelperV1::padString($printable['basis'], 13); + $outStr .= SummaryHelperV1::padString($printable['code'], 6); + $outStr .= SummaryHelperV1::padString($printable['rate'], 8); + $outStr .= SummaryHelperV1::padString($printable['value'], 13); + return rtrim(SummaryHelperV1::cleanOutString($outStr)); } /** diff --git a/src/V1/Parsing/SummaryHelperV1.php b/src/V1/Parsing/SummaryHelperV1.php index 60a06730..8aa393f3 100644 --- a/src/V1/Parsing/SummaryHelperV1.php +++ b/src/V1/Parsing/SummaryHelperV1.php @@ -6,6 +6,9 @@ use Mindee\Parsing\SummaryHelper; +use function function_exists; +use function strlen; + /** * Utility class to handle information display. */ @@ -21,6 +24,11 @@ class SummaryHelperV1 extends SummaryHelper */ public static function padString(string $inputString, int $colSize, string $separator = "|"): string { - return mb_str_pad($inputString, $colSize, " ", STR_PAD_RIGHT, "UTF-8") . " $separator "; + if (function_exists('mb_str_pad')) { + return mb_str_pad($inputString, $colSize, " ", STR_PAD_RIGHT, "UTF-8") . " $separator "; + } + + $paddedLength = $colSize + (strlen($inputString) - mb_strlen($inputString, 'UTF-8')); + return str_pad($inputString, $paddedLength, ' ', STR_PAD_RIGHT) . " $separator "; } } From f374038d193c4aeb433cf9666f90976f0a5a4571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 8 Sep 2026 13:50:59 +0200 Subject: [PATCH 3/6] :pushpin: linting should be deterministic --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 615b69a5..26f34b5d 100644 --- a/composer.json +++ b/composer.json @@ -15,13 +15,13 @@ "composer/ca-bundle": "^1.5" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.38", - "phpunit/phpunit": "^9.6", - "madewithlove/license-checker": "^v1.0", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-deprecation-rules": "^2.0", - "rector/rector": "^2.4", - "projektgopher/whisky": "^0.7.4" + "friendsofphp/php-cs-fixer": "~v3.95.25", + "phpunit/phpunit": "~9.6.35", + "madewithlove/license-checker": "~v1.6", + "phpstan/phpstan": "~2.2.8", + "phpstan/phpstan-deprecation-rules": "~2.0.5", + "rector/rector": "~2.5.9", + "projektgopher/whisky": "~0.7.4" }, "suggest": { "ext-imagick": "Required for PDF rasterization and image processing features", From 980f99dc3a29c876b7f25b97d0ee8a7901adc280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 8 Sep 2026 14:06:27 +0200 Subject: [PATCH 4/6] update for API change --- tests/V2/Product/Extraction/RagDocumentsFunctional.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/V2/Product/Extraction/RagDocumentsFunctional.php b/tests/V2/Product/Extraction/RagDocumentsFunctional.php index afcc5ede..22897aaf 100644 --- a/tests/V2/Product/Extraction/RagDocumentsFunctional.php +++ b/tests/V2/Product/Extraction/RagDocumentsFunctional.php @@ -105,7 +105,7 @@ public function testRagDocumentLifecycleMustSucceed(): void ) ); self::assertNotNull($patchStatusResponse); - self::assertEquals("Active", $patchStatusResponse->status); + self::assertEquals("Processing", $patchStatusResponse->status); $deleteResponse = $this->client->deleteExtractionRagDocument($documentId); self::assertTrue($deleteResponse); From 88ba89b4d9ad15930a3f26a64f5b383342a0ec1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 8 Sep 2026 14:39:12 +0200 Subject: [PATCH 5/6] :bug: use standard install channel for composer-unused --- .github/workflows/_static-analysis.yml | 30 ++++++-------------------- composer.json | 3 ++- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/.github/workflows/_static-analysis.yml b/.github/workflows/_static-analysis.yml index 6c63738e..e55565ca 100644 --- a/.github/workflows/_static-analysis.yml +++ b/.github/workflows/_static-analysis.yml @@ -7,43 +7,27 @@ jobs: static-check: name: Run Static Analysis runs-on: ubuntu-latest - strategy: - matrix: - php-version: ["8.1"] steps: - uses: actions/checkout@v4 - - name: Set up PHP ${{ matrix.php-version }} + - name: Set up PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-version }} + php-version: "8.1" tools: composer - - uses: ramsey/composer-install@v3 - - - name: Cache dependencies - uses: actions/cache@v5 - with: - path: ./vendor - key: ${{ runner.os }}-${{ hashFiles('composer.json') }} - restore-keys: | - ${{ runner.os }} - name: Install dependencies - run: | - composer install + uses: ramsey/composer-install@v3 - name: Run lint run: | composer lint - - name: License check + - name: License Check run: | - vendor/bin/license-checker check - - - name: Download Composer Unused - run: curl -OL https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar + ./vendor/bin/license-checker check - - name: check unused dependencies + - name: Check Unused Dependencies # symfony/console is mistakenly flagged as unused since it is only used in the CLI, not the main app # Exclude it from checks. - run: php composer-unused.phar --excludePackage=symfony/console + run: ./vendor/bin/composer-unused --excludePackage=symfony/console diff --git a/composer.json b/composer.json index 26f34b5d..c4bbb172 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,8 @@ "phpstan/phpstan": "~2.2.8", "phpstan/phpstan-deprecation-rules": "~2.0.5", "rector/rector": "~2.5.9", - "projektgopher/whisky": "~0.7.4" + "projektgopher/whisky": "~0.7.4", + "icanhazstring/composer-unused": "~0.9.0" }, "suggest": { "ext-imagick": "Required for PDF rasterization and image processing features", From 5a71fcdd75b4ad786dbd475d7461b640dcf8f62d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ianar=C3=A9=20S=C3=A9vi?= Date: Tue, 8 Sep 2026 14:48:53 +0200 Subject: [PATCH 6/6] :recycle: harmonize PHP installs --- .github/workflows/_publish-docs.yml | 2 +- .github/workflows/_test-cli.yml | 4 ++- .github/workflows/_test-integrations.yml | 18 ++++++++--- .github/workflows/_test-smoke.yml | 4 ++- .github/workflows/_test-units.yml | 40 ++++++++++++++++++------ 5 files changed, 51 insertions(+), 17 deletions(-) diff --git a/.github/workflows/_publish-docs.yml b/.github/workflows/_publish-docs.yml index 725f05f2..4bb67a9d 100644 --- a/.github/workflows/_publish-docs.yml +++ b/.github/workflows/_publish-docs.yml @@ -14,7 +14,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up php 8.3 + - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: 8.3 diff --git a/.github/workflows/_test-cli.yml b/.github/workflows/_test-cli.yml index 53f42770..d65c0119 100644 --- a/.github/workflows/_test-cli.yml +++ b/.github/workflows/_test-cli.yml @@ -33,7 +33,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - - uses: ramsey/composer-install@v3 + + - name: Install dependencies + uses: ramsey/composer-install@v3 - name: Test V2 CLI shell: sh diff --git a/.github/workflows/_test-integrations.yml b/.github/workflows/_test-integrations.yml index a9b9f102..e7fac13d 100644 --- a/.github/workflows/_test-integrations.yml +++ b/.github/workflows/_test-integrations.yml @@ -42,18 +42,23 @@ jobs: run: | sudo apt-get update sudo apt-get install -y ghostscript - - name: Set up php ${{ matrix.php-version }} + + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json, imagick - - uses: ramsey/composer-install@v2 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + - name: Change ImageMagick security policy on Ubuntu run: | DQT='"' SRC="rights=${DQT}none${DQT} pattern=${DQT}PDF${DQT}" RPL="rights=${DQT}read|write${DQT} pattern=${DQT}PDF${DQT}" sudo sed -i "s/$SRC/$RPL/" /etc/ImageMagick-6/policy.xml + - name: Unit testing with phpunit run: | ./vendor/bin/phpunit -c tests/functional.xml @@ -106,16 +111,21 @@ jobs: submodules: recursive - name: Install Ghostscript run: choco install ghostscript --version 10.03.1 -y - - name: Set up php ${{ matrix.php-version }} + + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: phpts: zts with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json, imagick + - name: Install Ghostscript run: choco install ghostscript -y - - uses: ramsey/composer-install@v2 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + - name: Unit testing with phpunit run: | ./vendor/bin/phpunit -c tests/functional.xml \ No newline at end of file diff --git a/.github/workflows/_test-smoke.yml b/.github/workflows/_test-smoke.yml index e7aa97d9..70e2fabb 100644 --- a/.github/workflows/_test-smoke.yml +++ b/.github/workflows/_test-smoke.yml @@ -37,7 +37,9 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - - uses: ramsey/composer-install@v2 + + - name: Install dependencies + uses: ramsey/composer-install@v3 - name: Tests V2 code samples run: | diff --git a/.github/workflows/_test-units.yml b/.github/workflows/_test-units.yml index befbc73e..49dbb9fa 100644 --- a/.github/workflows/_test-units.yml +++ b/.github/workflows/_test-units.yml @@ -20,17 +20,22 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Set up php ${{ matrix.php-version }} + + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - - uses: ramsey/composer-install@v3 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + - name: Unit testing with phpunit env: MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} run: | ./vendor/bin/phpunit -c tests/pdffeatures.xml + with-pdf-linux: name: Unit Tests on Linux with PDF support timeout-minutes: 30 @@ -50,23 +55,28 @@ jobs: run: | sudo apt-get update sudo apt-get install -y ghostscript - - name: Set up php ${{ matrix.php-version }} + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} - - uses: ramsey/composer-install@v3 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + - name: Change ImageMagick security policy on Ubuntu run: | DQT='"' SRC="rights=${DQT}none${DQT} pattern=${DQT}PDF${DQT}" RPL="rights=${DQT}read|write${DQT} pattern=${DQT}PDF${DQT}" sudo sed -i "s/$SRC/$RPL/" /etc/ImageMagick-6/policy.xml + - name: Unit testing with phpunit env: MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} run: | ./vendor/bin/phpunit -c tests/phpunit.xml + no-pdf-macos: name: Unit Tests on MacOS without PDF support timeout-minutes: 30 @@ -82,7 +92,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Set up php ${{ matrix.php-version }} + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: phpts: zts @@ -122,7 +132,7 @@ jobs: # run: | # brew install pkg-config ghostscript imagemagick@7 # export PKG_CONFIG_PATH="/usr/local/opt/imagemagick/lib/pkgconfig" -# - name: Set up php ${{ matrix.php-version }} +# - name: Set up PHP ${{ matrix.php-version }} # uses: shivammathur/setup-php@v2 # env: # phpts: zts @@ -152,20 +162,25 @@ jobs: - uses: actions/checkout@v4 with: submodules: recursive - - name: Set up php ${{ matrix.php-version }} + + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: phpts: zts with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json - - uses: ramsey/composer-install@v3 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + - name: Unit testing with phpunit env: MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} run: | ./vendor/bin/phpunit -c tests/pdffeatures.xml + with-pdf-windows: name: Unit Tests on Windows with PDF support timeout-minutes: 30 @@ -183,19 +198,24 @@ jobs: submodules: recursive - name: Install Ghostscript run: choco install ghostscript --version 10.04.0 -y + - name: Create Ghostscript alias run: | New-Item -ItemType SymbolicLink -Path "C:\Windows\gs.exe" -Target "C:\Program Files\gs\gs10.04.0\bin\gswin64c.exe" New-Item -ItemType SymbolicLink -Path "C:\Windows\gs" -Target "C:\Program Files\gs\gs10.04.0\bin\gswin64c.exe" shell: powershell - - name: Set up php ${{ matrix.php-version }} + + - name: Set up PHP ${{ matrix.php-version }} uses: shivammathur/setup-php@v2 env: phpts: zts with: php-version: ${{ matrix.php-version }} extensions: curl, fileinfo, json, imagick - - uses: ramsey/composer-install@v3 + + - name: Install dependencies + uses: ramsey/composer-install@v3 + - name: Unit testing with phpunit env: MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}