Skip to content

Commit db116bc

Browse files
authored
Merge pull request #24 from eclipxe13/version-3.3.0
Eliminar soporte para PHP 7.3, PHP 7.4 y PHP 8.0 (versión 3.3.0)
2 parents f0265c9 + 4e9089a commit db116bc

26 files changed

+132
-120
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ on:
1212
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
1313

1414
jobs:
15+
16+
composer-normalize:
17+
name: Composer normalization
18+
runs-on: "ubuntu-latest"
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: '8.4'
26+
coverage: none
27+
tools: composer-normalize
28+
env:
29+
fail-fast: true
30+
- name: Composer normalize
31+
run: composer-normalize
32+
1533
phpcs:
1634
name: Code Style (phpcs)
1735
runs-on: "ubuntu-latest"
@@ -99,7 +117,7 @@ jobs:
99117
runs-on: "ubuntu-latest"
100118
strategy:
101119
matrix:
102-
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
120+
php-version: ['8.1', '8.2', '8.3', '8.4']
103121
steps:
104122
- name: Checkout
105123
uses: actions/checkout@v4

.phive/phars.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
<phar name="phpstan" version="^2.1.11" installed="2.1.11" location="./tools/phpstan" copy="false"/>
77
<phar name="psalm" version="^6.10.0" installed="6.10.0" location="./tools/psalm" copy="false"/>
88
<phar name="infection" version="^0.29.14" installed="0.29.14" location="./tools/infection" copy="false"/>
9+
<phar name="composer-normalize" version="^2.46.0" installed="2.46.0" location="./tools/composer-normalize" copy="false"/>
910
</phive>

.php-cs-fixer.dist.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@
1515
->setRules([
1616
'@PSR12' => true,
1717
'@PSR12:risky' => true,
18-
'@PHP71Migration:risky' => true,
19-
'@PHP73Migration' => true,
18+
'@PHP81Migration' => true,
19+
'@PHP80Migration:risky' => true,
2020
// symfony
21+
'array_indentation' => true,
2122
'class_attributes_separation' => true,
2223
'whitespace_after_comma_in_array' => true,
2324
'no_empty_statement' => true,
2425
'no_extra_blank_lines' => true,
2526
'type_declaration_spaces' => true,
26-
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays']],
27+
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'parameters']],
2728
'no_blank_lines_after_phpdoc' => true,
2829
'object_operator_without_whitespace' => true,
2930
'binary_operator_spaces' => true,
@@ -36,6 +37,8 @@
3637
'standardize_not_equals' => true,
3738
'concat_space' => ['spacing' => 'one'],
3839
'linebreak_after_opening_tag' => true,
40+
'fully_qualified_strict_types' => true,
41+
'global_namespace_import' => ['import_classes' => true],
3942
// symfony:risky
4043
'no_alias_functions' => true,
4144
'self_accessor' => true,

composer.json

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
11
{
22
"name": "phpcfdi/cfdi-expresiones",
33
"description": "Genera expresiones de CFDI 4.0, CFDI 3.3, CFDI 3.2, RET 1.0 y RET 2.0",
4-
"keywords": ["phpcfdi", "sat", "cfdi"],
5-
"homepage": "https://github.com/phpcfdi/cfdi-expresiones",
64
"license": "MIT",
5+
"keywords": [
6+
"phpcfdi",
7+
"sat",
8+
"cfdi"
9+
],
710
"authors": [
811
{
912
"name": "Carlos C Soto",
1013
"email": "eclipxe13@gmail.com",
1114
"homepage": "https://eclipxe.com.mx/"
1215
}
1316
],
17+
"homepage": "https://github.com/phpcfdi/cfdi-expresiones",
1418
"support": {
15-
"source": "https://github.com/phpcfdi/cfdi-expresiones",
16-
"issues": "https://github.com/phpcfdi/cfdi-expresiones/issues"
17-
},
18-
"prefer-stable": true,
19-
"config": {
20-
"optimize-autoloader": true,
21-
"preferred-install": {
22-
"*": "dist"
23-
}
19+
"issues": "https://github.com/phpcfdi/cfdi-expresiones/issues",
20+
"source": "https://github.com/phpcfdi/cfdi-expresiones"
2421
},
2522
"require": {
26-
"php": ">=7.3",
23+
"php": ">=8.1",
2724
"ext-dom": "*",
2825
"ext-mbstring": "*"
2926
},
3027
"require-dev": {
31-
"phpunit/phpunit": "^9.5",
32-
"ext-json": "*"
28+
"ext-json": "*",
29+
"phpunit/phpunit": "^10.5.45"
3330
},
31+
"prefer-stable": true,
3432
"autoload": {
3533
"psr-4": {
3634
"PhpCfdi\\CfdiExpresiones\\": "src/"
@@ -41,13 +39,27 @@
4139
"PhpCfdi\\CfdiExpresiones\\Tests\\": "tests/"
4240
}
4341
},
42+
"config": {
43+
"optimize-autoloader": true,
44+
"preferred-install": {
45+
"*": "dist"
46+
}
47+
},
4448
"scripts": {
45-
"dev:build": ["@dev:fix-style", "@dev:test"],
49+
"dev:build": [
50+
"@dev:fix-style",
51+
"@dev:test"
52+
],
4653
"dev:check-style": [
54+
"@php tools/composer-normalize normalize --dry-run",
4755
"@php tools/php-cs-fixer fix --dry-run --verbose",
4856
"@php tools/phpcs --colors -sp"
4957
],
58+
"dev:coverage": [
59+
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html build/coverage/html/"
60+
],
5061
"dev:fix-style": [
62+
"@php tools/composer-normalize normalize",
5163
"@php tools/php-cs-fixer fix --verbose",
5264
"@php tools/phpcbf --colors -sp"
5365
],
@@ -57,16 +69,13 @@
5769
"@php tools/phpstan analyse --no-progress",
5870
"@php tools/psalm --no-progress",
5971
"@php tools/infection --no-progress --no-interaction --show-mutations"
60-
],
61-
"dev:coverage": [
62-
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html build/coverage/html/"
6372
]
6473
},
6574
"scripts-descriptions": {
6675
"dev:build": "DEV: run dev:fix-style and dev:tests, run before pull request",
67-
"dev:check-style": "DEV: search for code style errors using php-cs-fixer and phpcs",
68-
"dev:fix-style": "DEV: fix code style errors using php-cs-fixer and phpcbf",
69-
"dev:test": "DEV: run dev:check-style, phpunit, phpstan, psalm and infection",
70-
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/"
76+
"dev:check-style": "DEV: search for code style errors using composer-normalize, php-cs-fixer and phpcs",
77+
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/",
78+
"dev:fix-style": "DEV: fix code style errors using composer-normalize, php-cs-fixer and phpcbf",
79+
"dev:test": "DEV: run dev:check-style, phpunit, phpstan, psalm and infection"
7180
}
7281
}

