EnAccess / micropowermanager

Open Source Management Tool for Decentralized Utilities.
https://micropowermanager.io/
MIT License
2 stars 5 forks source link

Fix `PHPStan` on level 1 #248

Open dmohns opened 3 months ago

dmohns commented 3 months ago

Scope:

Currently, running

php ../composer.phar run phpstan-analyse

returns a couple of errors.

Most of them are related to model changes

 ------ ----------------------------------------------------------------------------
  Line   Http/Controllers/Reports.php
 ------ ----------------------------------------------------------------------------
  552    Relation 'meter' is not found in App\Models\Transaction\Transaction model.
  552    Relation 'meter' is not found in App\Models\Transaction\Transaction model.
 ------ ----------------------------------------------------------------------------

or mis-use of Laravel objects

 ------ --------------------------------------------------------------------------------
  Line   Services/AgentBalanceHistoryService.php
 ------ --------------------------------------------------------------------------------
  58     Called 'last' on Laravel collection, but could have been retrieved as a query.
  72     Called 'avg' on Laravel collection, but could have been retrieved as a query.
  79     Called 'avg' on Laravel collection, but could have been retrieved as a query.
 ------ --------------------------------------------------------------------------------

and should be fixed.

Definition of done:

The Github Action step composer run phpstan-analyze is enabled (i.e. continue-on-error: true is removed) and the check passes.