Skip to content

Commit fc927d4

Browse files
committed
Requires PHP 8.1+ ; Updated dependencies and fixes
1 parent 9499e6b commit fc927d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+165
-166
lines changed

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
php-version: ["8.0", "8.1", "8.2", "8.3"]
26+
php-version: ["8.1", "8.2", "8.3", "8.4"]
2727
experimental: [false]
2828
os: [ubuntu-latest]
2929
coverage-extension: [xdebug]
@@ -50,7 +50,7 @@ jobs:
5050
- name: Run all tests
5151
run: make qa
5252
- name: Send coverage
53-
uses: codecov/codecov-action@v3
53+
uses: codecov/codecov-action@v5
5454
with:
5555
flags: php-${{ matrix.php-version }}-${{ matrix.os }}
5656
name: php-${{ matrix.php-version }}-${{ matrix.os }}

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ endif
169169
deps: ensuretarget
170170
rm -rf ./vendor/*
171171
($(COMPOSER) install -vvv --no-interaction)
172-
curl --silent --show-error --fail --location --output ./vendor/phpstan.phar https://github.com/phpstan/phpstan/releases/download/1.10.41/phpstan.phar \
172+
curl --silent --show-error --fail --location --output ./vendor/phpstan.phar https://github.com/phpstan/phpstan/releases/download/2.0.4/phpstan.phar \
173173
&& chmod +x ./vendor/phpstan.phar
174174

175175
# Generate source code documentation
@@ -211,8 +211,8 @@ endif
211211
.PHONY: lint
212212
lint:
213213
./vendor/bin/phpcs --ignore="./vendor/" --standard=phpcs.xml src test
214-
./vendor/bin/phpmd src text codesize,unusedcode,naming,design --exclude vendor
215-
./vendor/bin/phpmd test text unusedcode,naming
214+
./vendor/bin/phpmd src text codesize,unusedcode,naming,design --exclude */vendor/*
215+
./vendor/bin/phpmd test text unusedcode,naming,design --exclude */vendor/*
216216
php -r 'exit((int)version_compare(PHP_MAJOR_VERSION, "7", ">"));' || ./vendor/phpstan.phar analyse
217217

218218
# Run all tests and reports
@@ -260,7 +260,7 @@ tag:
260260
.PHONY: test
261261
test:
262262
cp phpunit.xml.dist phpunit.xml
263-
./vendor/bin/phpunit --migrate-configuration || true
263+
#./vendor/bin/phpunit --migrate-configuration || true
264264
XDEBUG_MODE=coverage ./vendor/bin/phpunit --stderr test
265265

266266
# Remove all installed files

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.1
1+
2.4.2

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@
5353
}
5454
],
5555
"require": {
56-
"php": ">=8.0",
56+
"php": ">=8.1",
5757
"ext-bcmath": "*",
5858
"ext-date": "*",
5959
"ext-gd": "*",
6060
"ext-pcre": "*",
6161
"tecnickcom/tc-lib-color": "^2.2"
6262
},
6363
"require-dev": {
64-
"pdepend/pdepend": "2.13.0",
65-
"phpmd/phpmd": "2.13.0",
66-
"phpunit/phpunit": "10.1.2 || 9.6.13",
67-
"squizlabs/php_codesniffer": "3.7.2"
64+
"pdepend/pdepend": "2.16.2",
65+
"phpmd/phpmd": "2.15.0",
66+
"phpunit/phpunit": "11.5.2 || 10.5.40",
67+
"squizlabs/php_codesniffer": "3.11.2"
6868
},
6969
"autoload": {
7070
"psr-4": {

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ parameters:
33
paths:
44
- src
55
- test
6-
scanDirectories:
6+
excludePaths:
77
- vendor
88
ignoreErrors:
99
reportUnmatchedIgnoredErrors: false

phpunit.xml.dist

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
43
bootstrap="vendor/autoload.php"
54
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
5+
displayDetailsOnTestsThatTriggerDeprecations="true"
6+
displayDetailsOnTestsThatTriggerErrors="true"
7+
displayDetailsOnTestsThatTriggerNotices="true"
8+
displayDetailsOnTestsThatTriggerWarnings="true"
9+
displayDetailsOnPhpunitDeprecations="true"
910
processIsolation="false"
10-
stopOnFailure="false"
11-
verbose="true">
11+
stopOnFailure="false">
1212
<testsuites>
1313
<testsuite name="tc-lib-barcode Test Suite">
1414
<directory>./test</directory>
1515
</testsuite>
1616
</testsuites>
17-
<filter>
18-
<whitelist>
19-
<directory suffix="php">src</directory>
20-
</whitelist>
21-
</filter>
17+
<source>
18+
<include>
19+
<directory suffix=".php">src</directory>
20+
</include>
21+
</source>
22+
<coverage>
23+
<report>
24+
<clover outputFile="target/coverage/coverage.xml"/>
25+
<html outputDirectory="target/coverage" lowUpperBound="50" highLowerBound="90"/>
26+
</report>
27+
</coverage>
2228
<logging>
23-
<log type="coverage-html" target="target/coverage"/>
24-
<log type="coverage-clover" target="target/coverage/coverage.xml"/>
25-
<log type="junit" target="target/logs/junit.xml"/>
29+
<junit outputFile="target/logs/junit.xml"/>
2630
</logging>
2731
</phpunit>

resources/debian/compat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9
1+
10

resources/debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
1010
Package: ~#PKGNAME#~
1111
Provides: php-~#PROJECT#~
1212
Architecture: all
13-
Depends: php (>= 8.0.0), php-bcmath, php-date, php-gd, php-tecnickcom-tc-lib-color (<< 3.0.0), php-tecnickcom-tc-lib-color (>= 2.2.6), ${misc:Depends}
13+
Depends: php (>= 8.1.0), php-bcmath, php-date, php-gd, php-tecnickcom-tc-lib-color (<< 3.0.0), php-tecnickcom-tc-lib-color (>= 2.2.7), ${misc:Depends}
1414
Description: PHP Barcode library
1515
This library includes PHP classes to generate linear
1616
and bidimensional barcodes:

resources/rpm/rpm.spec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ URL: https://github.com/%{gh_owner}/%{gh_project}
1616
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
1717
BuildArch: noarch
1818

19-
Requires: php(language) >= 8.0.0
19+
Requires: php(language) >= 8.1.0
2020
Requires: php-composer(%{c_vendor}/tc-lib-color) < 3.0.0
21-
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 2.2.6
21+
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 2.2.7
2222
Requires: php-bcmath
2323
Requires: php-date
2424
Requires: php-gd

src/Type.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @license http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
3535
* @link https://github.com/tecnickcom/tc-lib-barcode
3636
*
37-
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
37+
* @SuppressWarnings("PHPMD.ExcessiveClassComplexity")
3838
*/
3939
abstract class Type extends \Com\Tecnick\Barcode\Type\Convert implements Model
4040
{
@@ -85,8 +85,6 @@ protected function setParameters(): void
8585

8686
/**
8787
* Set the bars array
88-
*
89-
* @throws BarcodeException in case of error
9088
*/
9189
protected function setBars(): void
9290
{
@@ -140,7 +138,7 @@ public function setSize(
140138
*/
141139
protected function setPadding(array $padding): static
142140
{
143-
if (! is_array($padding) || (count($padding) != 4)) {
141+
if (count($padding) != 4) {
144142
throw new BarcodeException(
145143
'Invalid padding, expecting an array of 4 numbers (top, right, bottom, left)'
146144
);
@@ -494,8 +492,8 @@ public function getPngDataImagick(): string
494492
*/
495493
public function getGd(): \GdImage
496494
{
497-
$width = (int) ceil($this->width + $this->padding['L'] + $this->padding['R']);
498-
$height = (int) ceil($this->height + $this->padding['T'] + $this->padding['B']);
495+
$width = max(1, (int) ceil($this->width + $this->padding['L'] + $this->padding['R']));
496+
$height = max(1, (int) ceil($this->height + $this->padding['T'] + $this->padding['B']));
499497
$img = imagecreate($width, $height);
500498
if ($img === false) {
501499
throw new BarcodeException('Unable to create GD image');
@@ -506,9 +504,9 @@ public function getGd(): \GdImage
506504
$rgbcolor = $bgobj->invertColor()->getNormalizedArray(255);
507505
$background_color = imagecolorallocate(
508506
$img,
509-
(int) round($rgbcolor['R']),
510-
(int) round($rgbcolor['G']),
511-
(int) round($rgbcolor['B']),
507+
(int) round($rgbcolor['R']), // @phpstan-ignore argument.type
508+
(int) round($rgbcolor['G']), // @phpstan-ignore argument.type
509+
(int) round($rgbcolor['B']), // @phpstan-ignore argument.type
512510
);
513511
if ($background_color === false) {
514512
throw new BarcodeException('Unable to allocate default GD background color');
@@ -518,9 +516,9 @@ public function getGd(): \GdImage
518516
$rgbcolor = $this->bg_color_obj->getNormalizedArray(255);
519517
$bg_color = imagecolorallocate(
520518
$img,
521-
(int) round($rgbcolor['R']),
522-
(int) round($rgbcolor['G']),
523-
(int) round($rgbcolor['B']),
519+
(int) round($rgbcolor['R']), // @phpstan-ignore argument.type
520+
(int) round($rgbcolor['G']), // @phpstan-ignore argument.type
521+
(int) round($rgbcolor['B']), // @phpstan-ignore argument.type
524522
);
525523
if ($bg_color === false) {
526524
throw new BarcodeException('Unable to allocate GD background color');
@@ -531,9 +529,9 @@ public function getGd(): \GdImage
531529
$rgbcolor = $this->color_obj->getNormalizedArray(255);
532530
$bar_color = imagecolorallocate(
533531
$img,
534-
(int) round($rgbcolor['R']),
535-
(int) round($rgbcolor['G']),
536-
(int) round($rgbcolor['B']),
532+
(int) round($rgbcolor['R']), // @phpstan-ignore argument.type
533+
(int) round($rgbcolor['G']), // @phpstan-ignore argument.type
534+
(int) round($rgbcolor['B']), // @phpstan-ignore argument.type
537535
);
538536
if ($bar_color === false) {
539537
throw new BarcodeException('Unable to allocate GD foreground color');

0 commit comments

Comments
 (0)