wearerequired / traduttore

🗼 A WordPress plugin to improve the I18N workflow for your own projects based on @GlotPress.
https://wearerequired.github.io/traduttore/
72 stars 15 forks source link

Introduce PHPStan #190

Closed szepeviktor closed 3 years ago

szepeviktor commented 3 years ago

Closes #189

@swissspidy I've cleaned up problems up to Level 2.

Level 5 is desired. Level max is dreamed.

szepeviktor commented 3 years ago
wp_unschedule_event( int $timestamp, string $hook, array $args = array() )
ocean90 commented 3 years ago

With level 5 we still have these errors:

vendor/bin/phpstan analyze --memory-limit=-1
Note: Using configuration file traduttore/phpstan.neon.dist.
PHPStan crashed in the previous run probably because of excessive memory consumption.
It consumed around 61 MB of memory.

To avoid this issue, allow to use more memory with the --memory-limit option.
 32/32 [â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“] 100%

 ------ ----------------------------------------------------------------
  Line   CLI/LanguagePackCommand.php
 ------ ----------------------------------------------------------------
  104    Binary operation "+" between string and 0 results in an error.
 ------ ----------------------------------------------------------------

 ------ --------------------------------------------
  Line   ProjectLocator.php
 ------ --------------------------------------------
  120    Ternary operator condition is always true.
  151    Ternary operator condition is always true.
 ------ --------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------
  Line   Updater.php
 ------ ----------------------------------------------------------------------------------------------------
  71     Parameter #1 $timestamp of function wp_unschedule_event expects int, string given.
  71     Parameter #2 $hook of function wp_unschedule_event expects string, int<1, max>|int<min, -1> given.
 ------ ----------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------
  Line   ZipProvider.php
 ------ ----------------------------------------------------------------------------------------------------
  104    Parameter #1 $timestamp of function wp_unschedule_event expects int, string given.
  104    Parameter #2 $hook of function wp_unschedule_event expects string, int<1, max>|int<min, -1> given.
 ------ ----------------------------------------------------------------------------------------------------

 [ERROR] Found 7 errors
szepeviktor commented 3 years ago

Yes. I leave those up to you.

szepeviktor commented 3 years ago

Should we add "analyze": "vendor/bin/phpstan analyze" to Composer scripts?

codecov[bot] commented 3 years ago

Codecov Report

Merging #190 into master will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #190   +/-   ##
=========================================
  Coverage     81.55%   81.55%           
  Complexity      367      367           
=========================================
  Files            24       24           
  Lines           911      911           
=========================================
  Hits            743      743           
  Misses          168      168           
Impacted Files Coverage Δ Complexity Δ
inc/Export.php 98.64% <ø> (ø) 22.00 <0.00> (ø)
inc/Plugin.php 46.49% <ø> (ø) 40.00 <0.00> (ø)
inc/ProjectLocator.php 100.00% <ø> (ø) 25.00 <0.00> (ø)
inc/Runner.php 100.00% <ø> (ø) 9.00 <0.00> (ø)
inc/TranslationApiRoute.php 100.00% <ø> (ø) 5.00 <0.00> (ø)
inc/Updater.php 93.75% <100.00%> (ø) 26.00 <0.00> (ø)
inc/ZipProvider.php 98.76% <100.00%> (ø) 25.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6669386...abc9e38. Read the comment docs.

szepeviktor commented 3 years ago

Thank you.