Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce phpstan and start fixing problems #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

szepeviktor
Copy link

Closes #93

@stevep It still needs fixing few errors.

@szepeviktor
Copy link
Author

szepeviktor commented Jan 3, 2020

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.
 ------ ------------------------------------------------------------------------------------------------------------------

@montchr
Copy link

montchr commented Jul 2, 2024

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