Skip to content

Commit e2bfd20

Browse files
authored
Merge pull request #41 from eclipxe13/version-2.0.6
Mantenimiento y corrección del build (versión 2.0.6)
2 parents 3679402 + e91c8d8 commit e2bfd20

11 files changed

Lines changed: 104 additions & 46 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,33 @@ on:
1313

1414
jobs:
1515

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.5'
26+
coverage: none
27+
tools: composer-normalize
28+
env:
29+
fail-fast: true
30+
- name: Composer normalize
31+
run: composer-normalize --dry-run
32+
1633
phpcs:
1734
name: Code style (phpcs)
1835
runs-on: "ubuntu-latest"
1936
steps:
2037
- name: Checkout
21-
uses: actions/checkout@v4
38+
uses: actions/checkout@v6
2239
- name: Setup PHP
2340
uses: shivammathur/setup-php@v2
2441
with:
25-
php-version: '8.4'
42+
php-version: '8.5'
2643
coverage: none
2744
tools: cs2pr, phpcs
2845
env:
@@ -35,11 +52,11 @@ jobs:
3552
runs-on: "ubuntu-latest"
3653
steps:
3754
- name: Checkout
38-
uses: actions/checkout@v4
55+
uses: actions/checkout@v6
3956
- name: Setup PHP
4057
uses: shivammathur/setup-php@v2
4158
with:
42-
php-version: '8.3'
59+
php-version: '8.5'
4360
coverage: none
4461
tools: cs2pr, php-cs-fixer
4562
env:
@@ -52,11 +69,11 @@ jobs:
5269
runs-on: "ubuntu-latest"
5370
steps:
5471
- name: Checkout
55-
uses: actions/checkout@v4
72+
uses: actions/checkout@v6
5673
- name: Setup PHP
5774
uses: shivammathur/setup-php@v2
5875
with:
59-
php-version: '8.4'
76+
php-version: '8.5'
6077
coverage: none
6178
tools: composer:v2, phpstan
6279
env:
@@ -75,15 +92,15 @@ jobs:
7592
- name: PHPStan
7693
run: phpstan analyse --no-progress --verbose
7794

78-
tests:
95+
phpunit:
7996
name: Tests on PHP ${{ matrix.php-version }}
8097
runs-on: "ubuntu-latest"
8198
strategy:
8299
matrix:
83-
php-version: ['8.1', '8.2', '8.3', '8.4']
100+
php-version: ['8.1', '8.2', '8.3', '8.4', '8.5']
84101
steps:
85102
- name: Checkout
86-
uses: actions/checkout@v4
103+
uses: actions/checkout@v6
87104
- name: Setup PHP
88105
uses: shivammathur/setup-php@v2
89106
with:
@@ -111,7 +128,7 @@ jobs:
111128
runs-on: "ubuntu-latest"
112129
steps:
113130
- name: Checkout
114-
uses: actions/checkout@v4
131+
uses: actions/checkout@v6
115132
- name: Setup PHP
116133
uses: shivammathur/setup-php@v2
117134
with:

.github/workflows/sonarqube-cloud.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
# Actions
88
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action
9-
# SonarSource/sonarqube-scan-action@v6 https://github.com/marketplace/actions/official-sonarqube-scan
9+
# SonarSource/sonarqube-scan-action@v7 https://github.com/marketplace/actions/official-sonarqube-scan
1010

1111
jobs:
1212

@@ -21,13 +21,13 @@ jobs:
2121
exit 1
2222
fi
2323
- name: Checkout
24-
uses: actions/checkout@v4
24+
uses: actions/checkout@v6
2525
- name: Unshallow clone to provide blame information
2626
run: git fetch --unshallow
2727
- name: Setup PHP
2828
uses: shivammathur/setup-php@v2
2929
with:
30-
php-version: '8.4'
30+
php-version: '8.5'
3131
coverage: xdebug
3232
tools: composer:v2
3333
- name: Get composer cache directory
@@ -48,6 +48,6 @@ jobs:
4848
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
4949
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
5050
- name: SonarCloud Scan
51-
uses: SonarSource/sonarqube-scan-action@v6
51+
uses: SonarSource/sonarqube-scan-action@v7
5252
env:
5353
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.phive/phars.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^3.88.2" installed="3.88.2" location="./tools/php-cs-fixer" copy="false"/>
4-
<phar name="phpcs" version="^4.0.0" installed="4.0.0" location="./tools/phpcs" copy="false"/>
5-
<phar name="phpcbf" version="^4.0.0" installed="4.0.0" location="./tools/phpcbf" copy="false"/>
6-
<phar name="phpstan" version="^2.1.29" installed="2.1.29" location="./tools/phpstan" copy="false"/>
7-
<phar name="infection" version="^0.29.14" installed="0.29.14" location="./tools/infection" copy="false"/>
3+
<phar name="composer-normalize" version="^2.48.2" installed="2.48.2" location="./tools/composer-normalize" copy="false"/>
4+
<phar name="php-cs-fixer" version="^3.94.2" installed="3.94.2" location="./tools/php-cs-fixer" copy="false"/>
5+
<phar name="phpcs" version="^4.0.1" installed="4.0.1" location="./tools/phpcs" copy="false"/>
6+
<phar name="phpcbf" version="^4.0.1" installed="4.0.1" location="./tools/phpcbf" copy="false"/>
7+
<phar name="phpstan" version="^2.1.42" installed="2.1.42" location="./tools/phpstan" copy="false"/>
8+
<phar name="infection" version="^0.31.9" installed="0.31.9" location="./tools/infection" copy="false"/>
89
</phive>

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2019 - 2025 PhpCfdi https://www.phpcfdi.com/
3+
Copyright (c) 2019 - 2026 PhpCfdi https://www.phpcfdi.com/
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

