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

Send PRs to third-party extensions to pass PHPStan Level 2 #248

Open
Alkarex opened this issue Aug 18, 2024 · 2 comments
Open

Send PRs to third-party extensions to pass PHPStan Level 2 #248

Alkarex opened this issue Aug 18, 2024 · 2 comments

Comments

@Alkarex
Copy link
Member

Alkarex commented Aug 18, 2024

Send pull-requests to the third-party extensions to increase the quality of their code.
Start with PHPStan Level 1 by running the command below.
Check in this repository for code references.

For instance, fixing the many Variable $this might not be defined is as easy as adding a line such as:

/** @var YouTubeExtension $this */

$ make test-all
$ vendor/bin/phpstan analyse --memory-limit 512M -c phpstan-third-party.neon --level 1 .
> phpstan analyse --memory-limit 512M -c phpstan-third-party.neon .
 232/232 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ------------------------------------------------------------------------------------------------ 
  Line   third-party/003df625d41b62458ad6771961c1bddc4fe76d3b/xExtension-Copy2Clipboard/configure.phtml  
 ------ ------------------------------------------------------------------------------------------------ 
  :7     Variable $this might not be defined.                                                            
 ------ ------------------------------------------------------------------------------------------------ 

 ------ -------------------------------------------------------------------------------------------------- 
  Line   third-party/003df625d41b62458ad6771961c1bddc4fe76d3b/xExtension-FeedTitleBuilder/configure.phtml  
 ------ -------------------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                              
 ------ -------------------------------------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------- 
  Line   third-party/003df625d41b62458ad6771961c1bddc4fe76d3b/xExtension-SendToMyJD2/configure.phtml  
 ------ --------------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                         
  :23    Variable $this might not be defined.                                                         
  :30    Variable $this might not be defined.                                                         
  :40    Variable $this might not be defined.                                                         
 ------ --------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------- 
  Line   third-party/003df625d41b62458ad6771961c1bddc4fe76d3b/xExtension-SendToMyJD2/extension.php  
 ------ ------------------------------------------------------------------------------------------- 
  :225   Variable $packageName might not be defined.                                                
  :232   Variable $packageName might not be defined.                                                
  :305   Undefined variable: $lMD                                                                   
 ------ ------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/14eb97a88504b6e00a590711402b20ef46815c42/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                  
  :8     Variable $this might not be defined.                                  
  :13    Variable $this might not be defined.                                  
  :20    Variable $this might not be defined.                                  
  :31    Variable $this might not be defined.                                  
  :32    Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------- 
  Line   third-party/14eb97a88504b6e00a590711402b20ef46815c42/extension.php  
 ------ -------------------------------------------------------------------- 
  :40    Variable $c might not be defined.                                   
  :41    Variable $c might not be defined.                                   
  :42    Variable $c might not be defined.                                   
  :44    Variable $c might not be defined.                                   
 ------ -------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/152b1930c8c19e88fef548e6dc1a20583586b0c8/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :11    Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------- 
  Line   third-party/1d9f034fd83c80f81e21f1c8a7a4c537253e6f5e/xExtension-Invidious/configure.phtml  
 ------ ------------------------------------------------------------------------------------------- 
  :2     Variable $this might not be defined.                                                       
 ------ ------------------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------- 
  Line   third-party/1d9f034fd83c80f81e21f1c8a7a4c537253e6f5e/xExtension-Invidious/extension.php  
 ------ ----------------------------------------------------------------------------------------- 
  :149   Variable $in_url might not be defined.                                                   
 ------ ----------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/3ae1ea7146931763f8c7d868dfc1fb2981ac7632/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :8     Variable $this might not be defined.                                  
  :24    Variable $this might not be defined.                                  
  :44    Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------------------- 
  Line   third-party/3d4a70187a5eec2d8f4112a34c3f4032149b1425/xExtension-GReaderRedate/configure.phtml  
 ------ ----------------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                           
  :11    Variable $this might not be defined.                                                           
  :18    Variable $this might not be defined.                                                           
  :25    Variable $this might not be defined.                                                           
 ------ ----------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/4d5ee73e654c7c8bdd114b8e88f44933663d615b/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                  
  :7     Variable $this might not be defined.                                  
  :14    Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------ 
  Line   third-party/66ede7ed8e27636df40d74bcd4f2ac5d49ec656d/Transformer/AbstractTransformer.php  
 ------ ------------------------------------------------------------------------------------------ 
  :42    Constant REDDITIMAGE_VERSION not found.                                                   
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                       
 ------ ------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/66ede7ed8e27636df40d74bcd4f2ac5d49ec656d/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                  
  :7     Variable $this might not be defined.                                  
  :15    Variable $this might not be defined.                                  
  :24    Variable $this might not be defined.                                  
  :33    Variable $this might not be defined.                                  
  :42    Variable $this might not be defined.                                  
  :51    Variable $this might not be defined.                                  
  :60    Variable $this might not be defined.                                  
  :77    Variable $this might not be defined.                                  
  :84    Variable $this might not be defined.                                  
  :100   Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------- 
  Line   third-party/69174bbeacee02599d0a8e182ec14c9ae753dd2f/xExtension-Invidious/configure.phtml  
 ------ ------------------------------------------------------------------------------------------- 
  :2     Variable $this might not be defined.                                                       
 ------ ------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------- 
  Line   third-party/71d0d525734575879efdb68094330d118b534e8a/TranslateTitlesCN/configure.phtml  
 ------ ---------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                    
 ------ ---------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------- 
  Line   third-party/78112e3bcde44189950ed1d7a4693cba022beefd/xExtension-ThemeModeSynchronizer/configure.phtml  
 ------ ------------------------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                                   
 ------ ------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/7b859e6b23280a8f3128d62ff31bc42414afaca4/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                  
  :7     Variable $this might not be defined.                                  
  :16    Variable $this might not be defined.                                  
  :25    Variable $this might not be defined.                                  
  :34    Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   third-party/8c042738017d75b31bcbc23d84cfb35d6315f3a7/comics/penny-arcade.php                                                                                                                                                        
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 
  :59    Inner named functions are not supported by PHPStan. Consider refactoring to an anonymous function, class method, or a top-level-defined function. See issue #165 (https://github.com/phpstan/phpstan/issues/165) for more details.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/8edf4d5771b7efd3b0b64435e168d2a9162e7f01/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :8     Variable $this might not be defined.                                  
  :24    Variable $this might not be defined.                                  
  :49    Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ --------------------------------------------------------------------------------------------- 
  Line   third-party/950b2724fe601a9b1999721b0cc59a8bba7adf58/xExtension-AutoRefresh/configure.phtml  
 ------ --------------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                         
  :7     Variable $this might not be defined.                                                         
 ------ --------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------- 
  Line   third-party/9dd44a02ed7efc8f8800aa67558f312d51a7a6c0/xExtension-RssBridge/configure.phtml  
 ------ ------------------------------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                                       
 ------ ------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/be7d567176ab7db0e9c8ffcbad179ef4b5285428/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------- 
  Line   third-party/d980811a8acbdd75259f9bb48e2fd1f6b269a9c4/configure.phtml  
 ------ ---------------------------------------------------------------------- 
  :1     Variable $this might not be defined.                                  
  :77    Variable $this might not be defined.                                  
  :78    Variable $this might not be defined.                                  
  :85    Variable $this might not be defined.                                  
  :91    Variable $this might not be defined.                                  
  :94    Variable $this might not be defined.                                  
  :113   Variable $this might not be defined.                                  
  :120   Variable $this might not be defined.                                  
  :123   Variable $this might not be defined.                                  
  :126   Variable $this might not be defined.                                  
 ------ ---------------------------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 70 errors
@Alkarex Alkarex changed the title Easy: Send PRs to third-party extensions to pass PHPStan Level 2 Send PRs to third-party extensions to pass PHPStan Level 2 Aug 18, 2024
@yanbrasiliano
Copy link

Hey @Alkarex, what do you need/suggest is that we make a PR with changes to increase the level of phpstan-third-party.neon and decrease/eliminate the errors after this change is pointed out after increasing the level? If so, I can take this issue to help you.

@Alkarex
Copy link
Member Author

Alkarex commented Aug 19, 2024

@yanbrasiliano Help much appreciated 👍🏻
Yes, that sounds correct. The PRs need to be made to the various third-party repositories. For instance, the first one is to be sent to https://github.com/cn-tools/cntools_FreshRssExtensions/tree/master/xExtension-Copy2Clipboard
The list of third-party repositories can be found in https://github.com/FreshRSS/Extensions/blob/master/repositories.json

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

No branches or pull requests

2 participants