Skip to content

Commit

Permalink
Merge pull request #19 from samsonasik/use-latest-rector-config
Browse files Browse the repository at this point in the history
Use latest RectorConfig::configure() syntax
  • Loading branch information
samsonasik authored Mar 11, 2024
2 parents ecefbd0 + d875426 commit 9dcc272
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 28 deletions.
33 changes: 15 additions & 18 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,28 @@
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([
SetList::DEAD_CODE,
SetList::CODING_STYLE,
SetList::CODE_QUALITY,
SetList::EARLY_RETURN,
SetList::NAMING,
LevelSetList::UP_TO_PHP_80,
SetList::TYPE_DECLARATION,
]);

$rectorConfig->paths([
return RectorConfig::configure()
->withPreparedSets(
deadCode: true,
codingStyle: true,
codeQuality: true,
earlyReturn: true,
naming: true,
typeDeclarations: true
)
->withPhpSets(php80: true)
->withPaths([
__DIR__ . '/config',
__DIR__ . '/src',
__DIR__ . '/spec',
__DIR__ . '/rector.php',
]);
$rectorConfig->importNames();

$rectorConfig->skip([
])
->withRootFiles()
->withImportNames()
->withSkip([
StaticArrowFunctionRector::class => [
__DIR__ . '/spec',
],
StaticClosureRector::class => [
__DIR__ . '/spec',
],
]);
};
8 changes: 4 additions & 4 deletions spec/Service/ClientAuthServiceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Laminas\Http\Response;
use Laminas\Json\Json;

describe('ClientAuthService', function () {
describe('ClientAuthService', function (): void {
beforeAll(function (): void {
$this->httpClient = Double::instance(['extends' => Client::class]);
$this->service = new ClientAuthService(
Expand Down Expand Up @@ -62,7 +62,7 @@

});

describe('->callAPI', function () {
describe('->callAPI', function (): void {

it('define grant_type = client_credentials will not set username form-data', function (): void {

Expand Down Expand Up @@ -246,7 +246,7 @@

});

it('set not success on Http Client send got RuntimeException', function () {
it('set not success on Http Client send got RuntimeException', function (): void {

$data = [
'api-route-segment' => '/oauth',
Expand All @@ -263,7 +263,7 @@
'Content-type' => 'application/json'
];

allow($this->httpClient)->toReceive('send')->andRun(function () {
allow($this->httpClient)->toReceive('send')->andRun(function (): void {
throw new RuntimeException();
});

Expand Down
12 changes: 6 additions & 6 deletions spec/Service/ClientServiceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Laminas\Http\Response;
use Laminas\Json\Json;

describe('ClientService', function () {
describe('ClientService', function (): void {
beforeAll(function (): void {
$this->httpClient = Double::instance(['extends' => Client::class]);
$this->service = new ClientService(
Expand Down Expand Up @@ -96,7 +96,7 @@

});

describe('->callAPI', function () {
describe('->callAPI', function (): void {
it('return "ClientResult" instance with success = true when status code = 200 and body != ""', function (): void {

$data = [
Expand Down Expand Up @@ -355,7 +355,7 @@

});

it('return "ClientResult" instance with success = false when client->send() throw exception', function () {
it('return "ClientResult" instance with success = false when client->send() throw exception', function (): void {

$data = [
'api-route-segment' => '/api',
Expand All @@ -375,7 +375,7 @@
expect($this->httpClient)->toReceive('setHeaders')->with($headers);
expect($this->httpClient)->toReceive('setUri')->with('http://api.host.url/api');
expect($this->httpClient)->toReceive('setMethod')->with($data['form-request-method']);
allow($this->httpClient)->toReceive('send')->andRun(function () {
allow($this->httpClient)->toReceive('send')->andRun(function (): void {
throw new RuntimeException();
});

Expand Down Expand Up @@ -649,7 +649,7 @@

});

it('set not success on Http Client send got RuntimeException', function () {
it('set not success on Http Client send got RuntimeException', function (): void {

$data = [
'api-route-segment' => '/api',
Expand All @@ -662,7 +662,7 @@
'Content-type' => 'application/json'
];

allow($this->httpClient)->toReceive('send')->andRun(function () {
allow($this->httpClient)->toReceive('send')->andRun(function (): void {
throw new RuntimeException();
});

Expand Down

0 comments on commit 9dcc272

Please sign in to comment.