From 71ae753552563b36dc9f2202a3f28c71bcedcbfe Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Tue, 30 Jun 2026 21:33:43 +1000 Subject: [PATCH 01/16] switch supported PHP versions to 8.2+, testing against 8.2, 8.3, 8.4, 8,5 using phpunit 11 in GitHub actions Coveralls and Travis CI removed. --- .coveralls.yml | 4 - .github/workflows/ci.yml | 37 ++ .travis.yml | 40 -- composer.json | 10 +- composer.lock | 1270 +++++++++++++++----------------------- 5 files changed, 536 insertions(+), 825 deletions(-) delete mode 100644 .coveralls.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index b33373af..00000000 --- a/.coveralls.yml +++ /dev/null @@ -1,4 +0,0 @@ -service_name: travis-ci -coverage_clover: build/logs/clover.xml -json_path: build/logs/coveralls-upload.json - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..07e38597 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-version: ['8.2', '8.3', '8.4', '8.5'] + + steps: + - uses: actions/checkout@v4 + + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt-get install -y imagemagick ghostscript unifont + + - name: Set up PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --prefer-dist + + - name: Check code style + run: php vendor/bin/phpcs --standard=psr2 src/ -n + + - name: Run tests + run: php vendor/bin/phpunit + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 54ff8527..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -dist: xenial -sudo: required - -language: php - -php: - - '7.3' - - '7.4' - - '8.0' - - nightly - -matrix: - allow_failures: - - php: nightly - -before_install: - - sudo apt-get -qq update - - sudo apt-get install -y imagemagick ghostscript unifont - -install: - - composer install - -before_script: - # Install 'imagick' plugin - - bash -c 'if [[ $TRAVIS_PHP_VERSION != 8* ]] && [[ $TRAVIS_PHP_VERSION != "nightly" ]] ; then printf "\n" | pecl install imagick; fi' - # Directory for coverage report - - mkdir -p build/logs/ - -script: - # Check code style - - php vendor/bin/phpcs --standard=psr2 src/ -n - # Run tests - - php vendor/bin/phpunit --coverage-clover build/logs/clover.xml - -after_success: - # Upload coverage statistics to coveralls service after test - - wget -c -nc https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar - - php coveralls.phar -v -... diff --git a/composer.json b/composer.json index 74b1f977..6fb289c6 100644 --- a/composer.json +++ b/composer.json @@ -18,23 +18,23 @@ ], "config": { "platform": { - "php": "7.3.0" + "php": "8.2.0" } }, "require" : { - "php" : ">=7.3.0", + "php" : ">=8.2.0", "ext-json": "*", "ext-intl": "*", "ext-zlib": "*", - "mike42/gfx-php" : "^0.6" + "mike42/gfx-php" : "^1" }, "suggest" : { "ext-imagick" : "Will be used for image printing if present. Required for PDF printing or use of custom fonts.", "ext-gd" : "Used for image printing if present." }, "require-dev" : { - "phpunit/phpunit" : "^9", - "squizlabs/php_codesniffer" : "^3.3" + "phpunit/phpunit" : "^11", + "squizlabs/php_codesniffer" : "^4" }, "autoload" : { "psr-4" : { diff --git a/composer.lock b/composer.lock index ccae8360..94774d0a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,29 +4,29 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6adc3efd75fd38461b47c0058bd057b4", + "content-hash": "76da846d8841883cbe7b93e18e3cadc2", "packages": [ { "name": "mike42/gfx-php", - "version": "v0.6", + "version": "v1.0", "source": { "type": "git", "url": "https://github.com/mike42/gfx-php.git", - "reference": "ed9ded2a9298e4084a9c557ab74a89b71e43dbdb" + "reference": "f13863c32b2ecd1d897565b85f2e1eaec8cb6d2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mike42/gfx-php/zipball/ed9ded2a9298e4084a9c557ab74a89b71e43dbdb", - "reference": "ed9ded2a9298e4084a9c557ab74a89b71e43dbdb", + "url": "https://api.github.com/repos/mike42/gfx-php/zipball/f13863c32b2ecd1d897565b85f2e1eaec8cb6d2e", + "reference": "f13863c32b2ecd1d897565b85f2e1eaec8cb6d2e", "shasum": "" }, "require": { - "php": ">=7.0.0" + "php": ">=8.2.0" }, "require-dev": { - "phpbench/phpbench": "@dev", - "phpunit/phpunit": "^6.5", - "squizlabs/php_codesniffer": "^3.3.1" + "phpbench/phpbench": "^1", + "phpunit/phpunit": "^11", + "squizlabs/php_codesniffer": "^4" }, "type": "library", "autoload": { @@ -48,114 +48,47 @@ "homepage": "https://github.com/mike42/gfx-php", "support": { "issues": "https://github.com/mike42/gfx-php/issues", - "source": "https://github.com/mike42/gfx-php/tree/v0.6" + "source": "https://github.com/mike42/gfx-php/tree/v1.0" }, - "time": "2019-10-05T02:44:33+00:00" + "time": "2026-06-29T17:32:07+00:00" } ], "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-11-10T18:47:58+00:00" - }, { "name": "myclabs/deep-copy", - "version": "1.10.2", + "version": "1.13.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -171,7 +104,7 @@ ], "support": { "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" }, "funding": [ { @@ -179,29 +112,31 @@ "type": "tidelift" } ], - "time": "2020-11-13T09:40:50+00:00" + "time": "2025-08-01T08:46:24+00:00" }, { "name": "nikic/php-parser", - "version": "v4.10.4", + "version": "v5.7.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e" + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/c6d052fc58cb876152f89f532b95a8d7907e7f0e", - "reference": "c6d052fc58cb876152f89f532b95a8d7907e7f0e", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -209,7 +144,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -233,26 +168,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.10.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" }, - "time": "2020-12-20T10:01:03+00:00" + "time": "2025-12-06T11:56:16+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.1", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", - "reference": "85265efd3af7ba3ca4b2a2c34dbfc5788dd29133", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -293,22 +229,28 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2020-06-27T14:33:11+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", - "version": "3.1.0", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { @@ -344,275 +286,50 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" - }, - "time": "2021-02-23T14:00:09+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" - }, - "time": "2020-09-03T19:13:55+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "reference": "6a467b8989322d92aa1c8bf2bebcc6e5c2ba55c0", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.4.0" - }, - "time": "2020-09-17T18:55:26+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.12.2", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "245710e971a030f42e08f4912863805570f23d39" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/245710e971a030f42e08f4912863805570f23d39", - "reference": "245710e971a030f42e08f4912863805570f23d39", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.1", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0", - "phpunit/phpunit": "^8.0 || ^9.0" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.12.2" - }, - "time": "2020-12-19T10:15:11+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.5", + "version": "11.0.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1" + "reference": "2c1ed04922802c15e1de5d7447b4856de949cf56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f3e026641cc91909d421802dd3ac7827ebfd97e1", - "reference": "f3e026641cc91909d421802dd3ac7827ebfd97e1", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2c1ed04922802c15e1de5d7447b4856de949cf56", + "reference": "2c1ed04922802c15e1de5d7447b4856de949cf56", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.10.2", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" + "nikic/php-parser": "^5.7.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.1", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", + "theseer/tokenizer": "^1.3.1" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5.46" }, "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "9.2-dev" + "dev-main": "11.0.x-dev" } }, "autoload": { @@ -640,40 +357,53 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.5" + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.12" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage", + "type": "tidelift" } ], - "time": "2020-11-28T06:44:49+00:00" + "time": "2025-12-24T07:01:01+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "3.0.5", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8" + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/aa4be8575f26070b100fccb67faabb28f21f66f8", - "reference": "aa4be8575f26070b100fccb67faabb28f21f66f8", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2f3a64888c814fc235386b7387dd5b5ed92ad903", + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -700,36 +430,49 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.5" + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" } ], - "time": "2020-09-28T05:57:25+00:00" + "time": "2026-02-02T13:52:54+00:00" }, { "name": "phpunit/php-invoker", - "version": "3.1.1", + "version": "5.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "suggest": { "ext-pcntl": "*" @@ -737,7 +480,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -763,7 +506,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" }, "funding": [ { @@ -771,32 +515,32 @@ "type": "github" } ], - "time": "2020-09-28T05:58:55+00:00" + "time": "2024-07-03T05:07:44+00:00" }, { "name": "phpunit/php-text-template", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -822,7 +566,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" }, "funding": [ { @@ -830,32 +575,32 @@ "type": "github" } ], - "time": "2020-10-26T05:33:50+00:00" + "time": "2024-07-03T05:08:43+00:00" }, { "name": "phpunit/php-timer", - "version": "5.0.3", + "version": "7.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -881,7 +626,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" }, "funding": [ { @@ -889,59 +635,53 @@ "type": "github" } ], - "time": "2020-10-26T13:16:10+00:00" + "time": "2024-07-03T05:09:35+00:00" }, { "name": "phpunit/phpunit", - "version": "9.5.2", + "version": "11.5.55", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4" + "reference": "adc7262fccc12de2b30f12a8aa0b33775d814f00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f661659747f2f87f9e72095bb207bceb0f151cb4", - "reference": "f661659747f2f87f9e72095bb207bceb0f151cb4", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/adc7262fccc12de2b30f12a8aa0b33775d814f00", + "reference": "adc7262fccc12de2b30f12a8aa0b33775d814f00", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.1", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.3", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3", - "sebastian/version": "^3.0.2" - }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.12", + "phpunit/php-file-iterator": "^5.1.1", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.3", + "sebastian/comparator": "^6.3.3", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.1", + "sebastian/exporter": "^6.3.2", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/recursion-context": "^6.0.3", + "sebastian/type": "^5.1.3", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" + "ext-soap": "To be able to generate mocks based on WSDL files" }, "bin": [ "phpunit" @@ -949,15 +689,15 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.5-dev" + "dev-main": "11.5-dev" } }, "autoload": { - "classmap": [ - "src/" - ], "files": [ "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -980,44 +720,57 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.2" + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.55" }, "funding": [ { - "url": "https://phpunit.de/donate.html", + "url": "https://phpunit.de/sponsors.html", "type": "custom" }, { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" } ], - "time": "2021-02-02T14:45:58+00:00" + "time": "2026-02-18T12:37:06+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1040,7 +793,8 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" }, "funding": [ { @@ -1048,32 +802,32 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-07-03T04:41:36+00:00" }, { "name": "sebastian/code-unit", - "version": "1.0.8", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1096,7 +850,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit", "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" }, "funding": [ { @@ -1104,32 +859,32 @@ "type": "github" } ], - "time": "2020-10-26T13:08:54+00:00" + "time": "2025-03-19T07:56:08+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1151,7 +906,8 @@ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", "support": { "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" }, "funding": [ { @@ -1159,34 +915,39 @@ "type": "github" } ], - "time": "2020-09-28T05:30:19+00:00" + "time": "2024-07-03T04:45:54+00:00" }, { "name": "sebastian/comparator", - "version": "4.0.6", + "version": "6.3.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.4" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -1225,41 +986,54 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" } ], - "time": "2020-10-26T15:49:45+00:00" + "time": "2026-01-24T09:26:40+00:00" }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1282,7 +1056,8 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" }, "funding": [ { @@ -1290,33 +1065,33 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2024-07-03T04:49:50+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "6.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^11.0", "symfony/process": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1348,7 +1123,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" }, "funding": [ { @@ -1356,27 +1132,27 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-07-03T04:53:05+00:00" }, { "name": "sebastian/environment", - "version": "5.1.3", + "version": "7.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "suggest": { "ext-posix": "*" @@ -1384,7 +1160,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.1-dev" + "dev-main": "7.2-dev" } }, "autoload": { @@ -1403,7 +1179,7 @@ } ], "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", + "homepage": "https://github.com/sebastianbergmann/environment", "keywords": [ "Xdebug", "environment", @@ -1411,42 +1187,55 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.1" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" } ], - "time": "2020-09-28T05:52:38+00:00" + "time": "2025-05-21T11:55:47+00:00" }, { "name": "sebastian/exporter", - "version": "4.0.3", + "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65" + "reference": "70a298763b40b213ec087c51c739efcaa90bcd74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/d89cc98761b8cb5a1a235a6b703ae50d34080e65", - "reference": "d89cc98761b8cb5a1a235a6b703ae50d34080e65", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/70a298763b40b213ec087c51c739efcaa90bcd74", + "reference": "70a298763b40b213ec087c51c739efcaa90bcd74", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.3-dev" } }, "autoload": { @@ -1481,53 +1270,63 @@ } ], "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", + "homepage": "https://www.github.com/sebastianbergmann/exporter", "keywords": [ "export", "exporter" ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.3" + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.2" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" } ], - "time": "2020-09-28T05:24:23+00:00" + "time": "2025-09-24T06:12:51+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.2", + "version": "7.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455" + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/a90ccbddffa067b51f574dea6eb25d5680839455", - "reference": "a90ccbddffa067b51f574dea6eb25d5680839455", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -1546,13 +1345,14 @@ } ], "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ "global state" ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.2" + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -1560,33 +1360,33 @@ "type": "github" } ], - "time": "2020-10-26T15:55:19+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" + "nikic/php-parser": "^5.0", + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1609,7 +1409,8 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -1617,34 +1418,34 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { "name": "sebastian/object-enumerator", - "version": "4.0.4", + "version": "6.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1666,7 +1467,8 @@ "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -1674,32 +1476,32 @@ "type": "github" } ], - "time": "2020-10-26T13:12:34+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { "name": "sebastian/object-reflector", - "version": "2.0.4", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-main": "4.0-dev" } }, "autoload": { @@ -1721,7 +1523,8 @@ "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ { @@ -1729,32 +1532,32 @@ "type": "github" } ], - "time": "2020-10-26T13:14:26+00:00" + "time": "2024-07-03T05:01:32+00:00" }, { "name": "sebastian/recursion-context", - "version": "4.0.4", + "version": "6.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" + "reference": "f6458abbf32a6c8174f8f26261475dc133b3d9dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f6458abbf32a6c8174f8f26261475dc133b3d9dc", + "reference": "f6458abbf32a6c8174f8f26261475dc133b3d9dc", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1781,98 +1584,56 @@ } ], "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "homepage": "https://github.com/sebastianbergmann/recursion-context", "support": { "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" - } - ], - "time": "2020-10-26T13:17:30+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ + }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, { - "url": "https://github.com/sebastianbergmann", - "type": "github" + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2025-08-13T04:42:22+00:00" }, { "name": "sebastian/type", - "version": "2.3.1", + "version": "5.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2" + "reference": "f77d2d4e78738c98d9a68d2596fe5e8fa380f449" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/81cd61ab7bbf2de744aba0ea61fae32f721df3d2", - "reference": "81cd61ab7bbf2de744aba0ea61fae32f721df3d2", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/f77d2d4e78738c98d9a68d2596fe5e8fa380f449", + "reference": "f77d2d4e78738c98d9a68d2596fe5e8fa380f449", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^9.3" + "phpunit/phpunit": "^11.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1895,37 +1656,50 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.1" + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.3" }, "funding": [ { "url": "https://github.com/sebastianbergmann", "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/type", + "type": "tidelift" } ], - "time": "2020-10-26T13:18:59+00:00" + "time": "2025-08-09T06:55:48+00:00" }, { "name": "sebastian/version", - "version": "3.0.2", + "version": "5.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1948,7 +1722,8 @@ "homepage": "https://github.com/sebastianbergmann/version", "support": { "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -1956,41 +1731,36 @@ "type": "github" } ], - "time": "2020-09-28T06:39:44+00:00" + "time": "2024-10-09T05:16:32+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.8", + "version": "4.0.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "0525c73950de35ded110cffafb9892946d7771b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0525c73950de35ded110cffafb9892946d7771b5", + "reference": "0525c73950de35ded110cffafb9892946d7771b5", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.4.0" + "php": ">=7.2.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -1998,113 +1768,114 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2020-10-23T02:01:07+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-10T16:43:36+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.22.1", + "name": "staabm/side-effects-detector", + "version": "1.0.5", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e" + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/c6c942b1ac76c82448322025e084cadc56048b4e", - "reference": "c6c942b1ac76c82448322025e084cadc56048b4e", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" }, - "suggest": { - "ext-ctype": "For best performance" + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.22-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" + "classmap": [ + "lib/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", + "description": "A static analysis tool to detect side effects in PHP code", "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" + "static analysis" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.22.1" + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" }, "funding": [ { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/staabm", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" } ], - "time": "2021-01-07T16:49:33+00:00" + "time": "2024-10-20T05:08:20+00:00" }, { "name": "theseer/tokenizer", - "version": "1.2.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "75a63c33a8577608444246075ea0af0d052e452a" + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a", - "reference": "75a63c33a8577608444246075ea0af0d052e452a", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", "shasum": "" }, "require": { @@ -2133,7 +1904,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/master" + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" }, "funding": [ { @@ -2141,76 +1912,23 @@ "type": "github" } ], - "time": "2020-07-12T23:59:07+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.9.1", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" - }, - "type": "library", - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" - }, - "time": "2020-07-08T17:02:28+00:00" + "time": "2025-11-17T20:03:58+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.3.0", + "php": ">=8.2.0", "ext-json": "*", "ext-intl": "*", "ext-zlib": "*" }, - "platform-dev": [], + "platform-dev": {}, "platform-overrides": { - "php": "7.3.0" + "php": "8.2.0" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.9.0" } From c137e05f17bd84e34ce46af93a3cd7adea8d899a Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Tue, 30 Jun 2026 22:43:48 +1000 Subject: [PATCH 02/16] test fixes sufficient to get everything passing if deprecation warnings are ignored --- .github/workflows/ci.yml | 2 +- phpunit.xml | 17 ++++++----------- test/unit/CupsPrintConnectorTest.php | 2 +- test/unit/UriPrintConnectorTest.php | 17 ++++++++++------- test/unit/WindowsPrintConnectorTest.php | 12 ++++++------ 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07e38597..3161f716 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,5 +33,5 @@ jobs: run: php vendor/bin/phpcs --standard=psr2 src/ -n - name: Run tests - run: php vendor/bin/phpunit + run: php -d error_reporting=0 vendor/bin/phpunit diff --git a/phpunit.xml b/phpunit.xml index 158b7e07..27951daa 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,10 +1,5 @@ - + + test/unit @@ -13,9 +8,9 @@ verbose="true" test/integration - - + + src - - + + diff --git a/test/unit/CupsPrintConnectorTest.php b/test/unit/CupsPrintConnectorTest.php index dec680b9..1a46d3c7 100644 --- a/test/unit/CupsPrintConnectorTest.php +++ b/test/unit/CupsPrintConnectorTest.php @@ -24,7 +24,7 @@ public function testNoPrinter() } private function getMockConnector($path, array $printers) { - $stub = $this->getMockBuilder('Mike42\Escpos\PrintConnectors\CupsPrintConnector')->setMethods(array ( + $stub = $this->getMockBuilder('Mike42\Escpos\PrintConnectors\CupsPrintConnector')->onlyMethods(array ( 'getCmdOutput', 'getLocalPrinters' ))->disableOriginalConstructor()->getMock(); diff --git a/test/unit/UriPrintConnectorTest.php b/test/unit/UriPrintConnectorTest.php index 03fc9c31..846f680c 100644 --- a/test/unit/UriPrintConnectorTest.php +++ b/test/unit/UriPrintConnectorTest.php @@ -1,6 +1,6 @@ expectNotice(); - $this->expectNoticeMessage("not finalized"); + // An smb:// URI should be accepted and resolve to a WindowsPrintConnector. $connector = UriPrintConnector::get("smb://windows/printer"); - $this -> assertEquals('Mike42\Escpos\PrintConnectors\WindowsPrintConnector', get_class($connector)); - // We expect that this will throw an exception, we can't - // realistically print to a real printer in this test though... :) - $connector -> __destruct(); + $this -> assertInstanceOf(WindowsPrintConnector::class, $connector); + // Hack: swallow the "not finalized" notice from the destructor, since we + // never finalize() (can't print to a real SMB share from a unit test). + set_error_handler(function () { + return true; + }, E_USER_NOTICE); + unset($connector); + restore_error_handler(); } public function testBadUri() diff --git a/test/unit/WindowsPrintConnectorTest.php b/test/unit/WindowsPrintConnectorTest.php index a2370ddb..faaf7100 100644 --- a/test/unit/WindowsPrintConnectorTest.php +++ b/test/unit/WindowsPrintConnectorTest.php @@ -60,7 +60,7 @@ public function testComWindows() -> method('runCopy'); $connector -> finalize(); } - + public function testComMac() { // Cannot print to local printer on Mac with this connector @@ -74,7 +74,7 @@ public function testComMac() -> method('runCopy'); $connector -> finalize(); } - + public function testComLinux() { // Cannot print to local printer on Linux with this connector @@ -183,7 +183,7 @@ public function testSharedPrinterLinux() -> method('runWrite'); $connector -> finalize(); } - + public function testSharedPrinterLinuxUsername() { $connector = $this -> getMockConnector("smb://bob@example-pc/Printer", WindowsPrintConnector::PLATFORM_LINUX); @@ -196,7 +196,7 @@ public function testSharedPrinterLinuxUsername() -> method('runWrite'); $connector -> finalize(); } - + public function testSharedPrinterLinuxUsernameDomain() { $connector = $this -> getMockConnector("smb://bob@example-pc/home/Printer", WindowsPrintConnector::PLATFORM_LINUX); @@ -209,7 +209,7 @@ public function testSharedPrinterLinuxUsernameDomain() -> method('runWrite'); $connector -> finalize(); } - + public function testSharedPrinterLinuxUsernamePassword() { $connector = $this -> getMockConnector("smb://bob:secret@example-pc/Printer", WindowsPrintConnector::PLATFORM_LINUX); @@ -226,7 +226,7 @@ public function testSharedPrinterLinuxUsernamePassword() private function getMockConnector($path, $platform) { $stub = $this -> getMockBuilder('Mike42\Escpos\PrintConnectors\WindowsPrintConnector') - -> setMethods(array('runCopy', 'runCommand', 'getCurrentPlatform', 'runWrite')) + -> onlyMethods(array('runCopy', 'runCommand', 'getCurrentPlatform', 'runWrite')) -> disableOriginalConstructor() -> getMock(); $stub -> method('runCommand') From bd9c99ec8a9b76e1a620d42bd0f9982b5cb05f2c Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Tue, 30 Jun 2026 23:04:28 +1000 Subject: [PATCH 03/16] changes to phpunit test metadata (jsdoc style to attribute for larger tests) --- test/integration/ExampleTest.php | 38 ++-------------------------- test/unit/GdEscposImageTest.php | 17 ++----------- test/unit/ImagickEscposImageTest.php | 21 ++------------- test/unit/NativeEscposImageTest.php | 18 +++---------- 4 files changed, 9 insertions(+), 85 deletions(-) diff --git a/test/integration/ExampleTest.php b/test/integration/ExampleTest.php index a19d64a1..0d751edf 100644 --- a/test/integration/ExampleTest.php +++ b/test/integration/ExampleTest.php @@ -1,6 +1,8 @@ exampleDir = dirname(__FILE__) . "/../../example/"; } - /** - * @medium - */ public function testBitImage() { $this->markTestSkipped('Not repeatable on Travis CI.'); @@ -22,18 +21,12 @@ public function testBitImage() $this -> outpTest($outp, "bit-image.bin"); } - /** - * @medium - */ public function testCharacterEncodings() { $outp = $this -> runExample("character-encodings.php"); $this -> outpTest($outp, "character-encodings.bin"); } - /** - * @medium - */ public function testCharacterTables() { $outp = $this -> runExample("character-tables.php"); @@ -49,9 +42,6 @@ private function outpTest($outp, $fn) $this -> assertEquals($outp, file_get_contents($file)); } - /** - * @medium - */ public function testDemo() { $this->markTestSkipped('Not repeatable on Travis CI.'); @@ -60,9 +50,6 @@ public function testDemo() $this -> outpTest($outp, "demo.bin"); } - /** - * @medium - */ public function testGraphics() { $this->markTestSkipped('Not repeatable on Travis CI.'); @@ -71,9 +58,6 @@ public function testGraphics() $this -> outpTest($outp, "graphics.bin"); } - /** - * @medium - */ public function testReceiptWithLogo() { $this->markTestSkipped('Not repeatable on Travis CI.'); @@ -82,54 +66,36 @@ public function testReceiptWithLogo() $this -> outpTest($outp, "receipt-with-logo.bin"); } - /** - * @medium - */ public function testQrCode() { $outp = $this -> runExample("qr-code.php"); $this -> outpTest($outp, "qr-code.bin"); } - /** - * @medium - */ public function testBarcode() { $outp = $this -> runExample("barcode.php"); $this -> outpTest($outp, "barcode.bin"); } - /** - * @medium - */ public function testTextSize() { $outp = $this -> runExample("text-size.php"); $this -> outpTest($outp, "text-size.bin"); } - /** - * @medium - */ public function testMarginsAndSpacing() { $outp = $this -> runExample("margins-and-spacing.php"); $this -> outpTest($outp, "margins-and-spacing.bin"); } - /** - * @medium - */ public function testPdf417Code() { $outp = $this -> runExample("pdf417-code.php"); $this -> outpTest($outp, "pdf417-code.bin"); } - /** - * @medium - */ public function testUnifontPrintBuffer() { $this->markTestSkipped('Not repeatable on Travis CI.'); diff --git a/test/unit/GdEscposImageTest.php b/test/unit/GdEscposImageTest.php index d481d7a6..9ca75436 100644 --- a/test/unit/GdEscposImageTest.php +++ b/test/unit/GdEscposImageTest.php @@ -1,7 +1,9 @@ loadAndCheckImg('not a real file.png', 1, 1, null, null); } - /** - * @medium - */ public function testGdEmpty() { $this -> loadAndCheckImg(null, 0, 0, "", array()); } - /** - * @medium - */ public function testGdBlack() { foreach (array('png', 'jpg', 'gif') as $format) { @@ -33,9 +29,6 @@ public function testGdBlack() } } - /** - * @medium - */ public function testGdBlackTransparent() { foreach (array('png', 'gif') as $format) { @@ -43,9 +36,6 @@ public function testGdBlackTransparent() } } - /** - * @medium - */ public function testGdBlackWhite() { foreach (array('png', 'jpg', 'gif') as $format) { @@ -53,9 +43,6 @@ public function testGdBlackWhite() } } - /** - * @medium - */ public function testGdWhite() { foreach (array('png', 'jpg', 'gif') as $format) { diff --git a/test/unit/ImagickEscposImageTest.php b/test/unit/ImagickEscposImageTest.php index 4eed75a8..ccc19e6a 100644 --- a/test/unit/ImagickEscposImageTest.php +++ b/test/unit/ImagickEscposImageTest.php @@ -1,7 +1,9 @@ loadAndCheckImg('not a real file.png', 1, 1, null, null); } - /** - * @medium - */ public function testImagickEmpty() { $this -> loadAndCheckImg(null, 0, 0, "", array()); } - /** - * @medium - */ public function testImagickBlack() { foreach (array('png', 'jpg', 'gif') as $format) { @@ -33,9 +29,6 @@ public function testImagickBlack() } } - /** - * @medium - */ public function testImagickBlackTransparent() { foreach (array('png', 'gif') as $format) { @@ -43,9 +36,6 @@ public function testImagickBlackTransparent() } } - /** - * @medium - */ public function testImagickBlackWhite() { foreach (array('png', 'jpg', 'gif') as $format) { @@ -53,9 +43,6 @@ public function testImagickBlackWhite() } } - /** - * @medium - */ public function testImagickBlackWhiteTall() { // We're very interested in correct column format chopping here at 8 pixels @@ -63,9 +50,6 @@ public function testImagickBlackWhiteTall() "\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x00\x00\x00\x00\x00\x00\x00\x00", array("\xff\xff", "\x00\x00")); } - /** - * @medium - */ public function testImagickWhite() { foreach (array('png', 'jpg', 'gif') as $format) { @@ -76,7 +60,6 @@ public function testImagickWhite() /** * PDF test - load tiny PDF and check for well-formedness * These are also skipped if you don't have imagick - * @medium */ public function testPdfAllPages() { diff --git a/test/unit/NativeEscposImageTest.php b/test/unit/NativeEscposImageTest.php index 3c6440b7..75c68302 100644 --- a/test/unit/NativeEscposImageTest.php +++ b/test/unit/NativeEscposImageTest.php @@ -1,7 +1,9 @@ loadAndCheckImg('not a real file.png', 1, 1, null, null); } - /** - * @medium - */ + public function testBlack() { foreach (array('bmp', 'gif', 'png') as $format) { @@ -24,9 +24,6 @@ public function testBlack() } } - /** - * @medium - */ public function testBlackTransparent() { foreach (array('gif', 'png') as $format) { @@ -34,9 +31,6 @@ public function testBlackTransparent() } } - /** - * @medium - */ public function testBlackWhite() { foreach (array('bmp', 'png', 'gif') as $format) { @@ -44,9 +38,6 @@ public function testBlackWhite() } } - /** - * @medium - */ public function testBlackWhiteTall() { // We're very interested in correct column format chopping here at 8 pixels @@ -54,9 +45,6 @@ public function testBlackWhiteTall() "\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x00\x00\x00\x00\x00\x00\x00\x00", array("\xff\xff", "\x00\x00")); } - /** - * @medium - */ public function testWhite() { foreach (array('bmp', 'png', 'gif') as $format) { From 4833cff9bc5279fb88258b70a92555dc87f6bb8e Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Tue, 30 Jun 2026 23:58:05 +1000 Subject: [PATCH 04/16] account for PHP 8.5 changes in code page mapper --- src/Mike42/Escpos/CodePage.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Mike42/Escpos/CodePage.php b/src/Mike42/Escpos/CodePage.php index 54b3cb6e..48f88fef 100644 --- a/src/Mike42/Escpos/CodePage.php +++ b/src/Mike42/Escpos/CodePage.php @@ -146,7 +146,7 @@ public function isEncodable() } /** - * Given an ICU encoding name, generate a 128-entry array, with the unicode code points + * Given an ICU encoding name, generate a 128-entry array, with the Unicode code points * for the character at positions 128-255 in this code page. * * @param string $encodingName Name of the encoding @@ -156,8 +156,13 @@ protected static function generateEncodingArray(string $encodingName) : array { // Set up converter for encoding $missingChar = chr(self::MISSING_CHAR_CODE); - // Throws a lot of warnings for ambiguous code pages, but fallbacks seem fine. - $converter = @new \UConverter("UTF-8", $encodingName); + try { + $converter = new \UConverter("UTF-8", $encodingName); + } catch (\IntlException $e) { + // In PHP 8.5+ an unknown encoding will throw. We are enumerating every character we know how to print, + // and it is common/expected that we will encounter things unsupported by the host OS. + return array_fill(0, 128, self::MISSING_CHAR_CODE); + } $converter -> setSubstChars($missingChar); // Loop through 128 code points $intArray = array_fill(0, 128, self::MISSING_CHAR_CODE); @@ -166,12 +171,12 @@ protected static function generateEncodingArray(string $encodingName) : array $encodingChar = chr($char); $utf8 = $converter ->convert($encodingChar, false); if ($utf8 === $missingChar || $utf8 === false) { - // Cannot be mapped to unicode + // Cannot be mapped to Unicode continue; } $reverse = $converter ->convert($utf8, true); if ($reverse !== $encodingChar) { - // Avoid conversions which don't reverse well (eg. multi-byte code pages) + // Avoid conversions which don't reverse well (eg. multibyte code pages) continue; } // Replace space with the correct character if we found it From 85bcf71a8cffaff63cb8f64419253df5df1b3ff6 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 00:13:47 +1000 Subject: [PATCH 05/16] remove '-d error_reporting=0' from PHPUnit, clear all deprecations --- .github/workflows/ci.yml | 3 +-- src/Mike42/Escpos/EscposImage.php | 2 +- src/Mike42/Escpos/Experimental/Unifont/FontMap.php | 2 ++ src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php | 2 +- src/Mike42/Escpos/GdEscposImage.php | 2 +- src/Mike42/Escpos/ImagickEscposImage.php | 2 +- src/Mike42/Escpos/NativeEscposImage.php | 2 +- src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php | 2 +- src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php | 2 +- src/Mike42/Escpos/PrintBuffers/PrintBuffer.php | 2 +- src/Mike42/Escpos/Printer.php | 4 ++-- test/unit/ImagickEscposImageTest.php | 2 +- 12 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3161f716..84d59400 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,5 +33,4 @@ jobs: run: php vendor/bin/phpcs --standard=psr2 src/ -n - name: Run tests - run: php -d error_reporting=0 vendor/bin/phpunit - + run: php vendor/bin/phpunit diff --git a/src/Mike42/Escpos/EscposImage.php b/src/Mike42/Escpos/EscposImage.php index 44322e8f..e7a357ee 100644 --- a/src/Mike42/Escpos/EscposImage.php +++ b/src/Mike42/Escpos/EscposImage.php @@ -198,7 +198,7 @@ public function toColumnFormat($doubleDensity = false) * * @param string|null $filename Filename to load from. */ - protected function loadImageData(string $filename = null) + protected function loadImageData(?string $filename = null) { // Load image in to string of 1's and 0's, also set width & height $this -> setImgWidth(0); diff --git a/src/Mike42/Escpos/Experimental/Unifont/FontMap.php b/src/Mike42/Escpos/Experimental/Unifont/FontMap.php index 9d8a6962..6f39293f 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/FontMap.php +++ b/src/Mike42/Escpos/Experimental/Unifont/FontMap.php @@ -36,6 +36,8 @@ class FontMap // next available slot protected $next = 0; + private ColumnFormatGlyphFactory $glyphFactory; + public function __construct(ColumnFormatGlyphFactory $glyphFactory, Printer $printer) { $this -> printer = $printer; diff --git a/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php b/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php index dad95490..5e61f0bd 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php +++ b/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php @@ -77,7 +77,7 @@ public function flush() { } - public function setPrinter(Printer $printer = null) + public function setPrinter(?Printer $printer = null) { $this -> printer = $printer; $this -> fontMap = new FontMap($this -> unifont, $this -> printer); diff --git a/src/Mike42/Escpos/GdEscposImage.php b/src/Mike42/Escpos/GdEscposImage.php index 57eed180..197fb7d9 100644 --- a/src/Mike42/Escpos/GdEscposImage.php +++ b/src/Mike42/Escpos/GdEscposImage.php @@ -29,7 +29,7 @@ class GdEscposImage extends EscposImage * @throws Exception if the image format is not supported, * or the file cannot be opened. */ - protected function loadImageData(string $filename = null) + protected function loadImageData(?string $filename = null) { if ($filename === null) { /* Set to blank image */ diff --git a/src/Mike42/Escpos/ImagickEscposImage.php b/src/Mike42/Escpos/ImagickEscposImage.php index aa7c7750..b153ff1c 100644 --- a/src/Mike42/Escpos/ImagickEscposImage.php +++ b/src/Mike42/Escpos/ImagickEscposImage.php @@ -88,7 +88,7 @@ protected function getColumnFormatFromFile($filename = null, $highDensityVertica * @throws Exception if the image format is not supported, * or the file cannot be opened. */ - protected function loadImageData(string $filename = null) + protected function loadImageData(?string $filename = null) { if ($filename === null) { /* Set to blank image */ diff --git a/src/Mike42/Escpos/NativeEscposImage.php b/src/Mike42/Escpos/NativeEscposImage.php index 960d4989..86d9be48 100644 --- a/src/Mike42/Escpos/NativeEscposImage.php +++ b/src/Mike42/Escpos/NativeEscposImage.php @@ -22,7 +22,7 @@ */ class NativeEscposImage extends EscposImage { - protected function loadImageData(string $filename = null) + protected function loadImageData(?string $filename = null) { $image = Image::fromFile($filename) -> toRgb() -> toBlackAndWhite(); $imgHeight = $image -> getHeight(); diff --git a/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php index 60382d74..9794ff0c 100644 --- a/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php @@ -75,7 +75,7 @@ public function getPrinter() return $this -> printer; } - public function setPrinter(Printer $printer = null) + public function setPrinter(?Printer $printer = null) { $this -> printer = $printer; if ($printer != null) { diff --git a/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php index 4203e1ae..2f18b2dd 100644 --- a/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php @@ -58,7 +58,7 @@ public function getPrinter() return $this -> printer; } - public function setPrinter(Printer $printer = null) + public function setPrinter(?Printer $printer = null) { $this -> printer = $printer; } diff --git a/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php index 384c18ff..44db6952 100644 --- a/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php @@ -48,7 +48,7 @@ public function getPrinter(); * * @param Printer|null $printer New printer */ - public function setPrinter(Printer $printer = null); + public function setPrinter(?Printer $printer = null); /** * Accept UTF-8 text for printing. diff --git a/src/Mike42/Escpos/Printer.php b/src/Mike42/Escpos/Printer.php index 05c8a6f0..3b9513cf 100644 --- a/src/Mike42/Escpos/Printer.php +++ b/src/Mike42/Escpos/Printer.php @@ -357,7 +357,7 @@ class Printer * @param CapabilityProfile|null $profile Supported features of this printer. If not set, the "default" CapabilityProfile will be used, which is suitable for Epson printers. * @throws InvalidArgumentException */ - public function __construct(PrintConnector $connector, CapabilityProfile $profile = null) + public function __construct(PrintConnector $connector, ?CapabilityProfile $profile = null) { /* Set connector */ $this -> connector = $connector; @@ -882,7 +882,7 @@ public function setJustification(int $justification = Printer::JUSTIFY_LEFT) * @param int|null $height The height of each line, in dots. If not set, the printer * will reset to its default line spacing. */ - public function setLineSpacing(int $height = null) + public function setLineSpacing(?int $height = null) { if ($height === null) { // Reset to default diff --git a/test/unit/ImagickEscposImageTest.php b/test/unit/ImagickEscposImageTest.php index ccc19e6a..33a7e581 100644 --- a/test/unit/ImagickEscposImageTest.php +++ b/test/unit/ImagickEscposImageTest.php @@ -98,7 +98,7 @@ private function loadAndCheckImg($fn, $width, $height, $rasterFormat = null, $co /** * Same as above, loading document and checking pages against some expected values. */ - private function loadAndCheckPdf($fn, $width, $height, array $rasterFormat = null, array $columnFormat = null) + private function loadAndCheckPdf($fn, $width, $height, ?array $rasterFormat = null, ?array $columnFormat = null) { if (!EscposImage::isImagickLoaded()) { $this -> markTestSkipped("imagick plugin required for this test"); From 5667261818e934750675c4a447743c4582879224 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 00:30:10 +1000 Subject: [PATCH 06/16] replace badges in the README --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1a9a9ba0..413f83b4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # ESC/POS Print Driver for PHP -[![Build Status](https://travis-ci.org/mike42/escpos-php.svg?branch=master)](https://travis-ci.org/mike42/escpos-php) [![Latest Stable Version](https://poser.pugx.org/mike42/escpos-php/v/stable)](https://packagist.org/packages/mike42/escpos-php) -[![Total Downloads](https://poser.pugx.org/mike42/escpos-php/downloads)](https://packagist.org/packages/mike42/escpos-php) -[![License](https://poser.pugx.org/mike42/escpos-php/license)](https://packagist.org/packages/mike42/escpos-php) -[![Coverage Status](https://coveralls.io/repos/github/mike42/escpos-php/badge.svg?branch=development)](https://coveralls.io/github/mike42/escpos-php?branch=development) + +[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mike42/escpos-php/ci.yml?branch=main&style=flat-square)](https://github.com/mike42/escpos-php/actions/workflows/ci.yml) +[![Packagist Version](https://img.shields.io/packagist/v/mike42/escpos-php?style=flat-square&color=007ec6)](https://packagist.org/packages/mike42/escpos-php) +[![Packagist Downloads](https://img.shields.io/packagist/dt/mike42/escpos-php?style=flat-square)](https://packagist.org/packages/mike42/escpos-php) +[![Packagist License](https://img.shields.io/packagist/l/mike42/escpos-php?style=flat-square&color=007ec6)](https://github.com/mike42/escpos-php/blob/development/LICENSE.md) This project implements a subset of Epson's ESC/POS protocol for thermal receipt printers. It allows you to generate and print receipts with basic formatting, cutting, and barcodes on a compatible printer. From 61408da2c7812c4eac4ad467b10609baaeb27850 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 00:38:46 +1000 Subject: [PATCH 07/16] update LICENSE.md for year, README.md for current dev practices --- LICENSE.md | 2 +- README.md | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 0e04f34f..e61587da 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2014-2016 Michael Billington, incorporating modifications by others. +Copyright (c) 2014-2026 Michael Billington, incorporating modifications by others. See CONTRIBUTORS.md for a full list. Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/README.md b/README.md index 413f83b4..36ce550c 100644 --- a/README.md +++ b/README.md @@ -179,15 +179,12 @@ If you haven't used `composer` before, you can read about it at [getcomposer.org This project has few hard dependencies: -- PHP 7.3 or newer. +- PHP 8.2 or newer. - `json` extension, used to load bundled printer definitions (see [documentation](https://www.php.net/manual/en/book.json.php)) - `intl` extension, used for character encoding (see [documentation](https://www.php.net/manual/en/book.intl.php)) - `zlib` extension, used for de-compressing bundled resources (see [documentation](https://www.php.net/manual/en/book.zlib.php)). -It is also suggested that you install either `imagick` or `gd`, as these can be used to speed up image processing. - -A number of optional extensions can be added to enable more specific features. These -are described in the "suggest" section of [composer.json](https://github.com/mike42/escpos-php/tree/master/composer.json). +It is also suggested that you install either `imagick` or `gd`, as these will be used to speed up image processing if present. The [gfx-php](https://github.com/mike42/gfx-php) library will otherwise be used as a fallback. ### The 'Hello World' receipt @@ -553,7 +550,7 @@ This code is MIT licensed, and you are encouraged to contribute any modification For development, it's suggested that you load `imagick`, `gd` and `Xdebug` PHP extensions. -The tests are executed on [Travis CI](https://travis-ci.org/mike42/escpos-php) over PHP 7.3, 7.4 and 8.0. Older versions of PHP are not supported in the current release, nor is HHVM. +The tests are executed [via GitHub actions](https://github.com/mike42/escpos-php/blob/main/.github/workflows/ci.yml) on PHP 8.2, 8.3, 8.4 and 8.5. Older versions of PHP are not supported in the current release. Fetch a copy of this code and load dependencies with composer: @@ -565,11 +562,15 @@ Execute unit tests via `phpunit`: php vendor/bin/phpunit --coverage-text +Or with coverage: + + XDEBUG_MODE=coverage php vendor/bin/phpunit --coverage-text + This project uses the PSR-2 standard, which can be checked via [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer): php vendor/bin/phpcs --standard=psr2 src/ -n -The developer docs are build with [doxygen](https://github.com/doxygen/doxygen). Re-build them to check for documentation warnings: +The developer docs are not currently maintained, but were built with [doxygen](https://github.com/doxygen/doxygen). Re-build them to check for documentation warnings: make -C doc clean && make -C doc From 9722c20058516fb5cfbe9156d58b3057abf80610 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 00:42:04 +1000 Subject: [PATCH 08/16] bump copyright year on src/ files --- src/Mike42/Escpos/CapabilityProfile.php | 2 +- src/Mike42/Escpos/CodePage.php | 2 +- src/Mike42/Escpos/Devices/AuresCustomerDisplay.php | 2 +- src/Mike42/Escpos/EscposImage.php | 2 +- src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyph.php | 2 +- .../Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php | 2 +- src/Mike42/Escpos/Experimental/Unifont/FontMap.php | 2 +- src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php | 2 +- src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php | 2 +- src/Mike42/Escpos/GdEscposImage.php | 2 +- src/Mike42/Escpos/ImagickEscposImage.php | 2 +- src/Mike42/Escpos/NativeEscposImage.php | 2 +- src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php | 2 +- src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php | 2 +- src/Mike42/Escpos/PrintBuffers/PrintBuffer.php | 2 +- src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/PrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php | 2 +- src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php | 2 +- src/Mike42/Escpos/Printer.php | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Mike42/Escpos/CapabilityProfile.php b/src/Mike42/Escpos/CapabilityProfile.php index ac55c384..ffba9f8c 100644 --- a/src/Mike42/Escpos/CapabilityProfile.php +++ b/src/Mike42/Escpos/CapabilityProfile.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/CodePage.php b/src/Mike42/Escpos/CodePage.php index 48f88fef..993b6d21 100644 --- a/src/Mike42/Escpos/CodePage.php +++ b/src/Mike42/Escpos/CodePage.php @@ -3,7 +3,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php b/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php index 3b1ff7a6..9274a4d6 100644 --- a/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php +++ b/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/EscposImage.php b/src/Mike42/Escpos/EscposImage.php index e7a357ee..3af0c187 100644 --- a/src/Mike42/Escpos/EscposImage.php +++ b/src/Mike42/Escpos/EscposImage.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyph.php b/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyph.php index f136a759..adaad45d 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyph.php +++ b/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyph.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php b/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php index 3514190c..9b52c2ce 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php +++ b/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Experimental/Unifont/FontMap.php b/src/Mike42/Escpos/Experimental/Unifont/FontMap.php index 6f39293f..fbabb505 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/FontMap.php +++ b/src/Mike42/Escpos/Experimental/Unifont/FontMap.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php b/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php index ec24e294..f2acb75d 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php +++ b/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php b/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php index 5e61f0bd..a1c53450 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php +++ b/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/GdEscposImage.php b/src/Mike42/Escpos/GdEscposImage.php index 197fb7d9..ddd39cd9 100644 --- a/src/Mike42/Escpos/GdEscposImage.php +++ b/src/Mike42/Escpos/GdEscposImage.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/ImagickEscposImage.php b/src/Mike42/Escpos/ImagickEscposImage.php index b153ff1c..86c4d51e 100644 --- a/src/Mike42/Escpos/ImagickEscposImage.php +++ b/src/Mike42/Escpos/ImagickEscposImage.php @@ -3,7 +3,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/NativeEscposImage.php b/src/Mike42/Escpos/NativeEscposImage.php index 86d9be48..753b3c4a 100644 --- a/src/Mike42/Escpos/NativeEscposImage.php +++ b/src/Mike42/Escpos/NativeEscposImage.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php index 9794ff0c..e4f2f949 100644 --- a/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php index 2f18b2dd..7f359cab 100644 --- a/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php index 44db6952..22a5a39a 100644 --- a/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php index 3ef25c8f..9c61896e 100644 --- a/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php index 9b27605d..80d2b255 100644 --- a/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php b/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php index 0ab30637..7f9f5dc9 100644 --- a/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php b/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php index 7f954195..c780bc09 100644 --- a/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php index 0ca78115..0327c14f 100644 --- a/src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php @@ -3,7 +3,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/PrintConnector.php b/src/Mike42/Escpos/PrintConnectors/PrintConnector.php index e95b54db..9f8c4636 100644 --- a/src/Mike42/Escpos/PrintConnectors/PrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/PrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php index 92fd5a13..5e76ce63 100644 --- a/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php index 204a304d..b8f0049d 100644 --- a/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php index a1763b5a..733b7683 100644 --- a/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php @@ -4,7 +4,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md diff --git a/src/Mike42/Escpos/Printer.php b/src/Mike42/Escpos/Printer.php index 3b9513cf..c4f0b3f6 100644 --- a/src/Mike42/Escpos/Printer.php +++ b/src/Mike42/Escpos/Printer.php @@ -3,7 +3,7 @@ * This file is part of escpos-php: PHP receipt printer library for use with * ESC/POS-compatible thermal and impact printers. * - * Copyright (c) 2014-20 Michael Billington < michael.billington@gmail.com >, + * Copyright (c) 2014-2026 Michael Billington < michael.billington@gmail.com >, * incorporating modifications by others. See CONTRIBUTORS.md for a full list. * * This software is distributed under the terms of the MIT license. See LICENSE.md From 514fba7647cdfadc5bcce57dfead2bc9283f98c7 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 00:45:52 +1000 Subject: [PATCH 09/16] add a .gitattributes file to remove test files leaving examples in the distribution for now --- .gitattributes | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..d8483259 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +* text=auto + +.gitattributes export-ignore +.gitignore export-ignore +.github/ export-ignore +docs/ export-ignore +phpunit.xml export-ignore +test/ export-ignore +composer.lock export-ignore + From 15311147c64272bb47f1de3c367ece3e035cacc6 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 00:54:05 +1000 Subject: [PATCH 10/16] zip though all files and apply consistent PSR-12 header ordering --- src/Mike42/Escpos/CodePage.php | 5 ++++- src/Mike42/Escpos/ImagickEscposImage.php | 5 ++++- src/Mike42/Escpos/PrintConnectors/NetworkPrintConnector.php | 5 ++++- src/Mike42/Escpos/Printer.php | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Mike42/Escpos/CodePage.php b/src/Mike42/Escpos/CodePage.php index 993b6d21..b497fa1f 100644 --- a/src/Mike42/Escpos/CodePage.php +++ b/src/Mike42/Escpos/CodePage.php @@ -1,4 +1,5 @@ - Date: Wed, 1 Jul 2026 01:58:44 +1000 Subject: [PATCH 11/16] add type hints over majority of public API --- src/Mike42/Escpos/CapabilityProfile.php | 34 +++--- .../Escpos/Devices/AuresCustomerDisplay.php | 18 +-- .../Unifont/ColumnFormatGlyphFactory.php | 2 +- .../Escpos/Experimental/Unifont/FontMap.php | 26 ++-- .../Unifont/UnifontGlyphFactory.php | 8 +- .../Unifont/UnifontPrintBuffer.php | 14 +-- .../Escpos/PrintBuffers/EscposPrintBuffer.php | 20 ++-- .../Escpos/PrintBuffers/ImagePrintBuffer.php | 24 ++-- .../Escpos/PrintBuffers/PrintBuffer.php | 10 +- .../PrintConnectors/CupsPrintConnector.php | 23 ++-- .../PrintConnectors/DummyPrintConnector.php | 6 +- .../PrintConnectors/FilePrintConnector.php | 10 +- .../MultiplePrintConnector.php | 8 +- .../Escpos/PrintConnectors/PrintConnector.php | 10 +- .../PrintConnectors/RawbtPrintConnector.php | 21 ++-- .../PrintConnectors/UriPrintConnector.php | 2 +- .../PrintConnectors/WindowsPrintConnector.php | 18 +-- src/Mike42/Escpos/Printer.php | 111 +++++++++--------- 18 files changed, 180 insertions(+), 185 deletions(-) diff --git a/src/Mike42/Escpos/CapabilityProfile.php b/src/Mike42/Escpos/CapabilityProfile.php index ffba9f8c..cf592934 100644 --- a/src/Mike42/Escpos/CapabilityProfile.php +++ b/src/Mike42/Escpos/CapabilityProfile.php @@ -28,84 +28,84 @@ class CapabilityProfile * @var string $codePageCacheKey * Hash of the code page data structure, to identify it for caching. */ - protected $codePageCacheKey; + protected string $codePageCacheKey; /** * * @var array $codePages * Associtive array of CodePage objects, indicating which encodings the printer supports. */ - protected $codePages; + protected array $codePages; /** * * @var array $colors * Not used. */ - protected $colors; + protected array $colors; /** * * @var array $features * Feature values. */ - protected $features; + protected array $features; /** * * @var array $fonts * Not used */ - protected $fonts; + protected array $fonts; /** * * @var array $media * Not used */ - protected $media; + protected array $media; /** * * @var string $name * Name of the profile, including model number. */ - protected $name; + protected string $name; /** * * @var string $notes * Notes on the profile, null if not set. */ - protected $notes; + protected string $notes; /** * * @var string $profileId * ID of the profile. */ - protected $profileId; + protected string $profileId; /** * @var string $vendor * Name of manufacturer. */ - protected $vendor; + protected string $vendor; /** * - * @var array $encodings + * @var array|null $encodings * Data structure containing encodings loaded from disk, null if not loaded yet. */ - protected static $encodings = null; + protected static ?array $encodings = null; /** * - * @var array $profiles + * @var array|null $profiles * Data structure containing profiles loaded from disk, null if not loaded yet. */ - protected static $profiles = null; + protected static ?array $profiles = null; /** * Construct new CapabilityProfile. @@ -158,11 +158,11 @@ public function getCodePages() : array * * @param string $featureName * Name of the feature to retrieve. - * @throws \InvalidArgumentException Where the feature does not exist. + * @throws InvalidArgumentException Where the feature does not exist. * The exception will contain suggestions for the closest-named features. - * @return mixed feature value. + * @return bool feature value. */ - public function getFeature($featureName) + public function getFeature($featureName): bool { if (isset($this->features[$featureName])) { return $this->features[$featureName]; diff --git a/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php b/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php index 9274a4d6..3e23d49b 100644 --- a/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php +++ b/src/Mike42/Escpos/Devices/AuresCustomerDisplay.php @@ -48,7 +48,7 @@ class AuresCustomerDisplay extends Printer * * @see \Mike42\Escpos\Printer::initialize() */ - public function initialize() + public function initialize(): void { // Select ESC/POS mode first $this->selectEscposMode(); @@ -64,7 +64,7 @@ public function initialize() * * This device supports other modes, which are not used. */ - protected function selectEscposMode() + protected function selectEscposMode(): void { $this->connector->write("\x02\x05\x43\x31\x03"); } @@ -77,7 +77,7 @@ protected function selectEscposMode() * AuresCustomerDisplay::TEXT_VERTICAL_SCROLL or * AuresCustomerDisplay::TEXT_HORIZONTAL_SCROLL */ - public function selectTextScrollMode(int $mode = AuresCustomerDisplay::TEXT_VERTICAL_SCROLL) + public function selectTextScrollMode(int $mode = AuresCustomerDisplay::TEXT_VERTICAL_SCROLL): void { self::validateInteger($mode, 1, 3, __FUNCTION__); $this->connector->write("\x1F" . chr($mode)); @@ -86,7 +86,7 @@ public function selectTextScrollMode(int $mode = AuresCustomerDisplay::TEXT_VERT /** * Clear the display. */ - public function clear() + public function clear(): void { $this->connector->write("\x0c"); } @@ -94,7 +94,7 @@ public function clear() /** * Instruct the display to show the firmware version. */ - public function showFirmwareVersion() + public function showFirmwareVersion(): void { $this->connector->write("\x02\x05\x56\x01\x03"); } @@ -102,7 +102,7 @@ public function showFirmwareVersion() /** * Instruct the display to begin a self-test/demo sequence. */ - public function selfTest() + public function selfTest(): void { $this->connector->write("\x02\x05\x44\x08\x03"); } @@ -114,7 +114,7 @@ public function selfTest() * logo, but that the vendor supplies software * which has this function. */ - public function showLogo() + public function showLogo(): void { $this->connector->write("\x02\xFC\x55\xAA\x55\xAA"); } @@ -125,7 +125,7 @@ public function showLogo() * * @see \Mike42\Escpos\Printer::text() */ - public function text(string $str) + public function text(string $str): void { // Need to intercept line-feeds, since "\n" is insufficient on this device. foreach (explode("\n", $str) as $id => $line) { @@ -142,7 +142,7 @@ public function text(string $str) * * @see \Mike42\Escpos\Printer::feed() */ - public function feed(int $lines = 1) + public function feed(int $lines = 1): void { self::validateInteger($lines, 1, 255, __FUNCTION__); for ($i = 0; $i < $lines; $i ++) { diff --git a/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php b/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php index 9b52c2ce..9c9addfc 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php +++ b/src/Mike42/Escpos/Experimental/Unifont/ColumnFormatGlyphFactory.php @@ -17,5 +17,5 @@ interface ColumnFormatGlyphFactory { - public function getGlyph($codePoint); + public function getGlyph($codePoint): ColumnFormatGlyph; } diff --git a/src/Mike42/Escpos/Experimental/Unifont/FontMap.php b/src/Mike42/Escpos/Experimental/Unifont/FontMap.php index fbabb505..e73ae651 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/FontMap.php +++ b/src/Mike42/Escpos/Experimental/Unifont/FontMap.php @@ -20,7 +20,7 @@ class FontMap { - protected $printer; + protected Printer $printer; const MIN = 0x20; const MAX = 0x7E; @@ -28,13 +28,13 @@ class FontMap const FONT_B_WIDTH = 9; // Map memory locations to code points - protected $memory; + protected array $memory; - // Map unicode code points to bytes - protected $chars; + // Map Unicode code points to bytes + protected array $chars; // next available slot - protected $next = 0; + protected int $next = 0; private ColumnFormatGlyphFactory $glyphFactory; @@ -45,12 +45,12 @@ public function __construct(ColumnFormatGlyphFactory $glyphFactory, Printer $pri $this -> reset(); } - public function cacheChars(array $codePoints) + public function cacheChars(array $codePoints): void { // TODO flush existing cache to fill with these chars. } - public function writeChar(int $codePoint) + public function writeChar(int $codePoint): void { if (!$this -> addChar($codePoint, true)) { throw new InvalidArgumentException("Code point $codePoint not available"); @@ -59,18 +59,18 @@ public function writeChar(int $codePoint) $this -> printer -> getPrintConnector() -> write($data); } - public function reset() + public function reset(): void { $this -> chars = []; - $this -> memory = array_fill(0, (\Mike42\Escpos\Experimental\Unifont\FontMap::MAX - FontMap::MIN) + 1, -1); + $this -> memory = array_fill(0, (FontMap::MAX - FontMap::MIN) + 1, -1); } - public function occupied($id) + public function occupied($id): bool { return $this -> memory[$id] !== -1; } - public function evict($id) + public function evict($id): bool { if (!$this -> occupied($id)) { return true; @@ -80,7 +80,7 @@ public function evict($id) return true; } - public function addChar(int $codePoint, $evict = true) + public function addChar(int $codePoint, $evict = true): bool { if (isset($this -> chars[$codePoint])) { // Char already available @@ -118,7 +118,7 @@ public function addChar(int $codePoint, $evict = true) return true; } - public function submitCharsToPrinterFont(array $chars) + public function submitCharsToPrinterFont(array $chars): void { ksort($chars); // TODO We can sort into batches of contiguous characters here. diff --git a/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php b/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php index f2acb75d..c58df537 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php +++ b/src/Mike42/Escpos/Experimental/Unifont/UnifontGlyphFactory.php @@ -17,15 +17,15 @@ class UnifontGlyphFactory implements ColumnFormatGlyphFactory { - protected $unifontFile; + protected array $unifontFile; - public static function colFormat16(array $in) + public static function colFormat16(array $in): string { // Map 16 x 16 bit unifont (32 bytes) to 16 x 24 ESC/POS column format image (48 bytes). return UnifontGlyphFactory::colFormat8($in, 2, 1) . UnifontGlyphFactory::colFormat8($in, 2, 2); } - public static function colFormat8(array $in, $chars = 1, $idx = 1) + public static function colFormat8(array $in, $chars = 1, $idx = 1): string { // Map 8 x 16 bit unifont (32 bytes) to 8 x 24 ESC/POS column format image (24 bytes). return implode([ @@ -205,7 +205,7 @@ public function __construct(array $unifontFile) $this -> unifontFile = $unifontFile; } - public function getGlyph($codePoint) + public function getGlyph($codePoint): ColumnFormatGlyph { // Binary search for correct line. $min = 0; diff --git a/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php b/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php index a1c53450..6d060365 100644 --- a/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php +++ b/src/Mike42/Escpos/Experimental/Unifont/UnifontPrintBuffer.php @@ -40,7 +40,7 @@ public function __construct(string $unifontFilename) $this -> started = false; } - public function writeChar(int $codePoint) + public function writeChar(int $codePoint): void { if ($codePoint == 10) { $this -> write("\n"); @@ -52,7 +52,7 @@ public function writeChar(int $codePoint) } } - public function writeText(string $text) + public function writeText(string $text): void { if (!$this -> started) { $mode = Printer::MODE_FONT_B | Printer::MODE_DOUBLE_HEIGHT | Printer::MODE_DOUBLE_WIDTH; @@ -73,21 +73,21 @@ public function writeText(string $text) } } - public function flush() + public function flush(): void { } - public function setPrinter(?Printer $printer = null) + public function setPrinter(?Printer $printer = null): void { $this -> printer = $printer; $this -> fontMap = new FontMap($this -> unifont, $this -> printer); } - public function writeTextRaw(string $text) + public function writeTextRaw(string $text): void { } - public function getPrinter() + public function getPrinter(): ?Printer { return $this -> printer; } @@ -97,7 +97,7 @@ public function getPrinter() * * @param string $data */ - private function write($data) + private function write($data): void { $this -> printer -> getPrintConnector() -> write($data); } diff --git a/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php index e4f2f949..846b749f 100644 --- a/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/EscposPrintBuffer.php @@ -62,7 +62,7 @@ public function __construct() $this -> printer = null; } - public function flush() + public function flush(): void { if ($this -> printer == null) { throw new LogicException("Not attached to a printer."); @@ -70,12 +70,12 @@ public function flush() // TODO Not yet implemented for this buffer: This indicates that the printer needs the current line to be ended. } - public function getPrinter() + public function getPrinter(): ?Printer { return $this -> printer; } - public function setPrinter(?Printer $printer = null) + public function setPrinter(?Printer $printer = null): void { $this -> printer = $printer; if ($printer != null) { @@ -83,7 +83,7 @@ public function setPrinter(?Printer $printer = null) } } - public function writeText(string $text) + public function writeText(string $text): void { if ($this->printer == null) { throw new LogicException("Not attached to a printer."); @@ -119,7 +119,7 @@ public function writeText(string $text) } } - public function writeTextRaw(string $text) + public function writeTextRaw(string $text): void { if ($this -> printer == null) { throw new LogicException("Not attached to a printer."); @@ -152,7 +152,7 @@ public function writeTextRaw(string $text) * @return boolean|integer Code page number, or FALSE if the text is not * printable on any supported encoding. */ - private function identifyText(int $codePoint) + private function identifyText(int $codePoint): bool|int { if (!isset($this -> available[$codePoint])) { /* Character not available anywhere */ @@ -165,7 +165,7 @@ private function identifyText(int $codePoint) * Based on the printer's connector, compute (or load a cached copy of) maps * of UTF character to unicode characters for later use. */ - private function loadAvailableCharacters() + private function loadAvailableCharacters(): void { $profile = $this -> printer -> getPrinterCapabilityProfile(); $supportedCodePages = $profile -> getCodePages(); @@ -238,7 +238,7 @@ private function loadAvailableCharacters() * @param array $codePoints Text to print, as list of unicode code points * @param integer $encodingNo Encoding number to use- assumed to exist. */ - private function writeTextUsingEncoding(array $codePoints, int $encodingNo) + private function writeTextUsingEncoding(array $codePoints, int $encodingNo): void { $encodeMap = $this -> encode[$encodingNo]; $len = count($codePoints); @@ -271,7 +271,7 @@ private function writeTextUsingEncoding(array $codePoints, int $encodingNo) * * @param string $data */ - private function write(string $data) + private function write(string $data): void { $this -> printer -> getPrintConnector() -> write($data); } @@ -283,7 +283,7 @@ private function write(string $data) * @param boolean $extended True to allow 128-256 values also (excluded by default) * @return boolean True if the character is printable, false if it is not. */ - private static function asciiCheck(string $char, bool $extended = false) + private static function asciiCheck(string $char, bool $extended = false): bool { if (strlen($char) != 1) { // Multi-byte string diff --git a/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php index 7f359cab..b0827f9f 100644 --- a/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/ImagePrintBuffer.php @@ -28,17 +28,18 @@ */ class ImagePrintBuffer implements PrintBuffer { - private $printer; + private ?Printer $printer; /** * @var string|null font to use */ - private $font; + private ?string $font; - private $fontSize; + private int $fontSize; public function __construct() { + $this -> printer = null; if (!EscposImage::isImagickLoaded()) { throw new Exception("ImagePrintBuffer requires the imagick extension"); } @@ -46,24 +47,24 @@ public function __construct() $this -> fontSize = 24; } - public function flush() + public function flush(): void { if ($this -> printer == null) { throw new LogicException("Not attached to a printer."); } } - public function getPrinter() + public function getPrinter(): ?Printer { return $this -> printer; } - public function setPrinter(?Printer $printer = null) + public function setPrinter(?Printer $printer = null): void { $this -> printer = $printer; } - public function writeText(string $text) + public function writeText(string $text): void { if ($this -> printer == null) { throw new LogicException("Not attached to a printer."); @@ -90,9 +91,8 @@ public function writeText(string $text) $draw -> setTextAntialias(true); $metrics = $image -> queryFontMetrics($draw, $text); $draw -> annotation(0, $metrics['ascender'], $text); - /* Create image & draw annotation on it */ - $image -> newImage($metrics['textWidth'], $metrics['textHeight'], $background); + $image -> newImage((int)$metrics['textWidth'], (int)$metrics['textHeight'], $background); $image -> setImageFormat('png'); $image -> drawImage($draw); // debugging if you want to view the images yourself @@ -105,7 +105,7 @@ public function writeText(string $text) $this -> printer -> bitImage($escposImage, $size); } - public function writeTextRaw(string $text) + public function writeTextRaw(string $text): void { if ($this -> printer == null) { throw new LogicException("Not attached to a printer."); @@ -123,7 +123,7 @@ public function writeTextRaw(string $text) * @param string $font * Font name or a filename */ - public function setFont(string $font) + public function setFont(string $font): void { $this->font = $font; } @@ -131,7 +131,7 @@ public function setFont(string $font) /** * Numeric font size for rendering text to image */ - public function setFontSize(int $fontSize) + public function setFontSize(int $fontSize): void { $this->fontSize = $fontSize; } diff --git a/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php b/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php index 22a5a39a..4da947b6 100644 --- a/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php +++ b/src/Mike42/Escpos/PrintBuffers/PrintBuffer.php @@ -36,31 +36,31 @@ interface PrintBuffer * Cause the buffer to send any partial input and wait on a newline. * If the printer is already on a new line, this does nothing. */ - public function flush(); + public function flush(): void; /** * Used by Escpos to check if a printer is set. */ - public function getPrinter(); + public function getPrinter(): ?Printer; /** * Used by Escpos to hook up one-to-one link between buffers and printers. * * @param Printer|null $printer New printer */ - public function setPrinter(?Printer $printer = null); + public function setPrinter(?Printer $printer = null): void; /** * Accept UTF-8 text for printing. * * @param string $text Text to print */ - public function writeText(string $text); + public function writeText(string $text): void; /** * Accept 8-bit text in the current encoding and add it to the buffer. * * @param string $text Text to print, already the target encoding. */ - public function writeTextRaw(string $text); + public function writeTextRaw(string $text): void; } diff --git a/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php index 9c61896e..9c1710d6 100644 --- a/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/CupsPrintConnector.php @@ -26,17 +26,17 @@ class CupsPrintConnector implements PrintConnector { /** - * @var array $buffer + * @var array|null $buffer * Buffer of accumilated data. */ - private $buffer; + private array|null $buffer; /** * * @var string $printerName * The name of the target printer. */ - private $printerName; + private string $printerName; /** * Construct new CUPS print connector. @@ -45,8 +45,9 @@ class CupsPrintConnector implements PrintConnector * The CUPS printer name to print to. This must be loaded using a raw driver. * @throws BadMethodCallException */ - public function __construct($dest) + public function __construct(string $dest) { + $this->buffer = null; // just ensurer this is initialized - __destruct() will call if an exception is thrown below. $valid = $this->getLocalPrinters(); if (count($valid) == 0) { throw new BadMethodCallException("You do not have any printers installed on " . @@ -57,7 +58,7 @@ public function __construct($dest) throw new BadMethodCallException("'$dest' is not a printer on this system. " . "Printers are: [" . implode(", ", $valid) . "]"); } - $this->buffer = array (); + $this->buffer = array(); $this->printerName = $dest; } @@ -74,7 +75,7 @@ public function __destruct() /** * Send job to printer. */ - public function finalize() + public function finalize(): void { $data = implode($this->buffer); $this->buffer = null; @@ -106,7 +107,7 @@ public function finalize() * @param string $cmd * Command to run */ - protected function getCmdOutput($cmd) + protected function getCmdOutput($cmd): false|string { $descriptors = array ( 1 => array ( @@ -139,10 +140,10 @@ protected function getCmdOutput($cmd) /** * Read data from the printer. * - * @param string $len Length of data to read. - * @return string Data read from the printer, or false where reading is not possible. + * @param int $len Length of data to read. + * @return string|boolean Data read from the printer, or false where reading is not possible. */ - public function read($len) + public function read(int $len): bool|string { return false; } @@ -150,7 +151,7 @@ public function read($len) /** * @param string $data */ - public function write($data) + public function write(string $data): void { $this->buffer [] = $data; } diff --git a/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php index 80d2b255..95d757ce 100644 --- a/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php @@ -52,7 +52,7 @@ public function __destruct() } } - public function finalize() + public function finalize(): void { $this -> buffer = null; } @@ -69,12 +69,12 @@ public function getData() * {@inheritDoc} * @see PrintConnector::read() */ - public function read($len) + public function read(int $len): bool|string { return $len >= strlen($this -> readData) ? $this -> readData : substr($this -> readData, 0, $len); } - public function write($data) + public function write(string $data): void { $this -> buffer[] = $data; } diff --git a/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php b/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php index 7f9f5dc9..70d90299 100644 --- a/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/FilePrintConnector.php @@ -23,7 +23,7 @@ class FilePrintConnector implements PrintConnector { /** - * @var resource $fp + * @var false|resource $fp * The file pointer to send data to. */ protected $fp; @@ -33,7 +33,7 @@ class FilePrintConnector implements PrintConnector * * @param string $filename */ - public function __construct($filename) + public function __construct(string $filename) { $this -> fp = fopen($filename, "wb+"); if ($this -> fp === false) { @@ -51,7 +51,7 @@ public function __destruct() /** * Close file pointer */ - public function finalize() + public function finalize(): void { if ($this -> fp !== false) { fclose($this -> fp); @@ -62,7 +62,7 @@ public function finalize() /* (non-PHPdoc) * @see PrintConnector::read() */ - public function read($len) + public function read(int $len): bool|string { if ($this -> fp === false) { throw new Exception("PrintConnector has been closed, cannot read input."); @@ -75,7 +75,7 @@ public function read($len) * * @param string $data */ - public function write($data) + public function write(string $data): void { if ($this -> fp === false) { throw new Exception("PrintConnector has been closed, cannot send output."); diff --git a/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php b/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php index c780bc09..6a4cc866 100644 --- a/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/MultiplePrintConnector.php @@ -20,27 +20,27 @@ */ class MultiplePrintConnector implements PrintConnector { - private $connectors; + private array $connectors; public function __construct(PrintConnector ...$connectors) { $this -> connectors = $connectors; } - public function finalize() + public function finalize(): void { foreach ($this -> connectors as $connector) { $connector -> finalize(); } } - public function read($len) + public function read(int $len): bool|string { // Cannot write return false; } - public function write($data) + public function write(string $data): void { foreach ($this -> connectors as $connector) { $connector -> write($data); diff --git a/src/Mike42/Escpos/PrintConnectors/PrintConnector.php b/src/Mike42/Escpos/PrintConnectors/PrintConnector.php index 9f8c4636..8018676f 100644 --- a/src/Mike42/Escpos/PrintConnectors/PrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/PrintConnector.php @@ -31,20 +31,20 @@ public function __destruct(); * Finish using this print connector (close file, socket, send * accumulated output, etc). */ - public function finalize(); + public function finalize(): void; /** * Read data from the printer. * - * @param string $len Length of data to read. - * @return string Data read from the printer, or false where reading is not possible. + * @param int $len Length of data to read. + * @return string|boolean Data read from the printer, or false where reading is not possible. */ - public function read($len); + public function read(int $len): bool|string; /** * Write data to the print connector. * * @param string $data The data to write */ - public function write($data); + public function write(string $data): void; } diff --git a/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php index 5e76ce63..3d4e679d 100644 --- a/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/RawbtPrintConnector.php @@ -23,14 +23,9 @@ final class RawbtPrintConnector implements PrintConnector { /** * @var array $buffer - * Buffer of accumilated data. + * Buffer of accumulated data. */ - private $buffer; - - /** - * @var string data which the printer will provide on next read - */ - private $readData; + private array|null $buffer; /** * Create new print connector @@ -41,7 +36,7 @@ public function __construct() $this->buffer = []; } - public function clear() + public function clear(): void { $this->buffer = []; } @@ -53,7 +48,7 @@ public function __destruct() } } - public function finalize() + public function finalize(): void { ob_end_clean(); echo "intent:base64," . base64_encode($this->getData()) . "#Intent;scheme=rawbt;package=ru.a402d.rawbtprinter;end;"; @@ -63,7 +58,7 @@ public function finalize() /** * @return string Get the accumulated data that has been sent to this buffer. */ - public function getData() + public function getData(): string { return implode($this->buffer); } @@ -72,12 +67,12 @@ public function getData() * {@inheritDoc} * @see PrintConnector::read() */ - public function read($len) + public function read(int $len): bool|string { - return $len >= strlen($this->readData) ? $this->readData : substr($this->readData, 0, $len); + return false; } - public function write($data) + public function write(string $data): void { $this->buffer[] = $data; } diff --git a/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php index b8f0049d..7488de87 100644 --- a/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/UriPrintConnector.php @@ -19,7 +19,7 @@ class UriPrintConnector { const URI_ASSEMBLER_PATTERN = "~^(.+):/{2}(.+?)(?::(\d{1,4}))?$~"; - public static function get($uri) + public static function get($uri): PrintConnector { // Parse URI $is_uri = preg_match(self::URI_ASSEMBLER_PATTERN, $uri, $uri_parts); diff --git a/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php index 733b7683..d3803d5a 100644 --- a/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/WindowsPrintConnector.php @@ -168,7 +168,7 @@ public function __destruct() } } - public function finalize() + public function finalize(): void { $data = implode($this -> buffer); $this -> buffer = null; @@ -187,7 +187,7 @@ public function finalize() * @param string $data Print data * @throws Exception */ - protected function finalizeLinux($data) + protected function finalizeLinux($data): void { /* Non-Windows samba printing */ $device = "//" . $this -> hostname . "/" . $this -> printerName; @@ -251,7 +251,7 @@ protected function finalizeMac($data) * * @param string $data */ - protected function finalizeWin($data) + protected function finalizeWin($data): void { /* Windows-friendly printing of all sorts */ if (!$this -> isLocal) { @@ -306,9 +306,9 @@ protected function finalizeWin($data) } /** - * @return string Current platform. Separated out for testing purposes. + * @return int Current platform. Separated out for testing purposes. */ - protected function getCurrentPlatform() + protected function getCurrentPlatform(): int { if (PHP_OS == "WINNT") { return self::PLATFORM_WIN; @@ -322,7 +322,7 @@ protected function getCurrentPlatform() /* (non-PHPdoc) * @see PrintConnector::read() */ - public function read($len) + public function read(int $len): bool|string { /* Two-way communication is not supported */ return false; @@ -334,10 +334,10 @@ public function read($len) * @param string $command the command to run. * @param string $outputStr variable to fill with standard output. * @param string $errorStr variable to fill with standard error. - * @param string $inputStr text to pass to the command's standard input (optional). + * @param string|null $inputStr text to pass to the command's standard input (optional). * @return number */ - protected function runCommand($command, &$outputStr, &$errorStr, $inputStr = null) + protected function runCommand(string $command, &$outputStr, &$errorStr, string|null $inputStr = null): int { $descriptors = [ 0 => ["pipe", "r"], @@ -390,7 +390,7 @@ protected function runWrite($data, $filename) return file_put_contents($filename, $data) !== false; } - public function write($data) + public function write(string $data): void { $this -> buffer[] = $data; } diff --git a/src/Mike42/Escpos/Printer.php b/src/Mike42/Escpos/Printer.php index 69661df5..2fc8babe 100644 --- a/src/Mike42/Escpos/Printer.php +++ b/src/Mike42/Escpos/Printer.php @@ -333,25 +333,25 @@ class Printer * @var PrintBuffer|null $buffer * The printer's output buffer. */ - protected $buffer; + protected ?PrintBuffer $buffer; /** * @var PrintConnector $connector * Connector showing how to print to this printer */ - protected $connector; + protected PrintConnector $connector; /** * @var CapabilityProfile $profile * Profile showing supported features for this printer */ - protected $profile; + protected CapabilityProfile $profile; /** * @var int $characterTable * Current character code table */ - protected $characterTable; + protected int $characterTable; /** * Construct a new print object @@ -390,7 +390,7 @@ public function __construct(PrintConnector $connector, ?CapabilityProfile $profi * available barcode types vary between printers. * @throws InvalidArgumentException Where the length or characters used in $content is invalid for the requested barcode format. */ - public function barcode(string $content, int $type = Printer::BARCODE_CODE39) + public function barcode(string $content, int $type = Printer::BARCODE_CODE39): void { /* Validate input */ self::validateInteger($type, 65, 73, __FUNCTION__, "Barcode type"); @@ -456,7 +456,7 @@ public function barcode(string $content, int $type = Printer::BARCODE_CODE39) * (default), or any combination of the `Printer::IMG_DOUBLE_HEIGHT` and * `Printer::IMG_DOUBLE_WIDTH` flags. */ - public function bitImage(EscposImage $img, int $size = Printer::IMG_DEFAULT) + public function bitImage(EscposImage $img, int $size = Printer::IMG_DEFAULT): void { self::validateInteger($size, 0, 3, __FUNCTION__); $rasterData = $img -> toRasterFormat(); @@ -476,7 +476,7 @@ public function bitImage(EscposImage $img, int $size = Printer::IMG_DEFAULT) * (default), or any combination of the `Printer::IMG_DOUBLE_HEIGHT` and * `Printer::IMG_DOUBLE_WIDTH` flags. */ - public function bitImageColumnFormat(EscposImage $img, int $size = Printer::IMG_DEFAULT) + public function bitImageColumnFormat(EscposImage $img, int $size = Printer::IMG_DEFAULT): void { $highDensityVertical = ! (($size & self::IMG_DOUBLE_HEIGHT) == Printer::IMG_DOUBLE_HEIGHT); $highDensityHorizontal = ! (($size & self::IMG_DOUBLE_WIDTH) == Printer::IMG_DOUBLE_WIDTH); @@ -500,7 +500,7 @@ public function bitImageColumnFormat(EscposImage $img, int $size = Printer::IMG_ * Close the underlying buffer. With some connectors, the * job will not actually be sent to the printer until this is called. */ - public function close() + public function close(): void { $this -> connector -> finalize(); } @@ -511,7 +511,7 @@ public function close() * @param int $mode Cut mode, either Printer::CUT_FULL or Printer::CUT_PARTIAL. If not specified, `Printer::CUT_FULL` will be used. * @param int $lines Number of lines to feed */ - public function cut(int $mode = Printer::CUT_FULL, int $lines = 3) + public function cut(int $mode = Printer::CUT_FULL, int $lines = 3): void { // TODO validation on cut() inputs $this -> connector -> write(self::GS . "V" . chr($mode) . chr($lines)); @@ -522,7 +522,7 @@ public function cut(int $mode = Printer::CUT_FULL, int $lines = 3) * * @param int $lines Number of lines to feed */ - public function feed(int $lines = 1) + public function feed(int $lines = 1): void { self::validateInteger($lines, 1, 255, __FUNCTION__); if ($lines <= 1) { @@ -536,7 +536,7 @@ public function feed(int $lines = 1) * Some printers require a form feed to release the paper. On most printers, this * command is only useful in page mode, which is not implemented in this driver. */ - public function feedForm() + public function feedForm(): void { $this -> connector -> write(self::FF); } @@ -544,7 +544,7 @@ public function feedForm() /** * Some slip printers require `ESC q` sequence to release the paper. */ - public function release() + public function release(): void { $this -> connector -> write(self::ESC . chr(113)); } @@ -554,7 +554,7 @@ public function release() * * @param int $lines number of lines to feed. If not specified, 1 line will be fed. */ - public function feedReverse(int $lines = 1) + public function feedReverse(int $lines = 1): void { self::validateInteger($lines, 1, 255, __FUNCTION__); $this -> connector -> write(self::ESC . "e" . chr($lines)); @@ -563,7 +563,7 @@ public function feedReverse(int $lines = 1) /** * @return int */ - public function getCharacterTable() + public function getCharacterTable(): int { return $this -> characterTable; } @@ -571,7 +571,7 @@ public function getCharacterTable() /** * @return PrintBuffer */ - public function getPrintBuffer() + public function getPrintBuffer(): ?PrintBuffer { return $this -> buffer; } @@ -579,7 +579,7 @@ public function getPrintBuffer() /** * @return PrintConnector */ - public function getPrintConnector() + public function getPrintConnector(): PrintConnector { return $this -> connector; } @@ -587,7 +587,7 @@ public function getPrintConnector() /** * @return CapabilityProfile */ - public function getPrinterCapabilityProfile() + public function getPrinterCapabilityProfile(): CapabilityProfile { return $this -> profile; } @@ -611,7 +611,7 @@ public function getPrinterCapabilityProfile() * (default), or any combination of the `Printer::IMG_DOUBLE_HEIGHT` and * `Printer::IMG_DOUBLE_WIDTH` flags. */ - public function graphics(EscposImage $img, int $size = Printer::IMG_DEFAULT) + public function graphics(EscposImage $img, int $size = Printer::IMG_DEFAULT): void { self::validateInteger($size, 0, 3, __FUNCTION__); $rasterData = $img -> toRasterFormat(); @@ -628,7 +628,7 @@ public function graphics(EscposImage $img, int $size = Printer::IMG_DEFAULT) /** * Initialize printer. This resets formatting back to the defaults. */ - public function initialize() + public function initialize(): void { $this -> connector -> write(self::ESC . "@"); $this -> characterTable = 0; @@ -650,7 +650,7 @@ public function initialize() * start/end bars, or truncated code Printer::PDF417_TRUNCATED with start bars only. * @throws Exception If this profile indicates that PDF417 code is not supported */ - public function pdf417Code(string $content, int $width = 3, int $heightMultiplier = 3, int $dataColumnCount = 0, float $ec = 0.10, int $options = Printer::PDF417_STANDARD) + public function pdf417Code(string $content, int $width = 3, int $heightMultiplier = 3, int $dataColumnCount = 0, float $ec = 0.10, int $options = Printer::PDF417_STANDARD): void { self::validateInteger($width, 2, 8, __FUNCTION__, 'width'); self::validateInteger($heightMultiplier, 2, 8, __FUNCTION__, 'heightMultiplier'); @@ -688,7 +688,7 @@ public function pdf417Code(string $content, int $width = 3, int $heightMultiplie * @param int $on_ms pulse ON time, in milliseconds. * @param int $off_ms pulse OFF time, in milliseconds. */ - public function pulse(int $pin = 0, int $on_ms = 120, int $off_ms = 240) + public function pulse(int $pin = 0, int $on_ms = 120, int $off_ms = 240): void { self::validateInteger($pin, 0, 1, __FUNCTION__); self::validateInteger($on_ms, 1, 511, __FUNCTION__); @@ -707,7 +707,7 @@ public function pulse(int $pin = 0, int $on_ms = 120, int $off_ms = 240) * @param int $size Pixel size to use. Must be 1-16 (default 3) * @param int $model QR code model to use. Must be one of Printer::QR_MODEL_1, Printer::QR_MODEL_2 (default) or Printer::QR_MICRO (not supported by all printers). */ - public function qrCode(string $content, int $ec = Printer::QR_ECLEVEL_L, int$size = 3, int $model = Printer::QR_MODEL_2) + public function qrCode(string $content, int $ec = Printer::QR_ECLEVEL_L, int$size = 3, int $model = Printer::QR_MODEL_2): void { self::validateInteger($ec, 0, 3, __FUNCTION__); self::validateInteger($size, 1, 16, __FUNCTION__); @@ -737,7 +737,7 @@ public function qrCode(string $content, int $ec = Printer::QR_ECLEVEL_L, int$siz * * @param int $table The table to select. Available code tables are model-specific. */ - public function selectCharacterTable(int $table = 0) + public function selectCharacterTable(int $table = 0): void { self::validateInteger($table, 0, 255, __FUNCTION__); $supported = $this -> profile -> getCodePages(); @@ -766,7 +766,7 @@ public function selectCharacterTable(int $table = 0) * * @param int $mode The mode to use. Default is Printer::MODE_FONT_A, with no special formatting. This has a similar effect to running initialize(). */ - public function selectPrintMode(int $mode = Printer::MODE_FONT_A) + public function selectPrintMode(int $mode = Printer::MODE_FONT_A): void { $allModes = Printer::MODE_FONT_B | self::MODE_EMPHASIZED | self::MODE_DOUBLE_HEIGHT | self::MODE_DOUBLE_WIDTH | self::MODE_UNDERLINE; if (!is_integer($mode) || $mode < 0 || ($mode & $allModes) != $mode) { @@ -781,7 +781,7 @@ public function selectPrintMode(int $mode = Printer::MODE_FONT_A) * * @param bool $on True to enable user-defined character set, false to use built-in characters sets. */ - public function selectUserDefinedCharacterSet($on = true) + public function selectUserDefinedCharacterSet($on = true): void { $this -> connector -> write(self::ESC . "%". ($on ? chr(1) : chr(0))); } @@ -791,7 +791,7 @@ public function selectUserDefinedCharacterSet($on = true) * * @param int $height Height in dots. If not specified, 8 will be used. */ - public function setBarcodeHeight(int $height = 8) + public function setBarcodeHeight(int $height = 8): void { self::validateInteger($height, 1, 255, __FUNCTION__); $this -> connector -> write(self::GS . "h" . chr($height)); @@ -803,7 +803,7 @@ public function setBarcodeHeight(int $height = 8) * @param int $width Bar width in dots. If not specified, 3 will be used. * Values above 6 appear to have no effect. */ - public function setBarcodeWidth(int $width = 3) + public function setBarcodeWidth(int $width = 3): void { self::validateInteger($width, 1, 255, __FUNCTION__); $this -> connector -> write(self::GS . "w" . chr($width)); @@ -816,7 +816,7 @@ public function setBarcodeWidth(int $width = 3) * or any combination of Printer::BARCODE_TEXT_ABOVE and Printer::BARCODE_TEXT_BELOW * flags to display the text. */ - public function setBarcodeTextPosition(int $position = Printer::BARCODE_TEXT_NONE) + public function setBarcodeTextPosition(int $position = Printer::BARCODE_TEXT_NONE): void { self::validateInteger($position, 0, 3, __FUNCTION__, "Barcode text position"); $this -> connector -> write(self::GS . "H" . chr($position)); @@ -827,7 +827,7 @@ public function setBarcodeTextPosition(int $position = Printer::BARCODE_TEXT_NON * * @param boolean $on true for double strike, false for no double strike */ - public function setDoubleStrike(bool $on = true) + public function setDoubleStrike(bool $on = true): void { self::validateBoolean($on, __FUNCTION__); $this -> connector -> write(self::ESC . "G". ($on ? chr(1) : chr(0))); @@ -838,7 +838,7 @@ public function setDoubleStrike(bool $on = true) * * @param int $color Color to use. Must be either Printer::COLOR_1 (default), or Printer::COLOR_2. */ - public function setColor(int $color = Printer::COLOR_1) + public function setColor(int $color = Printer::COLOR_1): void { self::validateInteger($color, 0, 1, __FUNCTION__, "Color"); $this -> connector -> write(self::ESC . "r" . chr($color)); @@ -849,7 +849,7 @@ public function setColor(int $color = Printer::COLOR_1) * * @param boolean $on true for emphasis, false for no emphasis */ - public function setEmphasis(bool $on = true) + public function setEmphasis(bool $on = true): void { self::validateBoolean($on, __FUNCTION__); $this -> connector -> write(self::ESC . "E". ($on ? chr(1) : chr(0))); @@ -860,7 +860,7 @@ public function setEmphasis(bool $on = true) * * @param int $font The font to use. Must be either Printer::FONT_A, Printer::FONT_B, or Printer::FONT_C. */ - public function setFont(int $font = Printer::FONT_A) + public function setFont(int $font = Printer::FONT_A): void { self::validateInteger($font, 0, 2, __FUNCTION__); $this -> connector -> write(self::ESC . "M" . chr($font)); @@ -871,7 +871,7 @@ public function setFont(int $font = Printer::FONT_A) * * @param int $justification One of Printer::JUSTIFY_LEFT, Printer::JUSTIFY_CENTER, or Printer::JUSTIFY_RIGHT. */ - public function setJustification(int $justification = Printer::JUSTIFY_LEFT) + public function setJustification(int $justification = Printer::JUSTIFY_LEFT): void { self::validateInteger($justification, 0, 2, __FUNCTION__); $this -> connector -> write(self::ESC . "a" . chr($justification)); @@ -885,7 +885,7 @@ public function setJustification(int $justification = Printer::JUSTIFY_LEFT) * @param int|null $height The height of each line, in dots. If not set, the printer * will reset to its default line spacing. */ - public function setLineSpacing(?int $height = null) + public function setLineSpacing(?int $height = null): void { if ($height === null) { // Reset to default @@ -901,7 +901,7 @@ public function setLineSpacing(?int $height = null) * * @param int $margin The left margin to set on to the print area, in dots. */ - public function setPrintLeftMargin(int $margin = 0) + public function setPrintLeftMargin(int $margin = 0): void { self::validateInteger($margin, 0, 65535, __FUNCTION__); $this -> connector -> write(Printer::GS . 'L' . self::intLowHigh($margin, 2)); @@ -913,7 +913,7 @@ public function setPrintLeftMargin(int $margin = 0) * * @param int $width The width of the page print area, in dots. */ - public function setPrintWidth(int $width = 512) + public function setPrintWidth(int $width = 512): void { self::validateInteger($width, 1, 65535, __FUNCTION__); $this -> connector -> write(Printer::GS . 'W' . self::intLowHigh($width, 2)); @@ -925,7 +925,7 @@ public function setPrintWidth(int $width = 512) * @param PrintBuffer $buffer The buffer to use. * @throws InvalidArgumentException Where the buffer is already attached to a different printer. */ - public function setPrintBuffer(PrintBuffer $buffer) + public function setPrintBuffer(PrintBuffer $buffer): void { if ($buffer === $this -> buffer) { return; @@ -945,7 +945,7 @@ public function setPrintBuffer(PrintBuffer $buffer) * * @param boolean $on True to enable, false to disable. */ - public function setReverseColors(bool $on = true) + public function setReverseColors(bool $on = true): void { self::validateBoolean($on, __FUNCTION__); $this -> connector -> write(self::GS . "B" . ($on ? chr(1) : chr(0))); @@ -957,7 +957,7 @@ public function setReverseColors(bool $on = true) * @param int $widthMultiplier Multiple of the regular height to use (range 1 - 8) * @param int $heightMultiplier Multiple of the regular height to use (range 1 - 8) */ - public function setTextSize(int $widthMultiplier, int $heightMultiplier) + public function setTextSize(int $widthMultiplier, int $heightMultiplier): void { self::validateInteger($widthMultiplier, 1, 8, __FUNCTION__); self::validateInteger($heightMultiplier, 1, 8, __FUNCTION__); @@ -970,7 +970,7 @@ public function setTextSize(int $widthMultiplier, int $heightMultiplier) * * @param int $underline Either true/false, or one of Printer::UNDERLINE_NONE, Printer::UNDERLINE_SINGLE or Printer::UNDERLINE_DOUBLE. Defaults to Printer::UNDERLINE_SINGLE. */ - public function setUnderline(int $underline = Printer::UNDERLINE_SINGLE) + public function setUnderline(int $underline = Printer::UNDERLINE_SINGLE): void { /* Set the underline */ self::validateInteger($underline, 0, 2, __FUNCTION__); @@ -982,7 +982,7 @@ public function setUnderline(int $underline = Printer::UNDERLINE_SINGLE) * * @param boolean $on True to enable, false to disable. */ - public function setUpsideDown(bool $on = true) + public function setUpsideDown(bool $on = true): void { $this -> connector -> write(self::ESC . "{" . ($on ? chr(1) : chr(0))); } @@ -995,9 +995,9 @@ public function setUpsideDown(bool $on = true) * * @param string $str Text to print, as UTF-8 */ - public function text(string $str) + public function text(string $str): void { - $this -> buffer -> writeText((string)$str); + $this -> buffer -> writeText($str); } /** @@ -1008,7 +1008,7 @@ public function text(string $str) * * @param string $str Text to print, as UTF-8 */ - public function textChinese(string $str = "") + public function textChinese(string $str = ""): void { $this -> connector -> write(self::FS . "&"); $str = \UConverter::transcode($str, "GBK", "UTF-8"); @@ -1024,9 +1024,9 @@ public function textChinese(string $str = "") * * @param string $str Text to print */ - public function textRaw(string $str = "") + public function textRaw(string $str = ""): void { - $this -> buffer -> writeTextRaw((string)$str); + $this -> buffer -> writeTextRaw($str); } /** @@ -1038,7 +1038,7 @@ public function textRaw(string $str = "") * @param string $m Modifier/variant for function. Often '0' where used. * @throws InvalidArgumentException Where the input lengths are bad. */ - protected function wrapperSend2dCodeData(string $fn, string $cn, string$data = '', string $m = '') + protected function wrapperSend2dCodeData(string $fn, string $cn, string$data = '', string $m = ''): void { if (strlen($m) > 1 || strlen($cn) != 1 || strlen($fn) != 1) { throw new InvalidArgumentException("wrapperSend2dCodeData: cn and fn must be one character each."); @@ -1055,7 +1055,7 @@ protected function wrapperSend2dCodeData(string $fn, string $cn, string$data = ' * @param string $data Data to send. * @throws InvalidArgumentException Where the input lengths are bad. */ - protected function wrapperSendGraphicsData(string $m, string $fn, string$data = '') + protected function wrapperSendGraphicsData(string $m, string $fn, string$data = ''): void { if (strlen($m) != 1 || strlen($fn) != 1) { throw new InvalidArgumentException("wrapperSendGraphicsData: m and fn must be one character each."); @@ -1071,7 +1071,7 @@ protected function wrapperSendGraphicsData(string $m, string $fn, string$data = * @param boolean $long True to use 4 bytes, false to use 2 * @return string */ - protected static function dataHeader(array $inputs, bool $long = true) + protected static function dataHeader(array $inputs, bool $long = true): string { $outp = []; foreach ($inputs as $input) { @@ -1091,7 +1091,7 @@ protected static function dataHeader(array $inputs, bool $long = true) * @param int $input Input number * @param int $length The number of bytes to output (1 - 4). */ - protected static function intLowHigh(int $input, int $length) + protected static function intLowHigh(int $input, int $length): string { $maxInput = (256 << ($length * 8) - 1); self::validateInteger($length, 1, 4, __FUNCTION__); @@ -1110,7 +1110,7 @@ protected static function intLowHigh(int $input, int $length) * @param boolean $test the input to test * @param string $source the name of the function calling this */ - protected static function validateBoolean(bool $test, string $source) + protected static function validateBoolean(bool $test, string $source): void { if (!($test === true || $test === false)) { throw new InvalidArgumentException("Argument to $source must be a boolean"); @@ -1126,7 +1126,7 @@ protected static function validateBoolean(bool $test, string $source) * @param string $source the name of the function calling this * @param string $argument the name of the invalid parameter */ - protected static function validateFloat(float $test, float $min, float $max, string $source, string $argument = "Argument") + protected static function validateFloat(float $test, float $min, float $max, string $source, string $argument = "Argument"): void { if (!is_numeric($test)) { throw new InvalidArgumentException("$argument given to $source must be a float, but '$test' was given."); @@ -1145,7 +1145,7 @@ protected static function validateFloat(float $test, float $min, float $max, str * @param string $source the name of the function calling this * @param string $argument the name of the invalid parameter */ - protected static function validateInteger(int $test, int $min, int $max, string $source, string $argument = "Argument") + protected static function validateInteger(int $test, int $min, int $max, string $source, string $argument = "Argument"): void { self::validateIntegerMulti($test, [[$min, $max]], $source, $argument); } @@ -1156,10 +1156,9 @@ protected static function validateInteger(int $test, int $min, int $max, string * @param int $test the input to test * @param array $ranges array of two-item min/max ranges. * @param string $source the name of the function calling this - * @param string $source the name of the function calling this * @param string $argument the name of the invalid parameter */ - protected static function validateIntegerMulti(int $test, array $ranges, string $source, string $argument = "Argument") + protected static function validateIntegerMulti(int $test, array $ranges, string $source, string $argument = "Argument"): void { if (!is_integer($test)) { throw new InvalidArgumentException("$argument given to $source must be a number, but '$test' was given."); @@ -1194,7 +1193,7 @@ protected static function validateIntegerMulti(int $test, array $ranges, string * @param string $argument the name of the parameter being validated * @throws InvalidArgumentException Where the argument is not valid */ - protected static function validateStringRegex(string $test, string $source, string $regex, string $argument = "Argument") + protected static function validateStringRegex(string $test, string $source, string $regex, string $argument = "Argument"): void { if (preg_match($regex, $test) === 0) { throw new InvalidArgumentException("$argument given to $source is invalid. It should match regex '$regex', but '$test' was given."); From ce85cb231ceb4260ee9e824a816ec72a8621c1df Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 01:59:12 +1000 Subject: [PATCH 12/16] cleanup examples after testing - rawbt example has likely not worked for a long time, it is being dropped --- example/rawbt-receipt.html | 76 ------------------ example/rawbt-receipt.php | 145 ---------------------------------- example/receipt-with-logo.php | 58 +++++++------- 3 files changed, 29 insertions(+), 250 deletions(-) delete mode 100644 example/rawbt-receipt.html delete mode 100644 example/rawbt-receipt.php diff --git a/example/rawbt-receipt.html b/example/rawbt-receipt.html deleted file mode 100644 index c3d307a9..00000000 --- a/example/rawbt-receipt.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - RawBT Integration Demo - - - - - - - -black & white picture -

