Skip to content

Commit 9c7a48b

Browse files
authored
Merge pull request #23 from eclipxe13/version-0.5.0
Bump to PHP 8.1 (version 0.5.0)
2 parents af27df2 + 43f08a8 commit 9c7a48b

31 files changed

+257
-302
lines changed

.gitattributes

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
/.gitattributes export-ignore
1515
/.gitignore export-ignore
1616
/.php-cs-fixer.dist.php export-ignore
17-
/.scrutinizer.yml export-ignore
18-
/.travis.yml export-ignore
17+
/box.json.dist export-ignore
1918
/phpcs.xml.dist export-ignore
2019
/phpstan.neon.dist export-ignore
2120
/phpunit.xml.dist export-ignore
21+
/sonar-project.properties export-ignore
2222

2323
# Do not count these files on github code language
2424
/tests/_files/** linguist-detectable=false

.github/workflows/build.yml

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010

1111
# Actions
1212
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
13-
# sudo-bot/action-scrutinizer@latest https://github.com/marketplace/actions/action-scrutinizer
1413

1514
jobs:
1615

@@ -99,25 +98,14 @@ jobs:
9998
runs-on: "ubuntu-latest"
10099
strategy:
101100
matrix:
102-
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
101+
php-version: ['8.1', '8.2', '8.3', '8.4']
103102
steps:
104103
- name: Checkout
105104
uses: actions/checkout@v4
106-
with:
107-
fetch-depth: 0 # required for sudo-bot/action-scrutinizer
108105
- name: Install poppler-utils
109106
run: |
110107
sudo apt-get update -y -qq
111108
sudo apt-get install -y -qq poppler-utils
112-
- name: Setup PHP
113-
uses: shivammathur/setup-php@v2
114-
with:
115-
php-version: ${{ matrix.php-version }}
116-
extensions: soap, gd
117-
coverage: xdebug
118-
tools: composer:v2
119-
env:
120-
fail-fast: true
121109
- name: Install SAT XML resources
122110
shell: bash
123111
run: |
@@ -129,6 +117,15 @@ jobs:
129117
else
130118
echo tests/_files/external-resources already exists
131119
fi
120+
- name: Setup PHP
121+
uses: shivammathur/setup-php@v2
122+
with:
123+
php-version: ${{ matrix.php-version }}
124+
extensions: soap, gd
125+
coverage: none
126+
tools: composer:v2
127+
env:
128+
fail-fast: true
132129
- name: Get composer cache directory
133130
id: composer-cache
134131
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
@@ -141,10 +138,4 @@ jobs:
141138
- name: Install project dependencies
142139
run: composer upgrade --no-interaction --no-progress --prefer-dist
143140
- name: Tests (phpunit)
144-
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml
145-
- name: Upload code coverage to scrutinizer
146-
if: ${{ !env.ACT }} # do not run if using nektos/act
147-
uses: sudo-bot/action-scrutinizer@latest
148-
with:
149-
cli-args: "--format=php-clover build/coverage-clover.xml"
150-
continue-on-error: true
141+
run: vendor/bin/phpunit --testdox

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: "Setup PHP"
2222
uses: shivammathur/setup-php@v2
2323
with:
24-
php-version: '7.3' # use minimal version
24+
php-version: '8.1' # use minimal version
2525
extensions: soap, gd
2626
coverage: none
2727
tools: composer:v2
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "SonarQube Cloud"
2+
on:
3+
# secrets are not passed to workflows that are triggered by a pull request from a fork.
4+
# see https://docs.github.com/en/actions/reference/encrypted-secrets
5+
workflow_dispatch:
6+
push:
7+
branches: [ "master" ]
8+
9+
# Actions
10+
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
11+
# SonarSource/sonarqube-scan-action@v6 https://github.com/marketplace/actions/official-sonarqube-scan
12+
13+
jobs:
14+
15+
sonarqube-cloud:
16+
name: SonarCloud Scan and Report
17+
runs-on: "ubuntu-latest"
18+
steps:
19+
- name: Check SONAR_TOKEN secret
20+
run: |
21+
if [ -z "${{ secrets.SONAR_TOKEN }}" ]; then
22+
echo "::warning ::SONAR_TOKEN non set"
23+
exit 1
24+
fi
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
- name: Unshallow clone to provide blame information
28+
run: git fetch --unshallow
29+
- name: Install poppler-utils
30+
run: |
31+
sudo apt-get update -y -qq
32+
sudo apt-get install -y -qq poppler-utils
33+
- name: Install SAT XML resources
34+
shell: bash
35+
run: |
36+
rm -r -f tests/_files/external-resources
37+
git clone --depth 1 https://github.com/phpcfdi/resources-sat-xml resources-sat-xml-cloned
38+
mv resources-sat-xml-cloned/resources tests/_files/external-resources
39+
rm -r -f resources-sat-xml-cloned
40+
- name: Setup PHP
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: '8.4'
44+
extensions: soap, gd
45+
coverage: xdebug
46+
tools: composer:v2
47+
- name: Get composer cache directory
48+
id: composer-cache
49+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
50+
- name: Cache dependencies
51+
uses: actions/cache@v4
52+
with:
53+
path: ${{ steps.composer-cache.outputs.dir }}
54+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
55+
restore-keys: ${{ runner.os }}-composer-
56+
- name: Install project dependencies
57+
run: composer upgrade --no-interaction --no-progress --prefer-dist
58+
- name: Create code coverage
59+
run: vendor/bin/phpunit --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
60+
- name: Prepare SonarCloud Code Coverage Files
61+
run: |
62+
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
63+
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
64+
- name: SonarCloud Scan
65+
uses: SonarSource/sonarqube-scan-action@v6
66+
env:
67+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.php-cs-fixer.dist.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,32 @@
1515
->setRules([
1616
'@PSR12' => true,
1717
'@PSR12:risky' => true,
18-
'@PHP7x1Migration:risky' => true,
19-
'@PHP7x3Migration' => true,
18+
'@PHP8x1Migration' => true,
19+
'@PHP8x0Migration:risky' => true,
2020
// basic
2121
'statement_indentation' => false, // invalid indentation
2222
// symfony
23+
'array_indentation' => true,
2324
'class_attributes_separation' => true,
2425
'whitespace_after_comma_in_array' => true,
2526
'no_empty_statement' => true,
2627
'no_extra_blank_lines' => true,
2728
'type_declaration_spaces' => true,
28-
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays', 'arguments']],
29-
'new_with_parentheses' => true,
30-
'no_blank_lines_after_class_opening' => true,
29+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'arguments', 'parameters']],
3130
'no_blank_lines_after_phpdoc' => true,
3231
'object_operator_without_whitespace' => true,
3332
'binary_operator_spaces' => true,
3433
'phpdoc_scalar' => true,
3534
'no_trailing_comma_in_singleline' => true,
3635
'single_quote' => true,
37-
'blank_lines_before_namespace' => true,
3836
'no_singleline_whitespace_before_semicolons' => true,
3937
'no_unused_imports' => true,
4038
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
4139
'standardize_not_equals' => true,
4240
'concat_space' => ['spacing' => 'one'],
4341
'linebreak_after_opening_tag' => true,
42+
'fully_qualified_strict_types' => true,
43+
'global_namespace_import' => ['import_classes' => true],
4444
// symfony:risky
4545
'no_alias_functions' => true,
4646
'self_accessor' => true,

.scrutinizer.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ tools/phpcbf --colors -sp
109109
tools/composer-normalize normalize --dry-run
110110
tools/php-cs-fixer fix --dry-run --verbose
111111
tools/phpcs --colors -sp
112-
vendor/bin/phpunit --testdox --verbose --stop-on-failure
112+
vendor/bin/phpunit --testdox --stop-on-failure
113113
tools/phpstan analyse --no-progress
114114
```
115115

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
[![Source Code][badge-source]][source]
44
[![Packagist PHP Version Support][badge-php-version]][php-version]
5+
[![Discord][badge-discord]][discord]
56
[![Latest Version][badge-release]][release]
67
[![Software License][badge-license]][license]
78
[![Build Status][badge-build]][build]
8-
[![Scrutinizer][badge-quality]][quality]
9-
[![Coverage Status][badge-coverage]][coverage]
9+
[![Reliability][badge-reliability]][reliability]
10+
[![Maintainability][badge-maintainability]][maintainability]
11+
[![Code Coverage][badge-coverage]][coverage]
12+
[![Violations][badge-violations]][violations]
1013
[![Total Downloads][badge-downloads]][downloads]
14+
[![Docker Downloads][badge-docker]][docker]
1115

1216
> Create a generic PDF file from a CFDI 3.3 & 4.0
1317
@@ -116,18 +120,26 @@ and licensed for use under the MIT License (MIT). Please see [LICENSE][] for mor
116120

117121
[source]: https://github.com/phpcfdi/cfditopdf
118122
[php-version]: https://packagist.org/packages/phpcfdi/cfditopdf
123+
[discord]: https://discord.gg/aFGYXvX
119124
[release]: https://github.com/phpcfdi/cfditopdf/releases
120125
[license]: https://github.com/phpcfdi/cfditopdf/blob/master/LICENSE
121126
[build]: https://github.com/phpcfdi/cfditopdf/actions/workflows/build.yml?query=branch:master
122-
[quality]: https://scrutinizer-ci.com/g/phpcfdi/cfditopdf/
123-
[coverage]: https://scrutinizer-ci.com/g/phpcfdi/cfditopdf/code-structure/master/code-coverage/src
127+
[reliability]:https://sonarcloud.io/component_measures?id=phpcfdi_cfditopdf&metric=Reliability
128+
[maintainability]: https://sonarcloud.io/component_measures?id=phpcfdi_cfditopdf&metric=Maintainability
129+
[coverage]: https://sonarcloud.io/component_measures?id=phpcfdi_cfditopdf&metric=Coverage
130+
[violations]: https://sonarcloud.io/project/issues?id=phpcfdi_cfditopdf&resolved=false
124131
[downloads]: https://packagist.org/packages/phpcfdi/cfditopdf
125-
126-
[badge-source]: https://img.shields.io/badge/source-phpcfdi/cfditopdf-blue?style=flat-square
127-
[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/cfditopdf?style=flat-square
128-
[badge-release]: https://img.shields.io/github/release/phpcfdi/cfditopdf?style=flat-square
129-
[badge-license]: https://img.shields.io/github/license/phpcfdi/cfditopdf?style=flat-square
130-
[badge-build]: https://img.shields.io/github/actions/workflow/status/phpcfdi/cfditopdf/build.yml?branch=master&style=flat-square
131-
[badge-quality]: https://img.shields.io/scrutinizer/g/phpcfdi/cfditopdf/master?style=flat-square
132-
[badge-coverage]: https://img.shields.io/scrutinizer/coverage/g/phpcfdi/cfditopdf/master?style=flat-square
133-
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfditopdf?style=flat-square
132+
[docker]: https://hub.docker.com/r/phpcfdi/cfditopdf
133+
134+
[badge-source]: https://img.shields.io/badge/source-phpcfdi/cfditopdf-blue?logo=github
135+
[badge-discord]: https://img.shields.io/discord/459860554090283019?logo=discord
136+
[badge-php-version]: https://img.shields.io/packagist/php-v/phpcfdi/cfditopdf?logo=php
137+
[badge-release]: https://img.shields.io/github/release/phpcfdi/cfditopdf?logo=git
138+
[badge-license]: https://img.shields.io/github/license/phpcfdi/cfditopdf?logo=open-source-initiative
139+
[badge-build]: https://img.shields.io/github/actions/workflow/status/phpcfdi/cfditopdf/build.yml?branch=master&logo=github-actions
140+
[badge-reliability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfditopdf&metric=reliability_rating
141+
[badge-maintainability]: https://sonarcloud.io/api/project_badges/measure?project=phpcfdi_cfditopdf&metric=sqale_rating
142+
[badge-coverage]: https://img.shields.io/sonar/coverage/phpcfdi_cfditopdf/master?logo=sonarqubecloud&server=https%3A%2F%2Fsonarcloud.io
143+
[badge-violations]: https://img.shields.io/sonar/violations/phpcfdi_cfditopdf/master?format=long&logo=sonarqubecloud&server=https%3A%2F%2Fsonarcloud.io
144+
[badge-downloads]: https://img.shields.io/packagist/dt/phpcfdi/cfditopdf?logo=packagist
145+
[badge-docker]: https://img.shields.io/docker/pulls/phpcfdi/cfditopdf?logo=docker

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
"source": "https://github.com/phpcfdi/cfditopdf"
2323
},
2424
"require": {
25-
"php": ">=7.3",
26-
"eclipxe/cfdiutils": "^2.31 || ^3.0",
25+
"php": ">=8.1",
26+
"eclipxe/cfdiutils": "^3.0",
2727
"league/plates": "^3.5",
2828
"phpcfdi/cfdi-cleaner": "^1.3.3",
2929
"spipu/html2pdf": "^5.2.8"
3030
},
3131
"require-dev": {
32-
"phpunit/phpunit": "^9.5"
32+
"phpunit/phpunit": "^10.5"
3333
},
3434
"autoload": {
3535
"psr-4": {
@@ -79,7 +79,7 @@
7979
],
8080
"dev:test": [
8181
"@dev:check-style",
82-
"@php vendor/bin/phpunit --testdox --verbose --stop-on-failure",
82+
"@php vendor/bin/phpunit --testdox --stop-on-failure",
8383
"@php tools/phpstan analyse --no-progress"
8484
]
8585
},

docs/CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
# `phpcfdi/cfditopdf` Changelog
22

3-
## Version 0.4.4 2024-11-08
3+
## Version 0.5.0 2025-11-10
4+
5+
This version remove the compatibility with PHP 7.3, PHP 7.4 and PHP 8.0.
6+
PHP minimal version is 8.1.
7+
PHPUnit now runs using version 10.5.
8+
9+
In the generic template, the variables `$pagos` & `$pago` has been renamed to `$pagos10` & `$pago10`.
10+
11+
Other changes:
12+
13+
- Code cleaning: Thanks to *PHPStan*, *rector/rector* and *PHPStorm*.
14+
- Removed Scrutinizer-CI integration. Thanks for everything.
15+
- Add SonarQube Cloud integration.
16+
- Use common PhpCfdi badges and code standards.
17+
18+
## Version 0.4.4 2025-11-08
419

520
- Add Docker Hub public image. Thanks to `@dreglad` for the inspiration.
621

7-
## Version 0.4.3 2024-11-08
22+
## Version 0.4.3 2025-11-08
823

924
- Fix compatibility with PHP 8.4.
1025
- Allow dependence of `eclipxe/cfdiutils` to match versions `^2.31` and `^3.0`.

0 commit comments

Comments
 (0)