From 4c37fa4b41b0cab50a4fc192e9120042dbe36872 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Nov 2021 18:33:35 +0300 Subject: update phpstan to 1.1.2; update php-qrcode to 3.4.1 --- .../php-qrcode/.github/workflows/tests.yml | 76 ++++++++++++++-------- vendor/chillerlan/php-qrcode/.travis.yml | 5 ++ vendor/chillerlan/php-qrcode/composer.json | 5 +- .../php-qrcode/examples/QRImageWithLogo.php | 12 ++-- .../php-qrcode/examples/imageWithLogo.php | 13 ++-- vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php | 6 +- .../php-qrcode/tests/Output/QRImageTest.php | 10 ++- 7 files changed, 82 insertions(+), 45 deletions(-) (limited to 'vendor/chillerlan/php-qrcode') diff --git a/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml b/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml index 5dd343abd..991e6503c 100644 --- a/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml +++ b/vendor/chillerlan/php-qrcode/.github/workflows/tests.yml @@ -1,5 +1,4 @@ # https://help.github.com/en/categories/automating-your-workflow-with-github-actions -# https://github.com/localheinz/php-library-template/blob/master/.github/workflows/continuous-integration.yml # https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml on: @@ -10,46 +9,69 @@ name: "Continuous Integration" jobs: - tests: - name: "Unit Tests" + static-code-analysis: + name: "Static Code Analysis" + runs-on: ubuntu-latest - strategy: - matrix: - php-binary: - - php7.2 - - php7.3 - - php7.4 + env: + PHAN_ALLOW_XDEBUG: 0 + PHAN_DISABLE_XDEBUG_WARN: 1 steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v2 - - name: "Install dependencies with composer" - run: ${{ matrix.php-binary }} $(which composer) update --no-interaction --no-progress --no-suggest + - name: "Install PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + coverage: none + tools: pecl + extensions: ast, gd, imagick, json, mbstring - - name: "Run unit tests with phpunit" - run: ${{ matrix.php-binary }} vendor/bin/phpunit --configuration=phpunit.xml --no-coverage + - name: "Update dependencies with composer" + run: composer update --no-interaction --no-ansi --no-progress --no-suggest + - name: "Run phan" + run: php vendor/bin/phan - code-coverage: - name: "Code Coverage" - runs-on: ubuntu-latest + tests: + name: "Unit Tests" + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest +# - windows-latest + php-version: + - "7.2" + - "7.3" + - "7.4" + - "8.0" steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v2 - - name: "Install locked dependencies with composer" - run: php7.4 $(which composer) install --no-interaction --no-progress --no-suggest + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: pcov + tools: pecl + extensions: gd, imagick, json, mbstring - - name: "Dump Xdebug filter with phpunit/phpunit" - run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php + - name: "Install dependencies with composer" + run: composer update --no-ansi --no-interaction --no-progress --no-suggest - - name: "Collect code coverage with Xdebug and phpunit/phpunit" - run: php7.4 vendor/bin/phpunit --configuration=phpunit.xml --prepend=.build/phpunit/xdebug-filter.php + - name: "Run tests with phpunit" + run: php vendor/phpunit/phpunit/phpunit --configuration=phpunit.xml - name: "Send code coverage report to Codecov.io" - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: bash <(curl -s https://codecov.io/bash) + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/vendor/chillerlan/php-qrcode/.travis.yml b/vendor/chillerlan/php-qrcode/.travis.yml index 78b8d79e9..7b2377fd8 100644 --- a/vendor/chillerlan/php-qrcode/.travis.yml +++ b/vendor/chillerlan/php-qrcode/.travis.yml @@ -1,3 +1,8 @@ +branches: + only: + - main + - v3.2.x + addons: apt: packages: diff --git a/vendor/chillerlan/php-qrcode/composer.json b/vendor/chillerlan/php-qrcode/composer.json index c2299a350..625149ce7 100644 --- a/vendor/chillerlan/php-qrcode/composer.json +++ b/vendor/chillerlan/php-qrcode/composer.json @@ -24,12 +24,13 @@ } ], "require": { - "php": "^7.2", + "php": "^7.2 || ^8.0", "ext-mbstring": "*", - "chillerlan/php-settings-container": "^1.2" + "chillerlan/php-settings-container": "^1.2.2" }, "require-dev": { "phpunit/phpunit": "^8.5", + "phan/phan": "^3.2.2", "setasign/fpdf": "^1.8.2" }, "suggest": { diff --git a/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php b/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php index f9d94ae34..76aa5ced7 100644 --- a/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php +++ b/vendor/chillerlan/php-qrcode/examples/QRImageWithLogo.php @@ -41,9 +41,9 @@ class QRImageWithLogo extends QRImage{ } $this->matrix->setLogoSpace( - $this->options->logoWidth, - $this->options->logoHeight - // not utilizing the position here + $this->options->logoSpaceWidth, + $this->options->logoSpaceHeight + // not utilizing the position here ); // there's no need to save the result of dump() into $this->image here @@ -55,9 +55,9 @@ class QRImageWithLogo extends QRImage{ $w = imagesx($im); $h = imagesy($im); - // set new logo size, leave a border of 1 module - $lw = ($this->options->logoWidth - 2) * $this->options->scale; - $lh = ($this->options->logoHeight - 2) * $this->options->scale; + // set new logo size, leave a border of 1 module (no proportional resize/centering) + $lw = ($this->options->logoSpaceWidth - 2) * $this->options->scale; + $lh = ($this->options->logoSpaceHeight - 2) * $this->options->scale; // get the qrcode size $ql = $this->matrix->size() * $this->options->scale; diff --git a/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php b/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php index 987e10c11..36f63d503 100644 --- a/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php +++ b/vendor/chillerlan/php-qrcode/examples/imageWithLogo.php @@ -16,14 +16,15 @@ require_once __DIR__.'/../vendor/autoload.php'; $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s'; /** - * @property int $logoWidth - * @property int $logoHeight + * @property int $logoSpaceWidth + * @property int $logoSpaceHeight * * @noinspection PhpIllegalPsrClassPathInspection */ class LogoOptions extends QROptions{ - protected $logoWidth; - protected $logoHeight; + // size in QR modules, multiply with QROptions::$scale for pixel size + protected $logoSpaceWidth; + protected $logoSpaceHeight; } $options = new LogoOptions; @@ -31,8 +32,8 @@ $options = new LogoOptions; $options->version = 7; $options->eccLevel = QRCode::ECC_H; $options->imageBase64 = false; -$options->logoWidth = 13; -$options->logoHeight = 13; +$options->logoSpaceWidth = 13; +$options->logoSpaceHeight = 13; $options->scale = 5; $options->imageTransparent = false; diff --git a/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php b/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php index a6d8b09e2..5b4487a40 100644 --- a/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php +++ b/vendor/chillerlan/php-qrcode/src/Data/QRMatrix.php @@ -589,12 +589,12 @@ class QRMatrix{ throw new QRCodeDataException('ECC level "H" required to add logo space'); } - // we need uneven sizes, adjust if needed - if(($width % 2) === 0){ + // we need uneven sizes to center the logo space, adjust if needed + if($startX === null && ($width % 2) === 0){ $width++; } - if(($height % 2) === 0){ + if($startY === null && ($height % 2) === 0){ $height++; } diff --git a/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php b/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php index 34ecf4f91..c4466a658 100644 --- a/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php +++ b/vendor/chillerlan/php-qrcode/tests/Output/QRImageTest.php @@ -13,6 +13,7 @@ namespace chillerlan\QRCodeTest\Output; use chillerlan\QRCode\{QRCode, Output\QRImage}; +use const PHP_MAJOR_VERSION; class QRImageTest extends QROutputTestAbstract{ @@ -63,7 +64,14 @@ class QRImageTest extends QROutputTestAbstract{ $this->setOutputInterface(); - $this::assertIsResource($this->outputInterface->dump()); + $data = $this->outputInterface->dump(); + + if(PHP_MAJOR_VERSION >= 8){ + $this::assertInstanceOf('\\GdImage', $data); + } + else{ + $this::assertIsResource($data); + } } } -- cgit v1.2.3