docs/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ versión, aunque sí su incorporación en la rama principal de trabajo, generalm
1111

1212
## Listado de cambios
1313

14+
### Version 3.3.0 2025-04-13
15+
16+
Se elimina el soporte para PHP 7.3, PHP 7.4 y PHP 8.0. La versión mínima es ahora PHP 8.1.
17+
Esto incluye cambios al código relacionados con tipos, calidad de código y eliminación de código muerto.
18+
19+
Los siguientes cambios aplican al entorno de desarrollo.
20+
21+
- Se actualizan las pruebas a PHPUnit 10.
22+
- Se agrega la herramienta `composer-normalize` al proceso de construcción.
23+
- Se actualiza el estándar de código para `phpcs` y `php-cs-fixer`.
24+
1425
### Version 3.2.1 2025-04-13
1526

1627
- Se comprueba que el proyecto es compatible con PHP 8.4.

phpcs.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?xml version="1.0"?>
1+
<?xml version="1.0" encoding="UTF-8"?>
22
<ruleset name="EngineWorks">
3-
<description>The EngineWorks (PSR-2 based) coding standard.</description>
3+
<description>The EngineWorks (PSR-12 based) coding standard.</description>
44

55
<file>src</file>
66
<file>tests</file>

phpunit.xml.dist

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
cacheResultFile="build/phpunit.result.cache"
5-
bootstrap="tests/bootstrap.php"
6-
colors="true"
7-
>
8-
<testsuites>
9-
<testsuite name="default">
10-
<directory>tests</directory>
11-
</testsuite>
12-
</testsuites>
13-
<coverage>
14-
<include>
15-
<directory suffix=".php">./src/</directory>
16-
</include>
17-
</coverage>
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
cacheResultFile="build/phpunit.result.cache"
5+
bootstrap="tests/bootstrap.php"
6+
colors="true"
7+
>
8+
<testsuites>
9+
<testsuite name="default">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
<source>
14+
<include>
15+
<directory suffix=".php">./src/</directory>
16+
</include>
17+
</source>
1818
</phpunit>

src/DiscoverExtractor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class DiscoverExtractor implements ExpressionExtractorInterface
1616
{
1717
/** @var ExpressionExtractorInterface[] */
18-
private $extractors;
18+
private readonly array $extractors;
1919

2020
public function __construct(ExpressionExtractorInterface ...$extractors)
2121
{

src/ExpressionExtractorInterface.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,30 @@ interface ExpressionExtractorInterface
1010
{
1111
/**
1212
* Extractor (implementor) unique name
13-
*
14-
* @return string
1513
*/
1614
public function uniqueName(): string;
1715

1816
/**
1917
* Check that the XML document matches with the extractor
20-
*
21-
* @param DOMDocument $document
22-
* @return bool
2318
*/
2419
public function matches(DOMDocument $document): bool;
2520

2621
/**
2722
* Obtain the relevant values from the given XML Document
2823
*
29-
* @param DOMDocument $document
3024
* @return array<string, string>
3125
*/
3226
public function obtain(DOMDocument $document): array;
3327

3428
/**
3529
* Format an expression based on given XML document
36-
*
37-
* @param DOMDocument $document
38-
* @return string
3930
*/
4031
public function extract(DOMDocument $document): string;
4132

4233
/**
4334
* Format an expression based on given values
4435
*
4536
* @param array<string, string> $values
46-
* @return string
4737
*/
4838
public function format(array $values): string;
4939
}

src/Extractors/Comprobante32.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class Comprobante32 implements ExpressionExtractorInterface
1515
use Standards\FormatRfcXml;
1616
use Standards\FormatTotal10x6;
1717

18-
/** @var MatchDetector */
19-
private $matchDetector;
18+
private MatchDetector $matchDetector;
2019

2120
public function __construct()
2221
{

0 commit comments

Comments
 (0)