Skip to content

Commit

Permalink
PHPStan: allow usage of latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
glaubinix committed Nov 27, 2022
1 parent 2a169dc commit 6828a5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"php-http/mock-client": " ^1.2",
"squizlabs/php_codesniffer": "^3.5",
"php-http/guzzle6-adapter": "^2.0",
"phpstan/phpstan": "^0.12.90"
"phpstan/phpstan": "^0.12.90|^1"
},
"replace": {
"gentle/bitbucket-api": "*"
Expand Down
16 changes: 8 additions & 8 deletions test/Bitbucket/Tests/API/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Bitbucket\Tests\API;

use Bitbucket\API\Api;
use Bitbucket\API\Http\HttpPluginClientBuilder;
use Http\Discovery\MessageFactoryDiscovery;
use Http\Mock\Client;
Expand All @@ -11,18 +10,19 @@

abstract class TestCase extends \PHPUnit\Framework\TestCase
{
/** @var Client */
/** @var ?Client */
protected $mockClient;

protected function getApiMock($class = null)
/**
* @template T of \Bitbucket\API\Api
* @param class-string<T> $class
* @return T
*/
protected function getApiMock($class)
{
$class = is_null($class) ? '\Bitbucket\API\Api' : $class;

$bitbucketClient = new \Bitbucket\API\Http\Client(array(), $this->getHttpPluginClientBuilder());
/** @var Api $apiClient */
$apiClient = new $class([], $bitbucketClient);

return $apiClient;
return new $class([], $bitbucketClient);
}

private function getMockHttpClient()
Expand Down

0 comments on commit 6828a5e

Please sign in to comment.