Skip to content

Commit 2307eb2

Browse files
authored
Merge pull request #22 from eclipxe13/version-1.3.0
Elimina la compatiblidad con PHP 7.3, PHP 7.4 y PHP 8.0 (versión 1.3.0)
2 parents 1a8c0a0 + 73d7ffc commit 2307eb2

30 files changed

+127
-186
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup PHP
2323
uses: shivammathur/setup-php@v2
2424
with:
25-
php-version: '8.3'
25+
php-version: '8.4'
2626
coverage: none
2727
tools: composer-normalize
2828
env:
@@ -39,7 +39,7 @@ jobs:
3939
- name: Setup PHP
4040
uses: shivammathur/setup-php@v2
4141
with:
42-
php-version: '8.3'
42+
php-version: '8.4'
4343
coverage: none
4444
tools: cs2pr, phpcs
4545
env:
@@ -73,7 +73,7 @@ jobs:
7373
- name: Setup PHP
7474
uses: shivammathur/setup-php@v2
7575
with:
76-
php-version: '8.3'
76+
php-version: '8.4'
7777
coverage: none
7878
tools: composer:v2, phpstan
7979
env:
@@ -93,18 +93,18 @@ jobs:
9393
run: phpstan analyse --no-progress --verbose
9494

9595
tests:
96-
name: Tests on PHP ${{ matrix.php-versions }}
96+
name: Tests on PHP ${{ matrix.php-version }}
9797
runs-on: "ubuntu-latest"
9898
strategy:
9999
matrix:
100-
php-versions: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
100+
php-version: ['8.1', '8.2', '8.3', '8.4']
101101
steps:
102102
- name: Checkout
103103
uses: actions/checkout@v4
104104
- name: Setup PHP
105105
uses: shivammathur/setup-php@v2
106106
with:
107-
php-version: ${{ matrix.php-versions }}
107+
php-version: ${{ matrix.php-version }}
108108
coverage: none
109109
tools: composer:v2
110110
env:
@@ -121,4 +121,4 @@ jobs:
121121
- name: Install project dependencies
122122
run: composer upgrade --no-interaction --no-progress --prefer-dist
123123
- name: Tests (phpunit)
124-
run: vendor/bin/phpunit --testdox --verbose
124+
run: vendor/bin/phpunit --testdox

.github/workflows/coverage.yml renamed to .github/workflows/sonarcloud.yml

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

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

1111
jobs:
1212

1313
tests-coverage:
14-
name: Tests on PHP 8.0 (code coverage)
14+
name: Tests on PHP (code coverage)
1515
runs-on: "ubuntu-latest"
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919
- name: Setup PHP
2020
uses: shivammathur/setup-php@v2
2121
with:
22-
php-version: '8.3'
22+
php-version: '8.4'
2323
coverage: xdebug
2424
tools: composer:v2
2525
env:
@@ -36,7 +36,7 @@ jobs:
3636
- name: Install project dependencies
3737
run: composer upgrade --no-interaction --no-progress --prefer-dist
3838
- name: Create code coverage
39-
run: vendor/bin/phpunit --testdox --verbose --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
39+
run: vendor/bin/phpunit --testdox --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
4040
- name: Store code coverage
4141
uses: actions/upload-artifact@v4
4242
with:
@@ -79,7 +79,7 @@ jobs:
7979
- name: Setup PHP
8080
uses: shivammathur/setup-php@v2
8181
with:
82-
php-version: '8.3'
82+
php-version: '8.4'
8383
coverage: none
8484
tools: composer:v2
8585
- name: Get composer cache directory
@@ -103,7 +103,6 @@ jobs:
103103
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/junit.xml > build/sonar-junit.xml
104104
sed 's#'$GITHUB_WORKSPACE'#/github/workspace#g' build/coverage/clover.xml > build/sonar-coverage.xml
105105
- name: SonarCloud Scan
106-
uses: sonarsource/sonarcloud-github-action@master
106+
uses: SonarSource/sonarqube-scan-action@v5
107107
env:
108-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
109108
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.phive/phars.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phive xmlns="https://phar.io/phive">
3-
<phar name="php-cs-fixer" version="^3.58.1" installed="3.58.1" location="./tools/php-cs-fixer" copy="false"/>
4-
<phar name="phpcs" version="^3.10.1" installed="3.10.1" location="./tools/phpcs" copy="false"/>
5-
<phar name="phpcbf" version="^3.10.1" installed="3.10.1" location="./tools/phpcbf" copy="false"/>
6-
<phar name="phpstan" version="^1.11.4" installed="1.11.4" location="./tools/phpstan" copy="false"/>
7-
<phar name="composer-normalize" version="^2.42.0" installed="2.42.0" location="./tools/composer-normalize" copy="false"/>
3+
<phar name="php-cs-fixer" version="^3.75.0" installed="3.75.0" location="./tools/php-cs-fixer" copy="false"/>
4+
<phar name="phpcs" version="^3.12.1" installed="3.12.1" location="./tools/phpcs" copy="false"/>
5+
<phar name="phpcbf" version="^3.12.1" installed="3.12.1" location="./tools/phpcbf" copy="false"/>
6+
<phar name="phpstan" version="^2.1.11" installed="2.1.11" location="./tools/phpstan" copy="false"/>
7+
<phar name="composer-normalize" version="^2.46.0" installed="2.46.0" location="./tools/composer-normalize" copy="false"/>
88
</phive>

