Skip to content

Commit f1e2b21

Browse files
authored
Merge pull request #15 from eclipxe13/version-3.1.0
Mantenimiento y soporte CFDI 4.0 (Versión 3.1.0)
2 parents 14d52ce + 485bdeb commit f1e2b21

39 files changed

+862
-259
lines changed

.gitattributes

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88

99
# Do not put this files on a distribution package
1010
/.github/ export-ignore
11+
/.phive/ export-ignore
1112
/build/ export-ignore
1213
/tests/ export-ignore
1314
/.gitattributes export-ignore
1415
/.gitignore export-ignore
1516
/.php-cs-fixer.dist.php export-ignore
1617
/.scrutinizer.yml export-ignore
1718
/phpcs.xml.dist export-ignore
18-
/phpstan.neon.dist export-ignore
19+
/phpstan.neon.dist export-ignore
1920
/phpunit.xml.dist export-ignore
21+
22+
# Do not count these files on github code language
23+
/tests/_files/** linguist-detectable=false

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
2-
/.github/* @phpcfdi/core-mantainers
2+
/.github/* @phpcfdi/core-maintainers

.github/workflows/build.yml

Lines changed: 94 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,97 +8,143 @@ on:
88
- cron: '0 16 * * 0' # sunday 16:00
99

1010
jobs:
11-
12-
ci: # this job runs all the development tools and upload code coverage to scrutinizer
13-
14-
name: Continuous Integration
11+
phpcs:
12+
name: Code Style (phpcs)
1513
runs-on: "ubuntu-latest"
16-
1714
steps:
18-
1915
- name: Checkout
20-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
17+
- name: Setup PHP
18+
uses: shivammathur/setup-php@v2
19+
with:
20+
php-version: '8.1'
21+
coverage: none
22+
tools: phpcs, cs2pr
23+
- name: phpcs
24+
run: phpcs -q --report=checkstyle | cs2pr
2125

22-
# see https://github.com/marketplace/actions/setup-php-action
26+
php-cs-fixer:
27+
name: Code Style (php-cs-fixer)
28+
runs-on: "ubuntu-latest"
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v3
2332
- name: Setup PHP
2433
uses: shivammathur/setup-php@v2
2534
with:
26-
php-version: '8.0'
27-
coverage: xdebug
28-
tools: composer:v2, phpcs, php-cs-fixer, phpstan, cs2pr
29-
env:
30-
fail-fast: true
35+
php-version: '8.1'
36+
coverage: none
37+
tools: php-cs-fixer, cs2pr
38+
- name: php-cs-fixer
39+
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
3140

41+
phpstan:
42+
name: Code analysis (phpstan)
43+
runs-on: "ubuntu-latest"
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v3
47+
- name: Setup PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: '8.1'
51+
coverage: none
52+
tools: composer:v2, phpstan, cs2pr
3253
- name: Get composer cache directory
3354
id: composer-cache
3455
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
35-
3656
- name: Cache dependencies
37-
uses: actions/cache@v2
57+
uses: actions/cache@v3
3858
with:
3959
path: ${{ steps.composer-cache.outputs.dir }}
4060
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
4161
restore-keys: ${{ runner.os }}-composer-
42-
4362
- name: Install project dependencies
4463
run: composer upgrade --no-interaction --no-progress --prefer-dist
45-
46-
- name: Code style (phpcs)
47-
run: phpcs -q --report=checkstyle | cs2pr
48-
49-
- name: Code style (php-cs-fixer)
50-
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
51-
52-
- name: Tests (phpunit with code coverage)
53-
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml
54-
55-
- name: Code analysis (phpstan)
64+
- name: phpstan
5665
run: phpstan analyse --no-progress --verbose
5766

58-
# see https://github.com/marketplace/actions/action-scrutinizer
59-
- name: Upload code coverage to scrutinizer
60-
uses: sudo-bot/action-scrutinizer@latest
67+
psalm:
68+
name: Code analysis (psalm)
69+
runs-on: "ubuntu-latest"
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v3
73+
- name: Setup PHP
74+
uses: shivammathur/setup-php@v2
6175
with:
62-
cli-args: "--format=php-clover build/coverage-clover.xml"
63-
continue-on-error: true
64-
65-
build: # this job runs tests on all php supported versions
76+
php-version: '8.1'
77+
coverage: none
78+
tools: psalm, cs2pr
79+
- name: Get composer cache directory
80+
id: composer-cache
81+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
82+
- name: Cache dependencies
83+
uses: actions/cache@v3
84+
with:
85+
path: ${{ steps.composer-cache.outputs.dir }}
86+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
87+
restore-keys: ${{ runner.os }}-composer-
88+
- name: Install project dependencies
89+
run: composer upgrade --no-interaction --no-progress --prefer-dist
90+
- name: psalm
91+
run: psalm --no-progress --output-format=github
6692

67-
name: PHP ${{ matrix.php-versions }}
93+
tests:
94+
name: Tests PHP ${{ matrix.php-versions }} (phpunit)
6895
runs-on: "ubuntu-latest"
69-
7096
strategy:
7197
matrix:
72-
php-versions: ['7.3', '7.4', '8.0']
73-
98+
php-versions: ['7.3', '7.4', '8.0', '8.1']
7499
steps:
75-
76100
- name: Checkout
77-
uses: actions/checkout@v2
78-
79-
# see https://github.com/marketplace/actions/setup-php-action
101+
uses: actions/checkout@v3
80102
- name: Setup PHP
81-
uses: shivammathur/setup-php@v2
103+
uses: shivammathur/setup-php@v2 # see https://github.com/marketplace/actions/setup-php-action
82104
with:
83105
php-version: ${{ matrix.php-versions }}
84106
coverage: none
85107
tools: composer:v2, cs2pr
86108
env:
87109
fail-fast: true
88-
89110
- name: Get composer cache directory
90111
id: composer-cache
91112
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
92-
93113
- name: Cache dependencies
94-
uses: actions/cache@v2
114+
uses: actions/cache@v3
95115
with:
96116
path: ${{ steps.composer-cache.outputs.dir }}
97117
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
98118
restore-keys: ${{ runner.os }}-composer-
99-
100119
- name: Install project dependencies
101120
run: composer upgrade --no-interaction --no-progress --prefer-dist
102-
103121
- name: Tests
104122
run: vendor/bin/phpunit --testdox --verbose
123+
124+
infection:
125+
name: Mutation testing analysis
126+
runs-on: "ubuntu-latest"
127+
steps:
128+
- name: Checkout
129+
uses: actions/checkout@v3
130+
- name: Setup PHP
131+
uses: shivammathur/setup-php@v2
132+
with:
133+
php-version: '8.1'
134+
coverage: xdebug
135+
tools: composer:v2, infection
136+
- name: Get composer cache directory
137+
id: composer-cache
138+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
139+
- name: Cache dependencies
140+
uses: actions/cache@v3
141+
with:
142+
path: ${{ steps.composer-cache.outputs.dir }}
143+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
144+
restore-keys: ${{ runner.os }}-composer-
145+
- name: Install project dependencies
146+
run: composer upgrade --no-interaction --no-progress --prefer-dist
147+
- name: Create code coverage
148+
run: vendor/bin/phpunit --testdox --verbose --coverage-xml=build/coverage --coverage-clover=build/coverage/clover.xml --log-junit=build/coverage/junit.xml
149+
- name: infection
150+
run: infection --skip-initial-tests --coverage=build/coverage --no-progress --no-interaction --logger-github

.phive/phars.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +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.1.0" installed="3.2.1" location="./tools/php-cs-fixer" copy="false"/>
4-
<phar name="phpcs" version="^3.6.0" installed="3.6.1" location="./tools/phpcs" copy="false"/>
5-
<phar name="phpcbf" version="^3.6.0" installed="3.6.1" location="./tools/phpcbf" copy="false"/>
6-
<phar name="phpstan" version="^1.1.2" installed="1.1.2" location="./tools/phpstan" copy="false"/>
3+
<phar name="php-cs-fixer" version="^3.8.0" installed="3.8.0" location="./tools/php-cs-fixer" copy="false"/>
4+
<phar name="phpcs" version="^3.7.0" installed="3.7.0" location="./tools/phpcs" copy="false"/>
5+
<phar name="phpcbf" version="^3.7.0" installed="3.7.0" location="./tools/phpcbf" copy="false"/>
6+
<phar name="phpstan" version="^1.7.14" installed="1.7.14" location="./tools/phpstan" copy="false"/>
7+
<phar name="psalm" version="^4.23.0" installed="4.23.0" location="./tools/psalm" copy="false"/>
8+
<phar name="infection" version="^0.26.11" installed="0.26.11" location="./tools/infection" copy="false"/>
79
</phive>

.php-cs-fixer.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
return (new PhpCsFixer\Config())
1313
->setRiskyAllowed(true)
14-
->setCacheFile(__DIR__ . '/build/php_cs.cache')
14+
->setCacheFile(__DIR__ . '/build/php-cs-fixer.cache')
1515
->setRules([
1616
'@PSR12' => true,
1717
'@PSR12:risky' => true,
@@ -45,6 +45,6 @@
4545
PhpCsFixer\Finder::create()
4646
->in(__DIR__)
4747
->append([__FILE__])
48-
->exclude(['vendor', 'build'])
48+
->exclude(['vendor', 'tools', 'build']),
4949
)
5050
;

.scrutinizer.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ build:
1515
tests:
1616
override:
1717
- php-scrutinizer-run --enable-security-analysis
18-
19-
tools:
20-
external_code_coverage: true
18+
- command: vendor/bin/phpunit --verbose --testdox --coverage-clover=coverage.clover
19+
coverage:
20+
file: coverage.clover
21+
format: clover

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 - 2021 PhpCfdi https://www.phpcfdi.com
3+
Copyright (c) 2019 - 2022 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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@
88
[![Coverage Status][badge-coverage]][coverage]
99
[![Total Downloads][badge-downloads]][downloads]
1010

11-
> Genera expresiones de CFDI 3.3, CFDI 3.2 y RET 1.0
11+
> Genera expresiones de CFDI 4.4, CFDI 3.3, CFDI 3.2 y RET 1.0
1212
1313
:us: The documentation of this project is in spanish as this is the natural language for intended audience.
1414

1515
:mexico: La documentación del proyecto está en español porque ese es el lenguaje principal de los usuarios.
1616

17-
Esta librería contiene objetos de ayuda para crear expresiones de CFDI 3.2, CFDI 3.3 y RET 1.0
17+
Esta librería contiene objetos de ayuda para crear expresiones de CFDI 3.2, CFDI 3.3, CFDI 3.4 y RET 1.0
1818
de acuerdo a la información técnica del SAT en el Anexo 20.
1919

2020
Estas expresiones se utilizan principalmente para dos motivos:
2121

2222
1. Generar el código QR de una representación impresa de un CFDI o RET.
2323
2. Consultar el WebService del SAT de estado de un CFDI.
2424

25-
Ejemplo de expresión para CFDI 3.3:
25+
Ejemplo de expresión para CFDI 3.3 y CFDI 4.0:
26+
27+
Estas especificaciones comparten el mismo estándar.
2628

2729
```text
2830
https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx?id=CEE4BE01-ADFA-4DEB-8421-ADD60F0BEDAC&re=POT9207213D6&rr=DIM8701081LA&tt=2010.01&fe=/OAgdg==
@@ -86,7 +88,7 @@ sin temor a romper tu aplicación.
8688
### Cambiar de la versión 2.0.0 a la versión 3.0.0
8789

8890
La versión `3.0.0` agrega un método a la interfaz `ExpressionExtractorInterface` por lo que es necesario crear una
89-
versión mayor. Puedes actualizar con confianza si no creaste alguna clase que implemente `ExpressionExtractorInterface`.
91+
versión mayor. Puedes actualizar con confianza si no generaste alguna clase que implemente `ExpressionExtractorInterface`.
9092

9193
## Contribuciones
9294

composer.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"name": "phpcfdi/cfdi-expresiones",
3-
"description": "Genera expresiones de CFDI 3.3, CFDI 3.2 y RET 1.0",
3+
"description": "Genera expresiones de CFDI 4.4, CFDI 3.3, CFDI 3.2 y RET 1.0",
44
"keywords": ["phpcfdi", "sat", "cfdi"],
55
"homepage": "https://github.com/phpcfdi/cfdi-expresiones",
66
"license": "MIT",
77
"authors": [
88
{
99
"name": "Carlos C Soto",
1010
"email": "eclipxe13@gmail.com",
11-
"homepage": "http://eclipxe.com.mx/"
11+
"homepage": "https://eclipxe.com.mx/"
1212
}
1313
],
1414
"support": {
@@ -24,10 +24,12 @@
2424
},
2525
"require": {
2626
"php": ">=7.3",
27-
"ext-dom": "*"
27+
"ext-dom": "*",
28+
"ext-mbstring": "*"
2829
},
2930
"require-dev": {
30-
"phpunit/phpunit": "^9.5"
31+
"phpunit/phpunit": "^9.5",
32+
"ext-json": "*"
3133
},
3234
"autoload": {
3335
"psr-4": {
@@ -52,7 +54,9 @@
5254
"dev:test": [
5355
"@dev:check-style",
5456
"@php vendor/bin/phpunit --testdox --verbose --stop-on-failure",
55-
"@php tools/phpstan analyse --verbose"
57+
"@php tools/phpstan analyse --no-progress",
58+
"@php tools/psalm --no-progress",
59+
"@php tools/infection --no-progress --no-interaction --show-mutations"
5660
],
5761
"dev:coverage": [
5862
"@php -dzend_extension=xdebug.so -dxdebug.mode=coverage vendor/bin/phpunit --verbose --coverage-html build/coverage/html/"
@@ -62,7 +66,7 @@
6266
"dev:build": "DEV: run dev:fix-style and dev:tests, run before pull request",
6367
"dev:check-style": "DEV: search for code style errors using php-cs-fixer and phpcs",
6468
"dev:fix-style": "DEV: fix code style errors using php-cs-fixer and phpcbf",
65-
"dev:test": "DEV: run dev:check-style, phpunit and phpstan",
69+
"dev:test": "DEV: run dev:check-style, phpunit, phpstan, psalm and infection",
6670
"dev:coverage": "DEV: run phpunit with xdebug and storage coverage in build/coverage/html/"
6771
}
6872
}

0 commit comments

Comments
 (0)