deved-it / fattura-elettronica

Fatturazione Elettronica Italiana
https://deved-it.github.io/fattura-elettronica
MIT License
77 stars 36 forks source link

Compatibilità PHP8 - Implements Countable & Iterator #104

Open shinesoftware opened 1 year ago

shinesoftware commented 1 year ago

Describe the bug Installando il modulo ed eseguendo la creazione del file xml viene indicato un errore all'implementazione della Countable e della Iterator in alcune classi del progetto deved. Controllando il codice sorgente del file ad esempio DettaglioLinee.php si nota che non vengono dichiarate esplicitamente i valori di ritorno.

To Reproduce Usare le classi sotto >= PHP8.0

Expected behavior Evitare l'errore seguente: Fatal error: During inheritance of Countable: Uncaught Exception: Deprecated Functionality: Return type of Deved\FatturaElettronica\FatturaElettronica\FatturaElettronicaBody\DatiBeniServizi\DettaglioLinee::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/deved/fattura-elettronica/src/FatturaElettronica/FatturaElettronicaBody/DatiBeniServizi/DettaglioLinee.php on line 125

Una soluzione alternativa potrebbe essere evitare il braking changes con l'impostazione della versione di PHP nel file di composer.

grazie

tagliamax commented 1 year ago

Ho avuto anche io lo stesso problema, in locale, con PHP 8.1. In attesa del fix, ho temporaneamente utilizzato l'operatore @ per la soppressione degli errori.