Skip to content

Commit

Permalink
Develop to main (#3)
Browse files Browse the repository at this point in the history
* Support to PHP 8.3 + Documentation

* CS Fix + Documentation Fix

* Update csfix script name to cs-fix
  • Loading branch information
AP - Axio Studio authored Jan 24, 2024
1 parent 3d339e5 commit 5ad15f4
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
vendor
composer.lock
.phpunit.result.cache
.php-cs-fixer.cache
example.php
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,6 @@ public ?string $Nome;
public ?string $Cognome;
```

#### CedentePrestatore

```
public DatiAnagrafici $DatiAnagrafici;
public Sede $Sede;
```

#### CessionarioCommittente

```
public DatiAnagrafici $DatiAnagrafici;
public Sede $Sede;
```

#### Sede

```
Expand Down Expand Up @@ -177,6 +163,8 @@ public ?string $BIC;
public ?string $ModalitaPagamento;
```

### Inizializzazione di una nuova fattura

Per inizializzare una fattura avremo quindi una struct di questo tipo:

```php
Expand All @@ -193,6 +181,8 @@ $datiXml = $fattura->compose(
);
```

### Esempio completo

Di seguito un semplice esempio di utilizzo:

```php
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"symfony/validator": "^6.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.48",
"phpunit/phpunit": "^9.0"
},
"autoload": {
Expand All @@ -41,7 +42,8 @@
}
},
"scripts": {
"test": "vendor/bin/phpunit"
"test": "vendor/bin/phpunit",
"cs-fix": "php php-cs-fixer fix src --rules=@PSR12 --allow-risky=yes"

},
"config": {
Expand Down
104 changes: 104 additions & 0 deletions php-cs-fixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/usr/bin/env php
<?php

/*
* This file is part of PHP CS Fixer.
*
* (c) Fabien Potencier <[email protected]>
* Dariusz Rumiński <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/

error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);

set_error_handler(static function ($severity, $message, $file, $line) {
if ($severity & error_reporting()) {
throw new ErrorException($message, 0, $severity, $file, $line);
}
});

// check environment requirements
(function () {
if (\PHP_VERSION_ID === 80000) {
fwrite(STDERR, "PHP CS Fixer is not able run on PHP 8.0.0 due to bug in PHP tokenizer (https://bugs.php.net/bug.php?id=80462).\n");
fwrite(STDERR, "Update PHP version to unblock execution.\n");

exit(1);
}

if (\PHP_VERSION_ID < 70400 || \PHP_VERSION_ID >= 80400) {
fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.4.0 and maximum version of PHP 8.3.*.\n");
fwrite(STDERR, 'Current PHP version: ' . PHP_VERSION . ".\n");

if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");
} else {
fwrite(STDERR, "To ignore this requirement please set `PHP_CS_FIXER_IGNORE_ENV`.\n");
fwrite(STDERR, "If you use PHP version higher than supported, you may experience code modified in a wrong way.\n");
fwrite(STDERR, "Please report such cases at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer .\n");

exit(1);
}
}

foreach (['json', 'tokenizer'] as $extension) {
if (!extension_loaded($extension)) {
fwrite(STDERR, sprintf("PHP extension ext-%s is missing from your system. Install or enable it.\n", $extension));

if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
fwrite(STDERR, "Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.\n");
} else {
exit(1);
}
}
}
})();

// load dependencies
(function () {
$require = true;
if (class_exists('Phar')) {
// Maybe this file is used as phar-stub? Let's try!
try {
Phar::mapPhar('php-cs-fixer.phar');

require_once 'phar://php-cs-fixer.phar/vendor/autoload.php';
$require = false;
} catch (PharException $e) {
}
}

if ($require) {
// OK, it's not, let give Composer autoloader a try!
$possibleFiles = [__DIR__ . '/../../autoload.php', __DIR__ . '/../autoload.php', __DIR__ . '/vendor/autoload.php'];
$file = null;
foreach ($possibleFiles as $possibleFile) {
if (file_exists($possibleFile)) {
$file = $possibleFile;

break;
}
}

if (null === $file) {
throw new RuntimeException('Unable to locate autoload.php file.');
}

require_once $file;
}
})();

use Composer\XdebugHandler\XdebugHandler;
use PhpCsFixer\Console\Application;

// Restart if xdebug is loaded, unless the environment variable PHP_CS_FIXER_ALLOW_XDEBUG is set.
$xdebug = new XdebugHandler('PHP_CS_FIXER');
$xdebug->check();
unset($xdebug);

$application = new Application();
$application->run();

__HALT_COMPILER();

0 comments on commit 5ad15f4

Please sign in to comment.