From 713d99f8d79e546fa488ef87c34dc361509ce4a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=94=D1=80=D0=B0?= =?UTF-8?q?=D0=B3=D1=83=D0=BD=D0=BA=D0=B8=D0=BD?= Date: Wed, 22 Apr 2026 10:31:39 +0300 Subject: [PATCH 1/3] enhancement: remove debug statement from docker configuration --- compose.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/compose.yaml b/compose.yaml index 39a145d..1b0cd99 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,9 +12,5 @@ services: volumes: - "./vendor${PHP_VERSION:-85}:/usr/src/app/vendor" - .:/usr/src/app - - # todo remove - - /Users/md/Documents/development/php--md-html-truncation:/tmp/php--md-html-truncation:ro extra_hosts: - "host.docker.internal:host-gateway" - entrypoint: ['sleep', '9000'] From 58250148b7cea353924956bec9d105822b502da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB=20=D0=94=D1=80=D0=B0?= =?UTF-8?q?=D0=B3=D1=83=D0=BD=D0=BA=D0=B8=D0=BD?= Date: Wed, 22 Apr 2026 10:32:44 +0300 Subject: [PATCH 2/3] enhancement: install dependency to speedup composer install in docker image 85 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d3a7904..2b75f95 100644 --- a/Dockerfile +++ b/Dockerfile @@ -71,7 +71,7 @@ FROM php:8.5 AS php85 RUN < Date: Wed, 22 Apr 2026 10:42:50 +0300 Subject: [PATCH 3/3] fix: phpstan warnings for phpunit of php7.1 --- .github/workflows/ci.yaml | 2 +- phpstan-baseline.71.neon | 13 +++++++++++++ phpstan.71.neon | 3 +++ phpstan.neon | 3 --- readme.md | 2 +- .../Twig/HTML/Extension/TruncateExtensionTest.php | 2 ++ 6 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 phpstan-baseline.71.neon create mode 100644 phpstan.71.neon diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 805aeac..1bd98cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -68,7 +68,7 @@ jobs: - name: Run PHPStan run: | export PHP_VERSION="${{ matrix.PHP_VERSION }}" - docker run -v "$PWD:/app" -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --rm ghcr.io/phpstan/phpstan analyse /app/src --configuration phpstan.neon --error-format=github + docker run -v "$PWD:/app" -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --rm ghcr.io/phpstan/phpstan analyse /app/src --configuration phpstan$([ "$PHP_VERSION" = "71" ] && echo ".71" || echo "").neon --error-format=github tests: name: Tests diff --git a/phpstan-baseline.71.neon b/phpstan-baseline.71.neon new file mode 100644 index 0000000..8e4e2b3 --- /dev/null +++ b/phpstan-baseline.71.neon @@ -0,0 +1,13 @@ +parameters: + ignoreErrors: + - + message: '#^Parameter \#1 \$truncate of class MD\\Bridge\\Twig\\HTML\\Extension\\TruncateExtension constructor expects MD\\HTML\\Action\\TruncateInterface, PHPUnit\\Framework\\MockObject\\MockObject given\.$#' + identifier: argument.type + count: 5 + path: tests/Functional/MD/Bridge/Twig/HTML/Extension/TruncateExtensionTest.php + + - + message: '#^Parameter \#1 \$truncate of class MD\\Bridge\\Twig\\HTML\\Extension\\TruncateExtension constructor expects MD\\HTML\\Action\\TruncateInterface, PHPUnit\\Framework\\MockObject\\MockObject given\.$#' + identifier: argument.type + count: 3 + path: tests/Unit/MD/Bridge/Twig/HTML/Extension/TruncateExtensionTest.php diff --git a/phpstan.71.neon b/phpstan.71.neon new file mode 100644 index 0000000..7b0f849 --- /dev/null +++ b/phpstan.71.neon @@ -0,0 +1,3 @@ +includes: + - phpstan.neon + - phpstan-baseline.71.neon diff --git a/phpstan.neon b/phpstan.neon index e4e80c8..9b16c3b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,6 +1,3 @@ -includes: - - phpstan-baseline.neon - parameters: paths: - src diff --git a/readme.md b/readme.md index 83a7531..b88dea7 100644 --- a/readme.md +++ b/readme.md @@ -105,7 +105,7 @@ for PHP_VERSION in '71' '80' '85'; do docker compose run -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --build --remove-orphans --env-from-file .env -e XDEBUG_MODE=coverage --entrypoint="bash -c 'composer install ; mv composer.lock composer.php$PHP_VERSION.lock'" run-tests docker compose run -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --build --remove-orphans --env-from-file .env -e XDEBUG_MODE=coverage --entrypoint="/usr/src/app/vendor/bin/phpunit --configuration /usr/src/app/phpunit.php$(( PHP_VERSION == 85 ? 80 : PHP_VERSION )).xml.dist --coverage-text" run-tests docker run -e "PHP_VERSION=$PHP_VERSION" -v "$PWD:/app" -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --rm -it ghcr.io/danog/psalm:latest /composer/vendor/bin/psalm --no-cache - docker run -e "PHP_VERSION=$PHP_VERSION" -v "$PWD:/app" -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --rm -it ghcr.io/phpstan/phpstan analyse --configuration phpstan.neon + docker run -e "PHP_VERSION=$PHP_VERSION" -v "$PWD:/app" -v "$PWD/vendor${PHP_VERSION}:/app/vendor" --rm -it ghcr.io/phpstan/phpstan analyse --configuration phpstan$([ "$PHP_VERSION" = "71" ] && echo ".71" || echo "").neon done; ``` diff --git a/tests/Unit/MD/Bridge/Twig/HTML/Extension/TruncateExtensionTest.php b/tests/Unit/MD/Bridge/Twig/HTML/Extension/TruncateExtensionTest.php index ee62209..bbf2514 100644 --- a/tests/Unit/MD/Bridge/Twig/HTML/Extension/TruncateExtensionTest.php +++ b/tests/Unit/MD/Bridge/Twig/HTML/Extension/TruncateExtensionTest.php @@ -45,6 +45,7 @@ public function testGetFilters(): void # white/positive # assert self::assertContainsOnlyInstancesOf(TwigFilter::class, $filters); + /** @var array{0: TwigFilter} $filters */ self::assertCount(1, $filters); self::assertSame('truncate_html_with_text_length', $filters[0]->getName()); self::assertSame([$truncate, 'withTextLength'], $filters[0]->getCallable()); @@ -64,6 +65,7 @@ public function testGetFunctions(): void # white/positive # assert self::assertContainsOnlyInstancesOf(TwigFunction::class, $functions); + /** @var array{0: TwigFunction} $functions */ self::assertCount(1, $functions); self::assertSame('truncate_html_with_text_length', $functions[0]->getName()); self::assertSame([$truncate, 'withTextLength'], $functions[0]->getCallable());