Améliorations de code et corrections de comportement (PHPStan lvl 1)#3260
Améliorations de code et corrections de comportement (PHPStan lvl 1)#3260kwizer15 wants to merge 3 commits intojeedom:developfrom
Conversation
|
|
||
| public function historyInfluxAll() { | ||
| cmd::historyInflux('all'); | ||
| public static function historyInfluxAll() { |
There was a problem hiding this comment.
cmd::historyInflux('all'); is already creating a cron, why moving this code?
anyway, as others discussions are ongoing on influx (#3039), I prefer we do not modify this for now
However, keep the fix on static declaration
There was a problem hiding this comment.
cmd::historyInflux is not static. It's just a copy/paste
There was a problem hiding this comment.
ok, now I got it
I made a refacto so solve the "static issue" without copy/paster
|
|
||
| public function historyInfluxAll() { | ||
| cmd::historyInflux('all'); | ||
| public static function historyInfluxAll() { |
There was a problem hiding this comment.
cmd::historyInflux is not static. It's just a copy/paste
|
ok for me |
Description
Corrections qui améliorent la robustesse du code, détectées par PHPStan au niveau 1. Contrairement aux autres PRs de cette série, certaines de ces modifications changent légèrement le comportement pour corriger des problèmes réels.
Corrections de comportement :
cmd::historyInfluxAll()— Remplacement de l'appel direct àhistoryInflux('all')par la création d'une tâche cron dédiée, évitant un timeout sur les gros volumesjeeObject.class.php— Réordonnancement du guardclass_exists('virtual')avant l'appel à$plugin->isActive()pour éviter un crash si la classe n'est pas chargéenetwork.class.php— Ajout declass_exists('openvpn')dans le guard pour la même raisonjsonrpcClient.class.php— Remplacement duwhilepardo...while(la boucle doit s'exécuter au moins une fois)scenario::export()— Ajout dereturnexplicites dans chaque branche pour éviter unreturnambigu en fin de méthodecore/php/utils.inc.phpredirect()—exit(header(...))remplacé parheader(); exitcarheader()retourne voidcore/php/utils.inc.phpevaluate()— Restructuration du bloc if/else pour protéger correctement les chaînes entre guillemetsNettoyage sans changement de comportement :
plugin.class.php— Suppression duisset($listPlugin)redondant (la variable est toujours définie)market.repo.php— Remplacement de la fonction globalecmp()par une closure avec l'opérateur spaceship<=>install/backup.php— Suppression duisset()redondant aprèstrim()jeedom.config.php— Suppression du genericTypeTHERMOSTAT_HUMIDITYnon utiliséphpstan.neon— Ajout du bootstrap elfinder pour l'analyse statiqueSuggested changelog entry
Améliorations de robustesse du code (guards, boucles, retours de méthodes)
Related issues/external references
Découpage de #3122
Types of changes
PR checklist