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

Address phpstan ImageProxy complaints #209

Closed
wants to merge 3 commits into from
Closed

Conversation

Frenzie
Copy link
Member

@Frenzie Frenzie commented Feb 29, 2024

@Frenzie Frenzie requested a review from Alkarex February 29, 2024 20:37
@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

Please run:

vendor/bin/phpstan analyse --level 9 .

or remove the lines from https://github.com/FreshRSS/Extensions/blob/master/tests/phpstan-next.txt and then run the full tests:

make test-all

@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

$ vendor/bin/phpstan analyse --level 9 .
Note: Using configuration file /home/alex/GitHub/Extensions/phpstan.neon.
 41/41 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ------------------------------------------------------------------------------------------ 
  Line   xExtension-ImageProxy/configure.phtml                                                     
 ------ ------------------------------------------------------------------------------------------ 
  :10    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url.             
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :16    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_http.     
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :22    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_https.    
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :29    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_default.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :29    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_default.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :40    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :46    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url_encode.      
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
 ------ ------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------ 
  Line   xExtension-ImageProxy/extension.php                                                       
 ------ ------------------------------------------------------------------------------------------ 
  :24    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url.             
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :28    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_http.     
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :32    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_https.    
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :35    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_force.           
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :41    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_default.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :45    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :49    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url_encode.      
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :62    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url.             
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :63    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_http.     
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :64    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_https.    
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :65    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_default.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :66    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :67    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url_encode.      
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :76    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_http.     
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :79    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :83    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_https.    
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :86    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :90    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_default.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :91    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :95    Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_scheme_include.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :104   Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url_encode.      
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
  :107   Access to an undefined property FreshRSS_UserConfiguration::$image_proxy_url.             
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property      
 ------ ------------------------------------------------------------------------------------------ 

                                                                                                                        
 [ERROR] Found 29 errors

@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

Explanations in #202

@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

I had forgotten about #201
Merged, sorry for the mess :-)

@Frenzie
Copy link
Member Author

Frenzie commented Feb 29, 2024

As stated, when I run vendor/bin/phpstan analyse --level 9 . it shows this. On all files.

------ ----------------------------------------------------------------------------------------- 
  Line   xExtension-ImageProxy/extension.php                                                      
 ------ ----------------------------------------------------------------------------------------- 
  5      Class ImageProxyExtension extends unknown class Minz_Extension.                          
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  15     Access to static property $system_conf on an unknown class FreshRSS_Context.             
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  16     Instantiated class FreshRSS_Context_Exception not found.                                 
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  16     Throwing object of an unknown class FreshRSS_Context_Exception.                          
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  18     Call to an undefined method ImageProxyExtension::registerHook().                         
  24     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  25     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  28     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  29     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  32     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  33     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  35     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  36     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  36     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  37     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  41     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  42     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  45     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  46     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  49     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  50     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  54     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  59     Call to an undefined method ImageProxyExtension::registerTranslates().                   
  61     Call to static method isPost() on an unknown class Minz_Request.                         
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  62     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  62     Call to static method paramString() on an unknown class Minz_Request.                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  63     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  63     Call to static method paramString() on an unknown class Minz_Request.                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  64     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  64     Call to static method paramString() on an unknown class Minz_Request.                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  65     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  65     Call to static method paramString() on an unknown class Minz_Request.                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  66     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  66     Call to static method paramString() on an unknown class Minz_Request.                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  67     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  67     Call to static method paramString() on an unknown class Minz_Request.                    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  68     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  76     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  79     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  83     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  86     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  90     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  91     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  94     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  95     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  96     Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  104    Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  107    Access to static property $user_conf on an unknown class FreshRSS_Context.               
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  142    Method ImageProxyExtension::setImageProxyHook() has invalid return type FreshRSS_Entry.  
  142    Parameter $entry of method ImageProxyExtension::setImageProxyHook() has invalid type     
         FreshRSS_Entry.                                                                          
  143    Call to method _content() on an unknown class FreshRSS_Entry.                            
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
  144    Call to method content() on an unknown class FreshRSS_Entry.                             
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols                      
 ------ ----------------------------------------------------------------------------------------- 

@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

when I run vendor/bin/phpstan analyse --level 9 . it shows this. On all files.

To run the tests, PHPStan needs to have access to the FreshRSS repo as well, which is by convention at the same level than the Extensions folder:

- ../FreshRSS

@Frenzie
Copy link
Member Author

Frenzie commented Feb 29, 2024

I had forgotten about #201 Merged, sorry for the mess :-)

I did notice the wrong type was introduced in #185 but I figured that was just a typo.

I am still curious how to make phpstan not complain about all the classes it doesn't know though?

@Frenzie
Copy link
Member Author

Frenzie commented Feb 29, 2024

when I run vendor/bin/phpstan analyse --level 9 . it shows this. On all files.

To run the tests, PHPStan needs to have access to the FreshRSS repo as well, which is by convention at the same level than the Extensions folder:

Thanks, it would be useful if it complained that folder didn't exist or something. :-)

@Frenzie Frenzie closed this Feb 29, 2024
@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

it would be useful if it complained that folder didn't exist or something. :-)

Indeed, that would be a nice improvement, and can probably be done with a shell test

@Frenzie
Copy link
Member Author

Frenzie commented Feb 29, 2024

Actually, that changes nothing. It still says it can't find anything.

@Alkarex
Copy link
Member

Alkarex commented Feb 29, 2024

Do you have a structure with the two repos along side each other?

  • ./FreshRSS/
  • ./Extensions/

If so, maybe rm -fr /tmp/phpstan/

@Frenzie
Copy link
Member Author

Frenzie commented Feb 29, 2024

~/src/feeds$ ls
Extensions  FreshRSS
~/src/feeds$ cd Extensions/
~/src/feeds/Extensions$ vendor/bin/phpstan analyse --level 9 .
Note: Using configuration file /home/frans/src/feeds/Extensions/phpstan.neon.
 36/36 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ --------------------------------------------------------------------- 
  Line   xExtension-ColorfulList/extension.php                                
 ------ --------------------------------------------------------------------- 
  5      Class ColorfulListExtension extends unknown class Minz_Extension.    
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols  
  8      Call to an undefined method ColorfulListExtension::getFileUrl().     
  8      Call to static method appendScript() on an unknown class Minz_View.  
         💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
[snip]

@Frenzie
Copy link
Member Author

Frenzie commented Feb 29, 2024

If so, maybe rm -fr /tmp/phpstan/

Yes, that did the trick. Thanks!

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.

2 participants