composer.json

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"name": "phpcfdi/xml-cancelacion",
33
"description": "Genera documentos de cancelación de CFDI firmados (XMLSEC)",
4-
"keywords": ["phpcfdi", "sat", "cfdi", "Cancelacion", "PeticionConsultaRelacionados", "SolicitudAceptacionRechazo"],
5-
"homepage": "https://github.com/phpcfdi/xml-cancelacion",
64
"license": "MIT",
5+
"keywords": [
6+
"phpcfdi",
7+
"sat",
8+
"cfdi",
9+
"Cancelacion",
10+
"PeticionConsultaRelacionados",
11+
"SolicitudAceptacionRechazo"
12+
],
713
"authors": [
814
{
915
"name": "Carlos C Soto",
1016
"email": "eclipxe13@gmail.com"
1117
}
1218
],
19+
"homepage": "https://github.com/phpcfdi/xml-cancelacion",
1320
"support": {
14-
"source": "https://github.com/phpcfdi/xml-cancelacion",
15-
"issues": "https://github.com/phpcfdi/xml-cancelacion/issues"
16-
},
17-
"prefer-stable": true,
18-
"config": {
19-
"optimize-autoloader": true,
20-
"preferred-install": {
21-
"*": "dist"
22-
}
21+
"issues": "https://github.com/phpcfdi/xml-cancelacion/issues",
22+
"source": "https://github.com/phpcfdi/xml-cancelacion"
2323
},
2424
"require": {
2525
"php": "^8.1",
@@ -29,12 +29,13 @@
2929
"phpcfdi/credentials": "^1.1.1"
3030
},
3131
"require-dev": {
32-
"robrichards/xmlseclibs": "^3.1.0",
33-
"phpunit/phpunit": "^10.5.46"
32+
"phpunit/phpunit": "^10.5.46",
33+
"robrichards/xmlseclibs": "^3.1.0"
3434
},
3535
"suggest": {
3636
"robrichards/xmlseclibs": "Create document signatures (partially) using xmlseclibs"
3737
},
38+
"prefer-stable": true,
3839
"autoload": {
3940
"psr-4": {
4041
"PhpCfdi\\XmlCancelacion\\": "src/"
@@ -45,13 +46,27 @@
4546
"PhpCfdi\\XmlCancelacion\\Tests\\": "tests/"
4647
}
4748
},
49+
"config": {
50+
"optimize-autoloader": true,
51+
"preferred-install": {
52+
"*": "dist"
53+
}
54+
},
4855
"scripts": {
49-
"dev:build": ["@dev:fix-style", "@dev:test"],
56+
"dev:build": [
57+
"@dev:fix-style",
58+
"@dev:test"
59+
],
5060
"dev:check-style": [
61+
"@php tools/composer-normalize normalize --dry-run",
5162
"@php tools/php-cs-fixer fix --dry-run --verbose",
5263
"@php tools/phpcs --colors -sp"
5364
],
65+
"dev:coverage": [
66+
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html build/coverage/html/"
67+
],
5468
"dev:fix-style": [
69+
"@php tools/composer-normalize normalize",
5570
"@php tools/php-cs-fixer fix --verbose",
5671
"@php tools/phpcbf --colors -sp"
5772
],
@@ -60,16 +75,13 @@
6075
"@php vendor/bin/phpunit --testdox --display-all-issues --stop-on-failure",
6176
"@php tools/phpstan analyse --no-progress",
6277
"@php tools/infection --no-progress --no-interaction --show-mutations"
63-
],
64-
"dev:coverage": [
65-
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html build/coverage/html/"
6678
]
6779
},
6880
"scripts-descriptions": {
6981
"dev:build": "DEV: run dev:fix-style and dev:tests, run before pull request",
70-
"dev:check-style": "DEV: search for code style errors using php-cs-fixer and phpcs",
71-
"dev:fix-style": "DEV: fix code style errors using php-cs-fixer and phpcbf",
72-
"dev:test": "DEV: run dev:check-style, phpunit, phpstan and infection",
73-
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/"
82+
"dev:check-style": "DEV: search for code style errors using composer-normalize, php-cs-fixer and phpcs",
83+
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/",
84+
"dev:fix-style": "DEV: fix code style errors using composer-normalize, php-cs-fixer and phpcbf",
85+
"dev:test": "DEV: run dev:check-style, phpunit, phpstan and infection"
7486
}
7587
}

