Skip to content

Introduce phpstan and start fixing problems#105

Open
szepeviktor wants to merge 1 commit into
StoutLogic:masterfrom
szepeviktor:phpstan
Open

Introduce phpstan and start fixing problems#105
szepeviktor wants to merge 1 commit into
StoutLogic:masterfrom
szepeviktor:phpstan

Conversation

@szepeviktor

Copy link
Copy Markdown

Closes #93

@stevep It still needs fixing few errors.

@szepeviktor

szepeviktor commented Jan 3, 2020

Copy link
Copy Markdown
Author

This is the current output.
It reveals some wishful thinking: expecting proper input but checking whether it is rubbish.

Analysis gets exciting ✨ and useful on higher Levels.

viktor@mail:~/tmp/acf-builder$ vendor/bin/phpstan analyze
Note: Using configuration file /home/viktor/tmp/acf-builder/phpstan.neon.dist.
 24/24 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ -------------------------------
  Line   FieldManager.php
 ------ -------------------------------
  74     Result of && is always false.
 ------ -------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------------------
  Line   FieldsBuilder.php
 ------ --------------------------------------------------------------------------------------------------------------------------------------
  120    Else branch is unreachable because ternary operator condition is always true.
  146    Method StoutLogic\AcfBuilder\FieldsBuilder::buildLocation() never returns StoutLogic\AcfBuilder\LocationBuilder so it can be removed
         from the return typehint.
  149    Else branch is unreachable because ternary operator condition is always true.
  693    If condition is always true.
  694    Call to an undefined method StoutLogic\AcfBuilder\Builder::setLocation().
  697    Unreachable statement - code above always terminates.
 ------ --------------------------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------
  Line   FlexibleContentBuilder.php
 ------ -------------------------------------------------------------------------------
  51     Else branch is unreachable because ternary operator condition is always true.
 ------ -------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------
  Line   GroupBuilder.php
 ------ --------------------------------------------------------------------------------------------------------------------
  58     Method StoutLogic\AcfBuilder\GroupBuilder::endGroup() should return StoutLogic\AcfBuilder\FieldBuilder but returns
         StoutLogic\AcfBuilder\Builder.
 ------ --------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------
  Line   ParentDelegationBuilder.php
 ------ -------------------------------------------------------
  45     If condition is always true.
  52     Unreachable statement - code above always terminates.
  65     If condition is always true.
  69     Unreachable statement - code above always terminates.
 ------ -------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------
  Line   RepeaterBuilder.php
 ------ ------------------------------------------------------------------------------------------------------------------
  62     Method StoutLogic\AcfBuilder\RepeaterBuilder::end() should return StoutLogic\AcfBuilder\FieldBuilder but returns
         StoutLogic\AcfBuilder\Builder.
 ------ ------------------------------------------------------------------------------------------------------------------

@astratagem

Copy link
Copy Markdown

It would be great to have this merged. As an example, from what I can see based on the output in the screenshot, PHPStan would have prevented #166. Is there a particular reason this pull request has not been acknowledged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the code robust

2 participants