.php-cs-fixer.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
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
2121
'class_attributes_separation' => true,
2222
'whitespace_after_comma_in_array' => true,

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 - 2024 PhpCfdi https://www.phpcfdi.com/
3+
Copyright (c) 2019 - 2025 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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ $pfxReader = new PfxReader();
183183
$credential = $pfxReader->createCredentialFromContents('contenido-del-archivo', 'pfx-passphrase');
184184

185185
// crea un objeto Credential dada la ruta local de un archivo pfx
186-
$credential = $pfxReader->createCredentialsFromFile('pfxFilePath', 'pfx-passphrase');
186+
$credential = $pfxReader->createCredentialFromFile('pfxFilePath', 'pfx-passphrase');
187187
```
188188

189189
## Compatibilidad

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"keywords": [
66
"efirma",
77
"fiel",
8+
"csd",
89
"sat",
910
"cfdi",
1011
"sello",
@@ -22,14 +23,14 @@
2223
"source": "https://github.com/phpcfdi/credentials"
2324
},
2425
"require": {
25-
"php": ">=7.3",
26+
"php": ">=8.1",
2627
"ext-mbstring": "*",
2728
"ext-openssl": "*",
28-
"eclipxe/enum": "^0.2.0"
29+
"eclipxe/enum": "^0.2.7"
2930
},
3031
"require-dev": {
3132
"ext-json": "*",
32-
"phpunit/phpunit": "^9.5"
33+
"phpunit/phpunit": "^10.5.45"
3334
},
3435
"prefer-stable": true,
3536
"autoload": {
@@ -60,15 +61,15 @@
6061
"@php tools/phpcs --colors -sp"
6162
],
6263
"dev:coverage": [
63-
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --verbose --coverage-html build/coverage/html/"
64+
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --coverage-html build/coverage/html/"
6465
],
6566
"dev:fix-style": [
6667
"@php tools/composer-normalize normalize",
6768
"@php tools/php-cs-fixer fix --verbose",
6869
"@php tools/phpcbf --colors -sp"
6970
],
7071
"dev:test": [
71-
"@php vendor/bin/phpunit --testdox --verbose --stop-on-failure",
72+
"@php vendor/bin/phpunit --testdox --stop-on-failure",
7273
"@php tools/phpstan analyse --no-progress --verbose"
7374
]
7475
},

docs/CHANGELOG.md

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

1212
## Listado de cambios
1313

14+
### Versión 1.3.0 2025-04-12
15+
16+
- Se mejoran las declaraciones de tipos.
17+
- Se elimina la compatiblidad con PHP 7.3, PHP 7.4 y PHP 8.0.
18+
- Se actualiza la acción de GitHub a `Update to SonarSource/sonarqube-scan-action@v5`.
19+
20+
### Versión 1.2.3 2025-03-30
21+
22+
Se corrigieron los problemas asociados a la compatibilidad de PHP 8.4.
23+
24+
- Se agregó explícitamente el operador de tipos *nullable* `?`.
25+
- Se actualizó la dependencia `eclipxe/enum` a una versión compatible con PHP 8.4.
26+
27+
Se actualiza el año de licencia a 2025.
28+
29+
Se hicieron cambios menores al código sugeridos por PHPStan y PSalm.
30+
31+
Adicionalmente, se hacen los siguientes cambios internos:
32+
33+
- Se agrega PHP 8.4 a la matriz de pruebas del flujo de trabajo `build`.
34+
- Se ejecuta la mayoría de los trabajos de los flujos de trabajo usando PHP 8.4.
35+
- Se actualizan las herramientas de desarrollo.
36+
1437
### Versión 1.2.2 2024-06-06
1538

1639
Se corrigió el problema de no crear correctamente el número de serie cuando incluía caracteres en mayúsculas.

phpunit.xml.dist

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
bootstrap="tests/bootstrap.php"
66
colors="true"
77
>
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>
8+
<source>
9+
<include>
10+
<directory>src</directory>
11+
</include>
12+
</source>
13+
<testsuites>
14+
<testsuite name="default">
15+
<directory>tests</directory>
16+
</testsuite>
17+
</testsuites>
1818
</phpunit>

src/Certificate.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ class Certificate
1616
use LocalFileOpenTrait;
1717

1818
/** @var string PEM contents including headers */
19-
private $pem;
19+
private string $pem;
2020

2121
/** @var string RFC as parsed from subject/x500UniqueIdentifier */
22-
private $rfc;
22+
private string $rfc;
2323

2424
/** @var string Legal name as parsed from subject/x500UniqueIdentifier */
25-
private $legalName;
25+
private string $legalName;
2626

2727
/** @var SerialNumber|null Parsed serial number */
28-
private $serialNumber;
28+
private ?SerialNumber $serialNumber = null;
2929

3030
/** @var PublicKey|null Parsed public key */
31-
private $publicKey;
31+
private ?PublicKey $publicKey = null;
3232

3333
/**
3434
* Certificate constructor
@@ -59,7 +59,6 @@ public function __construct(string $contents)
5959
* Convert X.509 DER base64 or X.509 DER to X.509 PEM
6060
*
6161
* @param string $contents can be a certificate format X.509 DER or X.509 DER base64
62-
* @return string
6362
*/
6463
public static function convertDerToPem(string $contents): string
6564
{
@@ -77,7 +76,6 @@ public static function convertDerToPem(string $contents): string
7776
* The content file can be a certificate format X.509 PEM, X.509 DER or X.509 DER base64
7877
*
7978
* @param string $filename must be a local file (without scheme or file:// scheme)
80-
* @return Certificate
8179
*/
8280
public static function openFile(string $filename): self
8381
{
@@ -230,12 +228,12 @@ public function satType(): SatTypeEnum
230228
return SatTypeEnum::csd();
231229
}
232230

233-
public function validOn(DateTimeImmutable $datetime = null): bool
231+
public function validOn(?DateTimeImmutable $datetime = null): bool
234232
{
235233
if (null === $datetime) {
236234
$datetime = new DateTimeImmutable();
237235
}
238-
return ($datetime >= $this->validFromDateTime() && $datetime <= $this->validToDateTime());
236+
return $datetime >= $this->validFromDateTime() && $datetime <= $this->validToDateTime();
239237
}
240238

241239
protected function createSerialNumber(string $hexadecimal, string $decimal): SerialNumber

0 commit comments

Comments
 (0)