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

Try introducing phpstan #2

Open
szepeviktor opened this issue Sep 27, 2019 · 1 comment
Open

Try introducing phpstan #2

szepeviktor opened this issue Sep 27, 2019 · 1 comment

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Sep 27, 2019

phpstan.neon.dist

#$ composer require --dev szepeviktor/phpstan-wordpress phpstan/phpstan-shim phpstan/phpstan-mockery
#$ vendor/bin/phpstan analyze

includes:
    - phar://phpstan.phar/conf/bleedingEdge.neon
    - vendor/phpstan/phpstan-mockery/extension.neon
    - vendor/szepeviktor/phpstan-wordpress/extension.neon
parameters:
    level: 4
#    level: max
    inferPrivatePropertyTypeFromConstructor: true
    paths:
        - %currentWorkingDirectory%/src/
        - %currentWorkingDirectory%/inc/
    ignoreErrors:
@szepeviktor
Copy link
Contributor Author

szepeviktor commented Sep 27, 2019

the current output on Level 4 is as follows

 ------ --------------------------------------------------------------------------------
  Line   src/FunctionExpectations.php
 ------ --------------------------------------------------------------------------------
  45     Call to an undefined method Brain\Monkey\Expectation\Expectation::byDefault().
  60     Call to an undefined method Brain\Monkey\Expectation\Expectation::byDefault().
 ------ --------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------------------------------
  Line   src/MonkeyWpUser.php
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------
  26     Method Brain\Faker\MonkeyWpUser::__monkeyMakeCurrent() should return Brain\Faker\MonkeyWpUser|Mockery\MockInterface|WP_User but return statement
         is missing.
 ------ --------------------------------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------
  Line   src/Provider/Post.php
 ------ ---------------------------------------------------------------------------------------------------------------
  285    PHPDoc tag @param has invalid value ($date): Unexpected token "$date", expected TOKEN_IDENTIFIER at offset 18
 ------ ---------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------
  Line   src/Provider/Site.php
 ------ ----------------------------------------------------
  28     Access to an undefined property WP_Site::$term_id.
  28     Access to an undefined property WP_Site::$term_id.
 ------ ----------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------------
  Line   src/Provider/Taxonomy.php
 ------ ----------------------------------------------------------------------------------------------------------------------------
  330    PHPDoc tag @return contains unresolvable type.
  350    Method Brain\Faker\Provider\Taxonomy::__invoke() with return type void returns WP_Taxonomy but should not return anything.
  367    Method Brain\Faker\Provider\Taxonomy::__invoke() with return type void returns WP_Taxonomy but should not return anything.
 ------ ----------------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------
  Line   src/Provider/Term.php
 ------ -----------------------------------------------------------------------------------------------------------------
  83     Access to an undefined property Mockery\MockInterface::$term_id.
  86     Method Brain\Faker\Provider\Term::__invoke() should return WP_Term but returns Mockery\MockInterface.
  126    PHPDoc tag @param has invalid value ($term): Unexpected token "$term", expected TOKEN_IDENTIFIER at offset 18
  162    PHPDoc tag @param has invalid value ($field): Unexpected token "$field", expected TOKEN_IDENTIFIER at offset 18
  162    PHPDoc tag @param has invalid value ($value): Unexpected token "$value", expected TOKEN_IDENTIFIER at offset 39
 ------ -----------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------
  Line   src/Provider/User.php
 ------ ------------------------------------------------------------------------------------------------------
  242    PHPDoc tag @return with type Brain\Faker\MonkeyWpUser|WP_User is not subtype of native type WP_User.
 ------ ------------------------------------------------------------------------------------------------------

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

No branches or pull requests

1 participant