WPBP / WordPress-Plugin-Boilerplate-Powered

Wordpress Plugin Boilerplate but Powered with examples and a generator!
https://wpbp.github.io/
GNU General Public License v3.0
793 stars 114 forks source link

Fix all PHPStan problems #163

Closed szepeviktor closed 4 years ago

szepeviktor commented 4 years ago

TODO: Add file names for each ignored problem.

parameters:
    ignoreErrors:
        -
            path: engine/Is_Methods.php
            message: '#^Function is_amp_endpoint not found\.$#'
            count: 1
szepeviktor commented 4 years ago

Please exclude plugin-name/tests/phpstan/WPH_Widget.php from codacy checks. It is a slightly modified copy.

Mte90 commented 4 years ago

Please exclude plugin-name/tests/phpstan/WPH_Widget.php from codacy checks. It is a slightly modified copy.

I released a new package few days ago to fix an issue, maybe we give to phpstan the path to the original file and avoid that is included.

szepeviktor commented 4 years ago

maybe we give to phpstan the path to the original file

That would be very nice!

https://github.com/WPBP/Widgets-Helper/blob/b822d8be6860b00a1ff9c0d11fc1356a94742f49/wph-widget.php#L16

This conditional is the problem. PHPStan does not read definitions inside a conditional.

I think that package should have 2 files: a loader with the conditional and a clean class file. What do you think?

Mte90 commented 4 years ago

Released a new widget-helper version with that change :-D

szepeviktor commented 4 years ago

Well done :)

szepeviktor commented 4 years ago

Oh nooooooooooooooooo!

tests/phpstan/bootstrap.php

I've missed to commit that file :(

I had contained all missing constants.

Mistake: I did https://github.com/WPBP/WordPress-Plugin-Boilerplate-Powered/pull/163/files#diff-c52d63b356277393ceb8dbeddbf6c956

Mte90 commented 4 years ago

it doesn't contain all the constants of https://github.com/WPBP/WordPress-Plugin-Boilerplate-Powered/blob/master/plugin-name/plugin-name.php and this can explain some errors in actions but I am updating it