RawBT Integration Demo

-
-
-    window.location.href = ajax_backend_data;
-
-
-
- - -

Visit RawBT site

- - diff --git a/example/rawbt-receipt.php b/example/rawbt-receipt.php deleted file mode 100644 index 45a4e8fc..00000000 --- a/example/rawbt-receipt.php +++ /dev/null @@ -1,145 +0,0 @@ -getSupportsGraphics()) { - $printer->graphics($logo); - } - if ($profile->getSupportsBitImageRaster() && !$profile->getSupportsGraphics()) { - $printer->bitImage($logo); - } - - /* Name of shop */ - $printer->setJustification(Printer::JUSTIFY_CENTER); - $printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH); - $printer->text("ExampleMart Ltd.\n"); - $printer->selectPrintMode(); - $printer->text("Shop No. 42.\n"); - $printer->feed(); - - - /* Title of receipt */ - $printer->setEmphasis(true); - $printer->text("SALES INVOICE\n"); - $printer->setEmphasis(false); - - /* Items */ - $printer->setJustification(Printer::JUSTIFY_LEFT); - $printer->setEmphasis(true); - $printer->text(new item('', '$')); - $printer->setEmphasis(false); - foreach ($items as $item) { - $printer->text($item->getAsString(32)); // for 58mm Font A - } - $printer->setEmphasis(true); - $printer->text($subtotal->getAsString(32)); - $printer->setEmphasis(false); - $printer->feed(); - - /* Tax and total */ - $printer->text($tax->getAsString(32)); - $printer->selectPrintMode(Printer::MODE_DOUBLE_WIDTH); - $printer->text($total->getAsString(32)); - $printer->selectPrintMode(); - - /* Footer */ - $printer->feed(2); - $printer->setJustification(Printer::JUSTIFY_CENTER); - $printer->text("Thank you for shopping\n"); - $printer->text("at ExampleMart\n"); - $printer->text("For trading hours,\n"); - $printer->text("please visit example.com\n"); - $printer->feed(2); - $printer->text($date . "\n"); - - /* Barcode Default look */ - - $printer->barcode("ABC", Printer::BARCODE_CODE39); - $printer->feed(); - $printer->feed(); - - -// Demo that alignment QRcode is the same as text - $printer2 = new Printer($connector); // dirty printer profile hack !! - $printer2->setJustification(Printer::JUSTIFY_CENTER); - $printer2->qrCode("https://rawbt.ru/mike42", Printer::QR_ECLEVEL_M, 8); - $printer2->text("rawbt.ru/mike42\n"); - $printer2->setJustification(); - $printer2->feed(); - - - /* Cut the receipt and open the cash drawer */ - $printer->cut(); - $printer->pulse(); - -} catch (Exception $e) { - echo $e->getMessage(); -} finally { - $printer->close(); -} - -/* A wrapper to do organise item names & prices into columns */ - -class item -{ - private $name; - private $price; - private $dollarSign; - - public function __construct($name = '', $price = '', $dollarSign = false) - { - $this->name = $name; - $this->price = $price; - $this->dollarSign = $dollarSign; - } - - public function getAsString($width = 48) - { - $rightCols = 10; - $leftCols = $width - $rightCols; - if ($this->dollarSign) { - $leftCols = $leftCols / 2 - $rightCols / 2; - } - $left = str_pad($this->name, $leftCols); - - $sign = ($this->dollarSign ? '$ ' : ''); - $right = str_pad($sign . $this->price, $rightCols, ' ', STR_PAD_LEFT); - return "$left$right\n"; - } - - public function __toString() - { - return $this->getAsString(); - } - -} diff --git a/example/receipt-with-logo.php b/example/receipt-with-logo.php index 8a99edc9..27ec84ee 100644 --- a/example/receipt-with-logo.php +++ b/example/receipt-with-logo.php @@ -4,6 +4,35 @@ use Mike42\Escpos\EscposImage; use Mike42\Escpos\PrintConnectors\FilePrintConnector; +/* A wrapper to organize item names & prices into columns */ +class item +{ + private $name; + private $price; + private $dollarSign; + + public function __construct($name = '', $price = '', $dollarSign = false) + { + $this -> name = $name; + $this -> price = $price; + $this -> dollarSign = $dollarSign; + } + + public function __toString() + { + $rightCols = 10; + $leftCols = 38; + if ($this -> dollarSign) { + $leftCols = $leftCols / 2 - $rightCols / 2; + } + $left = str_pad($this -> name, $leftCols) ; + + $sign = ($this -> dollarSign ? '$ ' : ''); + $right = str_pad($sign . $this -> price, $rightCols, ' ', STR_PAD_LEFT); + return "$left$right\n"; + } +} + /* Fill in your own connector here */ $connector = new FilePrintConnector("php://stdout"); @@ -73,32 +102,3 @@ $printer -> pulse(); $printer -> close(); - -/* A wrapper to do organise item names & prices into columns */ -class item -{ - private $name; - private $price; - private $dollarSign; - - public function __construct($name = '', $price = '', $dollarSign = false) - { - $this -> name = $name; - $this -> price = $price; - $this -> dollarSign = $dollarSign; - } - - public function __toString() - { - $rightCols = 10; - $leftCols = 38; - if ($this -> dollarSign) { - $leftCols = $leftCols / 2 - $rightCols / 2; - } - $left = str_pad($this -> name, $leftCols) ; - - $sign = ($this -> dollarSign ? '$ ' : ''); - $right = str_pad($sign . $this -> price, $rightCols, ' ', STR_PAD_LEFT); - return "$left$right\n"; - } -} From 89d91ee92906fa3a6b911d2aca470dd23aa68187 Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 02:28:56 +1000 Subject: [PATCH 13/16] deprecate DummyPrintConnector in favour of MemoryPrintConnector (a rename w/ backwards compatibility) --- doc/FAQ.md | 16 ++-- example/specific/235-get-data.php | 4 +- .../PrintConnectors/DummyPrintConnector.php | 65 ++------------- .../PrintConnectors/MemoryPrintConnector.php | 82 +++++++++++++++++++ test/unit/AuresCustomerDisplayTest.php | 4 +- test/unit/EscposPrintBufferTest.php | 4 +- test/unit/EscposTest.php | 4 +- .../Unifont/UnifontPrintBufferTest.php | 4 +- test/unit/MultiplePrintConnectorTest.php | 6 +- 9 files changed, 109 insertions(+), 80 deletions(-) create mode 100644 src/Mike42/Escpos/PrintConnectors/MemoryPrintConnector.php diff --git a/doc/FAQ.md b/doc/FAQ.md index 6b7a6247..cdd726c3 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -10,7 +10,7 @@ The purpose of this driver it to generate binary ESC/POS code, which is understo If the printer understands ESC/POS, and you know how to get raw binary data to it, then yes. Otherwise, no. -The [list of printers that are known to work](https://github.com/mike42/escpos-php/blob/development/README.md#printers) is crowd-sourced. We appreciate it when developers try out the driver, then [file information on the bug tracker](https://github.com/mike42/escpos-php/issues/new) with some information about which features worked on their model of printer. +The [list of printers that are known to work](https://github.com/mike42/escpos-php/blob/development/README.md#printers) is crowdsourced. We appreciate it when developers try out the driver, then [file information on the bug tracker](https://github.com/mike42/escpos-php/issues/new) with some information about which features worked on their model of printer. To see how well your printer works, first check that it supports ESC/POS, then begin by attempting to send the text "Hello World" to your printer on the command-line, from the computer that will run PHP. @@ -24,7 +24,7 @@ If you encounter garbage output when you try to print images or special characte ## I have a printer that does not understand ESC/POS. Can I use this driver? -No. The purpose of this driver it to generate binary ESC/POS code. If your printer doesn't understand that, then this code wont be much use to you. +No. The purpose of this driver it to generate binary ESC/POS code. If your printer doesn't understand that, then this code won't be much use to you. Some printers do have an emulation mode for ESC/POS. The vendor docs will tell if this is the case, and how to enable it. @@ -46,13 +46,13 @@ The connectors are- - `FilePrintConnector` and `NetworkPrintConnector` directly use files or network sockets. - `WindowsPrintConnector` and `CupsPrintConnector` tie in with Windows and Unix system printing. -- `DummyPrintConnector` does not connect to a real printer, and can be used to save ESC/POS receipts to a database, for example. +- `MemoryPrintConnector` does not connect to a real printer, and can be used capture ESC/POS receipts for testing or audit, for example. -At this point, you might find that the way you would like to print is not supported by escpos-php. You can post your printing command as a feature request on the issue tracker. +You might find that the way you would like to print is not supported by escpos-php. You can post your printing command as a feature request on the issue tracker. Lastly, you may run in to the final common trap: -4. Your PHP is not running with the same sort of permissions as your login account. Again, no amount of PHP code can fix this. For example, on LAMP, your `www-data` user needs to be in the `lp` group, while on WAMP, `Local Service` account may run in to problems. SELinux and firewalls are also worth a look. +4. Your PHP script is not running with the same sort of permissions as your login account. Again, it's not possible for the PHP code itself to fix this. For example, on LAMP, your `www-data` user needs to be in the `lp` group, while on WAMP, `Local Service` account may run in to problems. SELinux and firewalls are also worth a look. When printing fails, you can expect a PHP Exception that explains what went wrong. They are all clues: @@ -66,7 +66,7 @@ Please file a bug if you think that there is a specific situation which escpos-p ## Can I print over the network? -Certainly, as long as your printer is available over the network. +Certainly, as long as your printer is available over the network! - `NetworkPrintConnector` will speak directly to an Ethernet-connected printer on port 9100. @@ -75,7 +75,7 @@ For USB or Serial printers, you need to install the printer on a computer and th - `WindowsPrintConnector` will connect to Windows shared printers from Windows or Linux (Linux users will need Samba). - `CupsPrintConnector` will connect to CUPS-shared printers from Linux or Mac. -Always start by testing your shared printer setup outside of escpos-php. The examples linked to in the README are commented with some example commands to get you started. Typically, networks, firewalls and permissions need to be set up. +Always start by testing your shared printer setup outside of escpos-php. The examples linked to in the README are commented with some example commands to get you started. Typically, networks, firewalls and permissions all need to be set up. Once you have a working command to send text to your printer (from the PHP server), you are ready to use escpos-php. @@ -127,7 +127,7 @@ First, ensure you have the Imagick plugin loaded. The driver will avoid a slower Next, connect over a faster interface. Serial printers have a low bit-rate, and the printer spends a lot of time waiting for data. If you have USB or Ethernet, then use it (note: storing graphics to the printer memory is not currently implemented). -Lastly, the printer will go faster if you use less pixels. Since images are two-dimensional, scaling down by 50% removes 75% of the pixels. The driver can then print at a half the density, so that your lower resolution image appears the same size when printed. +Lastly, images are sent uncompressed in ESC/POS, and you can speed up the transfer if you use fewer pixels. Images are two-dimensional, and scaling down by 50% removes 75% of the pixels. The driver has an option to print at half the density, so that the lower resolution image appears the same size when printed. ## How can I get the status of the printer? diff --git a/example/specific/235-get-data.php b/example/specific/235-get-data.php index 5ca20cfb..b1d4b566 100644 --- a/example/specific/235-get-data.php +++ b/example/specific/235-get-data.php @@ -6,11 +6,11 @@ */ require __DIR__ . '/../../vendor/autoload.php'; use Mike42\Escpos\Printer; -use Mike42\Escpos\PrintConnectors\DummyPrintConnector; +use Mike42\Escpos\PrintConnectors\MemoryPrintConnector; use Mike42\Escpos\CapabilityProfile; // Make sure you load a Star print connector or you may get gibberish. -$connector = new DummyPrintConnector(); +$connector = new MemoryPrintConnector(); $profile = CapabilityProfile::load("TSP600"); $printer = new Printer($connector); $printer -> text("Hello world!\n"); diff --git a/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php index 95d757ce..dd0d958a 100644 --- a/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php +++ b/src/Mike42/Escpos/PrintConnectors/DummyPrintConnector.php @@ -17,65 +17,12 @@ /** * Print connector that writes to nowhere, but allows the user to retrieve the - * buffered data. Used for testing. + * buffered data. + * + * @deprecated Renamed to {@see MemoryPrintConnector}. This subclass is retained + * for backwards compatibility and will be removed in a future major version. + * Use MemoryPrintConnector in new code. */ -final class DummyPrintConnector implements PrintConnector +class DummyPrintConnector extends MemoryPrintConnector { - /** - * @var array $buffer - * Buffer of accumilated data. - */ - private $buffer; - - /** - * @var string data which the printer will provide on next read - */ - private $readData; - - /** - * Create new print connector - */ - public function __construct() - { - $this -> buffer = []; - } - - public function clear() - { - $this -> buffer = []; - } - - public function __destruct() - { - if ($this -> buffer !== null) { - trigger_error("Print connector was not finalized. Did you forget to close the printer?", E_USER_NOTICE); - } - } - - public function finalize(): void - { - $this -> buffer = null; - } - - /** - * @return string Get the accumulated data that has been sent to this buffer. - */ - public function getData() - { - return implode($this -> buffer); - } - - /** - * {@inheritDoc} - * @see PrintConnector::read() - */ - public function read(int $len): bool|string - { - return $len >= strlen($this -> readData) ? $this -> readData : substr($this -> readData, 0, $len); - } - - public function write(string $data): void - { - $this -> buffer[] = $data; - } } diff --git a/src/Mike42/Escpos/PrintConnectors/MemoryPrintConnector.php b/src/Mike42/Escpos/PrintConnectors/MemoryPrintConnector.php new file mode 100644 index 00000000..dffec7a7 --- /dev/null +++ b/src/Mike42/Escpos/PrintConnectors/MemoryPrintConnector.php @@ -0,0 +1,82 @@ +, + * incorporating modifications by others. See CONTRIBUTORS.md for a full list. + * + * This software is distributed under the terms of the MIT license. See LICENSE.md + * for details. + */ + +declare(strict_types=1); + +namespace Mike42\Escpos\PrintConnectors; + +/** + * Print connector that writes to nowhere, but allows the user to retrieve the + * buffered data. Useful for capturing raw ESC/POS output in memory - for + * inspection, for sending over your own transport, or for testing. + */ +class MemoryPrintConnector implements PrintConnector +{ + /** + * @var array $buffer + * Buffer of accumilated data. + */ + private $buffer; + + /** + * @var string data which the printer will provide on next read + */ + private $readData; + + /** + * Create new print connector + */ + public function __construct() + { + $this -> buffer = []; + } + + public function clear() + { + $this -> buffer = []; + } + + public function __destruct() + { + if ($this -> buffer !== null) { + trigger_error("Print connector was not finalized. Did you forget to close the printer?", E_USER_NOTICE); + } + } + + public function finalize(): void + { + $this -> buffer = null; + } + + /** + * @return string Get the accumulated data that has been sent to this buffer. + */ + public function getData() + { + return implode($this -> buffer); + } + + /** + * {@inheritDoc} + * @see PrintConnector::read() + */ + public function read(int $len): bool|string + { + return $len >= strlen($this -> readData) ? $this -> readData : substr($this -> readData, 0, $len); + } + + public function write(string $data): void + { + $this -> buffer[] = $data; + } +} diff --git a/test/unit/AuresCustomerDisplayTest.php b/test/unit/AuresCustomerDisplayTest.php index 394994c9..a73ef03e 100644 --- a/test/unit/AuresCustomerDisplayTest.php +++ b/test/unit/AuresCustomerDisplayTest.php @@ -1,7 +1,7 @@ outputConnector = new DummyPrintConnector(); + $this -> outputConnector = new MemoryPrintConnector(); $profile = CapabilityProfile::load('OCD-300'); $this -> printer = new AuresCustomerDisplay($this -> outputConnector, $profile); } diff --git a/test/unit/EscposPrintBufferTest.php b/test/unit/EscposPrintBufferTest.php index 90ffd037..e6ca1f23 100644 --- a/test/unit/EscposPrintBufferTest.php +++ b/test/unit/EscposPrintBufferTest.php @@ -10,7 +10,7 @@ * - http://clagnut.com/blog/2380/ (mirrored from the English Wikipedia) */ use Mike42\Escpos\Printer; -use Mike42\Escpos\PrintConnectors\DummyPrintConnector; +use Mike42\Escpos\PrintConnectors\MemoryPrintConnector; class EscposPrintBufferTest extends PHPUnit\Framework\TestCase { @@ -19,7 +19,7 @@ class EscposPrintBufferTest extends PHPUnit\Framework\TestCase protected function setUp(): void { - $this -> outputConnector = new DummyPrintConnector(); + $this -> outputConnector = new MemoryPrintConnector(); $printer = new Printer($this -> outputConnector); $this -> buffer = $printer -> getPrintBuffer(); } diff --git a/test/unit/EscposTest.php b/test/unit/EscposTest.php index 9bb4fd20..e03c4f4c 100644 --- a/test/unit/EscposTest.php +++ b/test/unit/EscposTest.php @@ -1,6 +1,6 @@ outputConnector = new DummyPrintConnector(); + $this -> outputConnector = new MemoryPrintConnector(); $this -> printer = new Printer($this -> outputConnector); } diff --git a/test/unit/Experimental/Unifont/UnifontPrintBufferTest.php b/test/unit/Experimental/Unifont/UnifontPrintBufferTest.php index 3710bd54..6631aec5 100644 --- a/test/unit/Experimental/Unifont/UnifontPrintBufferTest.php +++ b/test/unit/Experimental/Unifont/UnifontPrintBufferTest.php @@ -2,7 +2,7 @@ namespace Mike42\Escpos\Experimental\Unifont; -use Mike42\Escpos\PrintConnectors\DummyPrintConnector; +use Mike42\Escpos\PrintConnectors\MemoryPrintConnector; use Mike42\Escpos\Printer; use PHPUnit\Framework\TestCase; @@ -13,7 +13,7 @@ class UnifontPrintBufferTest extends TestCase protected function setUp(): void { - $this -> outputConnector = new DummyPrintConnector(); + $this -> outputConnector = new MemoryPrintConnector(); $this -> printer = new Printer($this -> outputConnector); $filename = tempnam(sys_get_temp_dir(), "escpos-php-"); $glyphs = [ diff --git a/test/unit/MultiplePrintConnectorTest.php b/test/unit/MultiplePrintConnectorTest.php index 0508c97a..79fba37e 100644 --- a/test/unit/MultiplePrintConnectorTest.php +++ b/test/unit/MultiplePrintConnectorTest.php @@ -1,6 +1,6 @@ Date: Wed, 1 Jul 2026 02:42:06 +1000 Subject: [PATCH 14/16] update actions, fix typo in ignore statement --- .gitattributes | 2 +- .github/workflows/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index d8483259..297b4243 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,7 +3,7 @@ .gitattributes export-ignore .gitignore export-ignore .github/ export-ignore -docs/ export-ignore +doc/ export-ignore phpunit.xml export-ignore test/ export-ignore composer.lock export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84d59400..ce840d6f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ jobs: php-version: ['8.2', '8.3', '8.4', '8.5'] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - name: Install System Dependencies run: | From 44b5480bcd8c21aea94805a08423c31bf0646b4b Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 02:44:40 +1000 Subject: [PATCH 15/16] gitignore .phpunit.cache/ also --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8632f891..b762b68f 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ vendor/ # other build files build/* *.phar +.phpunit.cache/ From 3e2e8725e1c66c69dee0297d7ebcda3bcb81678e Mon Sep 17 00:00:00 2001 From: Michael Billington Date: Wed, 1 Jul 2026 19:03:26 +1000 Subject: [PATCH 16/16] Fix badge in README Fixing the GitHub actions status badge only. I generated this for the `main` branch, where our default branch is actually `development`. Also a good chance to test branch protection rules (GitHub actions build is required). --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 36ce550c..a2afc99a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ESC/POS Print Driver for PHP -[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mike42/escpos-php/ci.yml?branch=main&style=flat-square)](https://github.com/mike42/escpos-php/actions/workflows/ci.yml) +[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/mike42/escpos-php/ci.yml?branch=development&style=flat-square)](https://github.com/mike42/escpos-php/actions/workflows/ci.yml) [![Packagist Version](https://img.shields.io/packagist/v/mike42/escpos-php?style=flat-square&color=007ec6)](https://packagist.org/packages/mike42/escpos-php) [![Packagist Downloads](https://img.shields.io/packagist/dt/mike42/escpos-php?style=flat-square)](https://packagist.org/packages/mike42/escpos-php) [![Packagist License](https://img.shields.io/packagist/l/mike42/escpos-php?style=flat-square&color=007ec6)](https://github.com/mike42/escpos-php/blob/development/LICENSE.md)