the-kbA-team / json-rpc

Simple JSON-RPC PHP client/server that just works.
https://packagist.org/packages/kba-team/json-rpc
MIT License
0 stars 0 forks source link

Refactor code to meet modern coding requirements #8

Open gregor-j opened 5 months ago

gregor-j commented 5 months ago

Even at level 2 PHPStan returns 8 errors:

 ------ ----------------------------------------------------------------------------------- 
  Line   src/JsonRPC/Request/RequestBuilder.php                                             
 ------ ----------------------------------------------------------------------------------- 
  48     Unsafe usage of new static().                                                      
         💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ----------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   src/JsonRPC/Request/RequestParser.php                                              
 ------ ----------------------------------------------------------------------------------- 
  59     Unsafe usage of new static().                                                      
         💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ----------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   src/JsonRPC/Response/ResponseBuilder.php                                           
 ------ ----------------------------------------------------------------------------------- 
  89     Unsafe usage of new static().                                                      
         💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ----------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------------------------- 
  Line   src/JsonRPC/Response/ResponseParser.php                                            
 ------ ----------------------------------------------------------------------------------- 
  42     Unsafe usage of new static().                                                      
         💡 See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
 ------ ----------------------------------------------------------------------------------- 

 ------ ----------------------------------------------------------------- 
  Line   src/JsonRPC/Validator/HostValidator.php                          
 ------ ----------------------------------------------------------------- 
  71     Binary operation "-" between 32 and string results in an error.  
 ------ ----------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------------------- 
  Line   tests/Validator/HostValidatorTest.php                                                             
 ------ -------------------------------------------------------------------------------------------------- 
  12     Static method JsonRPC\Validator\HostValidator::validate() invoked with 3 parameters, 2 required.  
  17     Static method JsonRPC\Validator\HostValidator::validate() invoked with 3 parameters, 2 required.  
  31     Static method JsonRPC\Validator\HostValidator::validate() invoked with 3 parameters, 2 required.  
 ------ -------------------------------------------------------------------------------------------------- 

Serious code changes will be required to fix these issues.