docs/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,24 @@ Usamos [Versionado Semántico 2.0.0](SEMVER.md) por lo que puedes usar esta libr
99
Pueden aparecer cambios no liberados que se integran a la rama principal, pero no ameritan una nueva liberación de versión,
1010
aunque sí su incorporación en la rama principal de trabajo. Generalmente, se tratan de cambios en el desarrollo.
1111

12+
### Versión 2.0.6 2026-04-01
13+
14+
- Se corrige la revisión del proyecto dado que *PHPStan* asume que la función `preg_grep` siempre retorna
15+
un arreglo sin tipo, cuando debería limitarse solamente a las opciones que recibe.
16+
- En las pruebas, se silencia la llamada a `XMLSecEnc::staticLocateKeyInfo` dado que tiene un
17+
problema de compatibilidad con PHP 8.5.
18+
- Se normaliza el archivo `composer.json`.
19+
- Se configura *PHPUnit* para que falle y muestre los detalles en todos los problemas encontrados.
20+
- Se agrega la herramienta `composer-normalize` a las herramientas de desarrollo.
21+
- Se actualizan los flujos de trabajo de GitHub:
22+
- Se agrega el trabajo `composer-normalize`.
23+
- Se renombra el trabajo `tests` a `phpunit`.
24+
- Se agrega PHP 8.5 a la matriz de prebas en el trabajo `phpunit`.
25+
- Los trabajos se ejecutan en PHP 8.5 excepto el trabajo `infection`.
26+
- Se actualizan las versiones de las acciones de GitHub.
27+
- Se actualiza `sonarqube-scan-action` a la versión 7.
28+
- Se actualizan las herramientas de desarrollo.
29+
1230
### Mantenimiento 2025-09-27
1331

1432
- Se corrige una prueba donde se estaba escribiendo el archivo esperado antes de su comparación.

docs/TODO.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
- Mejorar los casos de cobertura de código para hacer mandatorio `infection` en los pasos de construcción.
99

10+
- La librería `robrichards/xmlseclibs` a la fecha 2026-04-01 no es compatible con PHP 8.5.
11+
Se debe remover el operador de ignorar errores en el archivo `SignerImplementationTestCase`
12+
al llamar a la función estática `XMLSecEnc::staticLocateKeyInfo()`.
13+
1014
## Resueltas
1115

1216
- Generar excepciones internas en lugar de excepciones genéricas de SPL.

docs/XmlSecLibs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
A partir de la versión `1.0.0` se incluye un objeto `XmlSecLibsSigner` que implementa `SignerInterface`.
44

5-
Se puede utilizar [`robrichards/xmlseclibs`](https://github.com/robrichards/xmlseclibs) para hacer el firmado,
6-
sin embargo al 2019-04-09 aún no se han implementado los mecanismos para incluir el elemento `KeyValue`,
5+
Se puede utilizar [`robrichards/xmlseclibs`](https://github.com/robrichards/xmlseclibs) para hacer el firmado;
6+
sin embargo, al 2026-04-01 aún no se han implementado los mecanismos para incluir el elemento `KeyValue`,
77
a pesar de tener un [PR #75](https://github.com/robrichards/xmlseclibs/pull/75) desde 2015-09-03
88
y un [ISSUE #217](https://github.com/robrichards/xmlseclibs/issues/217).
99

@@ -29,7 +29,7 @@ $cancellation = $xmlhelper->signCancellation('11111111-2222-3333-4444-0000000000
2929

3030
## Instalación
3131

32-
Recuerda que `robrichards/xmlseclibs` no es una dependencia (es una recomendación) de `phpcfdi/xml-cancelacion`
32+
Recuerda que `robrichards/xmlseclibs` no es una dependencia (es una recomendación) de `phpcfdi/xml-cancelacion`.
3333

3434
```shell script
3535
# instalar esta librería

phpunit.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
44
cacheDirectory="build/phpunit.cache"
55
bootstrap="tests/bootstrap.php"
6+
displayDetailsOnAllIssues="true"
7+
failOnAllIssues="true"
68
colors="true"
79
>
810
<testsuites>

src/Signers/CreateKeyInfoElementTrait.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ protected function createKeyInfoElement(
2727
);
2828
$x509Data->appendChild($x509IssuerSerial);
2929

30-
$certificateContents = implode('', preg_grep('/^((?!-).)*$/', explode(PHP_EOL, $pemContents)) ?: []);
30+
/** @phpstan-var string[] $certificateContentLines explode returns string[] grep_grep return string[]|false */
31+
$certificateContentLines = preg_grep('/^((?!-).)*$/', explode(PHP_EOL, $pemContents)) ?: [];
32+
$certificateContents = implode('', $certificateContentLines);
3133
$x509Data->appendChild(
3234
$document->createElement('X509Certificate', htmlspecialchars($certificateContents, ENT_XML1))
3335
);

0 commit comments

Comments
 (0)