I'd like to help with the development of this library, so I wanted to ask if it would be okay to add PHPStan for static analysis. This would assist the project with development and make it easier to accept new pull requests.
I ran PHPStan at level 5 on the current code, and it found 6 errors. At higher levels, there were significantly more errors, but this was mostly due to missing type declarations. Adding those might impact some users, so that could be a standalone PR in the future (if such a change would be welcomed, of course). For now, I'd be happy to add PHPStan and fix the current issues.
Here are the current issues. In my opinion, fixing most of them shouldn't affect the current behavior. The only potential problem might be the JsonBrowser class, which contains code referencing (likely) an old version of Guzzle. Unless there's a specific reason for this code to exist, I don't think it should be an issue to remove it, as this library uses Guzzle version ^7.7.0 anyway.
Current errors for PHPStan level 5
Line
File
Issue
26
src/Http/JsonBrowser.php
Call to an undefined method GuzzleHttp\Client::createRequest().
28
src/Http/JsonBrowser.php
Call to static method factory() on an unknown class GuzzleHttp\Stream\Stream.
31
src/Http/JsonBrowser.php
Parameter 1 $method of class GuzzleHttp\Psr7\Request constructor expects string, GoPay\Definition\RequestMethods given.
35
src/Http/JsonBrowser.php
Property GoPay\Http\Response::$statusCode (int) does not accept string.
12
src/Http/Log/PrintHttpRequest.php
Part $request->method (GoPay\Definition\RequestMethods) of encapsed string cannot be cast to string.
10
src/Http/Request.php
Property GoPay\Http\Request::$method (GoPay\Definition\RequestMethods) does not accept default value of type string.
Hello,
I'd like to help with the development of this library, so I wanted to ask if it would be okay to add PHPStan for static analysis. This would assist the project with development and make it easier to accept new pull requests.
I ran PHPStan at level 5 on the current code, and it found 6 errors. At higher levels, there were significantly more errors, but this was mostly due to missing type declarations. Adding those might impact some users, so that could be a standalone PR in the future (if such a change would be welcomed, of course). For now, I'd be happy to add PHPStan and fix the current issues.
Here are the current issues. In my opinion, fixing most of them shouldn't affect the current behavior. The only potential problem might be the
JsonBrowser
class, which contains code referencing (likely) an old version of Guzzle. Unless there's a specific reason for this code to exist, I don't think it should be an issue to remove it, as this library uses Guzzle version^7.7.0
anyway.Current errors for PHPStan level 5
src/Http/JsonBrowser.php
GuzzleHttp\Client::createRequest()
.src/Http/JsonBrowser.php
factory()
on an unknown classGuzzleHttp\Stream\Stream
.src/Http/JsonBrowser.php
$method
of classGuzzleHttp\Psr7\Request
constructor expectsstring
,GoPay\Definition\RequestMethods
given.src/Http/JsonBrowser.php
GoPay\Http\Response::$statusCode (int)
does not acceptstring
.src/Http/Log/PrintHttpRequest.php
string
.src/Http/Request.php
GoPay\Http\Request::$method (GoPay\Definition\RequestMethods)
does not accept default value of typestring
.