Skip to content

Commit

Permalink
Merge pull request #1 from eclipxe13/maintenante-20220715
Browse files Browse the repository at this point in the history
Mantenimiento 2022-06-15 (versión 0.2.1)
  • Loading branch information
eclipxe13 committed Jul 18, 2022
2 parents eac8104 + ab29f5a commit 10f17d5
Show file tree
Hide file tree
Showing 36 changed files with 147 additions and 117 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

# Do not put this files on a distribution package
/.github/ export-ignore
/.phive/ export-ignore
/build/ export-ignore
/tests/ export-ignore
/.editorconfig export-ignore
Expand All @@ -22,3 +23,6 @@
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore

# Do not count these files on github code language
/tests/_files/** linguist-detectable=false
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
/.github/* @phpcfdi/core-mantainers
/.github/* @phpcfdi/core-maintainers
105 changes: 56 additions & 49 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,99 +1,106 @@
name: build
on:
pull_request:
branches: [ main ]
branches: [ "main" ]
push:
branches: [ main ]
branches: [ "main" ]
schedule:
- cron: '0 16 * * 0' # sunday 16:00

jobs:

ci: # this job runs all the development tools
# Actions
# shivammathur/setup-php@v2 https://github.com/marketplace/actions/setup-php-action

name: PHP 8.0 (full)
jobs:
phpcs:
name: Coding standards (phpcs)
runs-on: "ubuntu-latest"

steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: cs2pr, phpcs
env:
fail-fast: true
- name: Run phpcs
run: phpcs -q --report=checkstyle | cs2pr

# see https://github.com/marketplace/actions/setup-php-action
php-cs-fixer:
name: Coding standards (php-cs-fixer)
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: bcmath, openssl, soap
php-version: '8.1'
coverage: none
tools: composer:v2, phpcs, php-cs-fixer, phpstan, cs2pr
tools: cs2pr, php-cs-fixer
env:
fail-fast: true
- name: Run php-cs-fixer
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

phpunit:
name: Tests on PHP ${{ matrix.php-versions }} (phpunit)
runs-on: "ubuntu-latest"
strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: sqlite3
coverage: none
tools: composer:v2
env:
fail-fast: true
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist

- name: Code style (phpcs)
run: phpcs -q --report=checkstyle | cs2pr

- name: Code style (php-cs-fixer)
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

- name: Tests
- name: Run phpunit
run: vendor/bin/phpunit --testdox --verbose

- name: Code analysis (phpstan)
run: phpstan analyse --no-progress --verbose

build: # this job runs tests on all php supported versions

name: PHP ${{ matrix.php-versions }} (tests)
phpstan:
name: Static analysis (phpstan)
runs-on: "ubuntu-latest"

strategy:
matrix:
php-versions: ['7.4']

steps:

- name: Checkout
uses: actions/checkout@v2

# see https://github.com/marketplace/actions/setup-php-action
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: bcmath, openssl, soap
php-version: '8.1'
coverage: none
tools: composer:v2, cs2pr
tools: composer:v2, phpstan
env:
fail-fast: true

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist

- name: Tests
run: vendor/bin/phpunit --testdox --verbose
- name: Run phpstan
run: phpstan analyse --no-progress --verbose
9 changes: 4 additions & 5 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.1.0" installed="3.1.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.6.0" installed="3.6.0" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.6.0" installed="3.6.0" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^0.12.98" installed="0.12.98" location="./tools/phpstan" copy="false"/>
<phar name="infection" version="^0.23.0" installed="0.23.0" location="./tools/infection" copy="false"/>
<phar name="php-cs-fixer" version="^3.9.4" installed="3.9.4" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.7.1" installed="3.7.1" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.7.1" installed="3.7.1" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^1.8.1" installed="1.8.1" location="./tools/phpstan" copy="false"/>
</phive>
10 changes: 5 additions & 5 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setCacheFile(__DIR__ . '/build/php_cs.cache')
->setCacheFile(__DIR__ . '/build/php-cs-fixer.cache')
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP74Migration' => true,
'@PHP74Migration:risky' => true,
// PSR12 (remove when php-cs-fixer reaches ^3.1.1)
'class_definition' => ['space_before_parenthesis' => true],
// symfony
// 'class_attributes_separation' => true, // conflict with PSR12
'class_attributes_separation' => true, // conflict with PSR12
'whitespace_after_comma_in_array' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'function_typehint_space' => true,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['arrays', 'arguments']],
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'binary_operator_spaces' => true,
Expand All @@ -42,11 +41,12 @@
'self_accessor' => true,
// contrib
'not_operator_with_successor_space' => true,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']], // @PSR12 sort_algorithm: none
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->append([__FILE__])
->exclude(['vendor', 'build'])
->exclude(['vendor', 'tools', 'build']),
)
;
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2021 PhpCfdi https://www.phpcfdi.com/
Copyright (c) 2021 - 2022 PhpCfdi https://www.phpcfdi.com/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
"PhpCfdi\\CeUtils\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true
}
},
"scripts": {
"dev:build": [
"@dev:fix-style",
Expand Down
31 changes: 25 additions & 6 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,33 @@ Usamos [Versionado Semántico 2.0.0](SEMVER.md) por lo que puedes usar esta libr

## Cambios no liberados en una versión

Pueden aparecer cambios no liberados que se integran a la rama principal, pero no ameritan una nueva liberación de
versión, aunque sí su incorporación en la rama principal de trabajo. Generalmente se tratan de cambios en el desarrollo.
Pueden aparecer cambios no liberados que se integran a la rama principal, pero no ameritan una nueva liberación de versión,
aunque sí su incorporación en la rama principal de trabajo. Generalmente, se tratan de cambios en el desarrollo.

## Listado de cambios

### Version 0.2.0 2021-09-11
### Versión 0.2.1 2022-06-15

- Se adopta el proyecto de César Aquilera (@blacktrue) como parte de PhpCfdi.
Esta liberación corrige el proceso de integración continua, modifica el código fuente del proyecto y
mejora el paquete redistribuible, aunque no contiene ningún cambio de funcionamiento.

Cambios al código público:

- Se actualiza la licencia a 2022.
- Se actualiza el código para seguir el estilo actualizado.
- Se permite la ejecución del plugin `ergebnis/composer-normalize`.
- Se ignora `.phive/` del paquete de distribución.

Cambios en entorno de desarrollo:

- Se actualizan las herramientas de desarrollo y el archivo de configuración de `php-cs-fixer`.
- Se agrega la revisión de compatiblidad de PHP 8.1.
- Se dividen los pasos de construcción completa en pequeños trabajos independientes.
- Se corrige el grupo de mantenedores del proyecto.
- Se ignora `tests/_files` de la detección lingüística del proyecto.

### Versión 0.2.0 2021-09-11

- Se adopta el proyecto de César Aquilera `@blacktrue` como parte de PhpCfdi.
- Se actualizan los archivos de proyecto y de desarrollo.
- Se agrega la dependencia omitida ``
- Cambian el codebase
- Se hace la primera liberación pública.
3 changes: 1 addition & 2 deletions src/AbstractCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
abstract class AbstractCreator
{
use XsltBuilderPropertyTrait;

use XmlResolverPropertyTrait;

public function __construct(?XmlResolver $xmlResolver = null)
Expand Down Expand Up @@ -49,7 +48,7 @@ public function addSello(Credential $credential): self

$this->getRootNode()->addAttributes([
'Sello' => base64_encode(
$credential->privateKey()->sign($cadenaDeOrigen, $this->getSelloAlgorithm())
$credential->privateKey()->sign($cadenaDeOrigen, $this->getSelloAlgorithm()),
),
]);

Expand Down
2 changes: 1 addition & 1 deletion src/Validate/AuxiliarCuentas13/Base/DocumentDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static function create(): self
return new self(
'AUXCTA13DOC',
AuxiliarCuentas13Definition::ELEMENT_NAME,
AuxiliarCuentas13Definition::NAMESPACE
AuxiliarCuentas13Definition::NAMESPACE,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static function create(): self
return new self(
'AUXCTA13SCHEMA',
AuxiliarCuentas13Definition::NAMESPACE,
AuxiliarCuentas13Definition::XSD_LOCATION
AuxiliarCuentas13Definition::XSD_LOCATION,
);
}
}
2 changes: 1 addition & 1 deletion src/Validate/AuxiliarFolios13/Base/DocumentDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static function create(): self
return new self(
'AUXFOL13DOC',
AuxiliarFolios13Definition::ELEMENT_NAME,
AuxiliarFolios13Definition::NAMESPACE
AuxiliarFolios13Definition::NAMESPACE,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static function create(): self
return new self(
'AUXFOL13SCHEMA',
AuxiliarFolios13Definition::NAMESPACE,
AuxiliarFolios13Definition::XSD_LOCATION
AuxiliarFolios13Definition::XSD_LOCATION,
);
}
}
6 changes: 3 additions & 3 deletions src/Validate/Balanza13/CuentasSaldoFinal.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function validate(NodeInterface $root, Asserts $asserts): void
{
$assert = $asserts->put(
'BAL13SF01',
'Para cada cuenta, el saldo final debe ser el saldo inicial más el debe menos el deber'
'Para cada cuenta, el saldo final debe ser el saldo inicial más el debe menos el deber',
);
$nodes = $root->searchNodes('BCE:Ctas');
$failedIndexes = [];
Expand All @@ -40,7 +40,7 @@ public function validate(NodeInterface $root, Asserts $asserts): void
$explanation = sprintf(
'Número de nodos: %d, Nodos con errores: %s.',
$nodes->count(),
implode(', ', $failedIndexes) ?: '(ninguno)'
implode(', ', $failedIndexes) ?: '(ninguno)',
);
$assert->setStatus(Status::when([] === $failedIndexes), $explanation);
}
Expand All @@ -64,7 +64,7 @@ public function validateNodeCtas(int $index, NodeInterface $node, Asserts $asser
$node['Haber'],
$node['SaldoFin'],
(string) $equals,
)
),
);
return $equals;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Validate/Balanza13/FechaModificacionBalanza.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function validate(NodeInterface $root, Asserts $asserts): void
{
$assert = $asserts->put(
'BAL13FMB01',
'Si el tipo de envío es complemento entonces la fecha de modificación de balanza debe existir'
'Si el tipo de envío es complemento entonces la fecha de modificación de balanza debe existir',
);
if ('C' === $root['TipoEnvio']) {
$assert->setStatus(Status::when('' !== $root['FechaModBal']));
Expand Down
Loading

0 comments on commit 10f17d5

Please sign in to comment.