Skip to content

Commit

Permalink
re-run rector
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 28, 2024
1 parent 84fb3b4 commit 74732cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 41 deletions.
36 changes: 6 additions & 30 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,21 @@

declare(strict_types=1);

use Rector\CodeQuality\Rector\Array_\CallableThisArrayToAnonymousFunctionRector;
use Rector\CodingStyle\Rector\ArrowFunction\StaticArrowFunctionRector;
use Rector\CodingStyle\Rector\Closure\StaticClosureRector;
use Rector\Config\RectorConfig;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector;

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

$rectorConfig->parallel();
$rectorConfig->paths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/spec', __FILE__]);
$rectorConfig->importNames();
$rectorConfig->removeUnusedImports();
$rectorConfig->skip([
return RectorConfig::configure()
->withPhpSets()
->withPreparedSets(codeQuality: true, codingStyle: true, deadCode: true, naming: true, privatization: true, typeDeclarations: true, strictBooleans: true)
->withPaths([__DIR__ . '/config', __DIR__ . '/src', __DIR__ . '/spec', __FILE__])
->withImportNames(removeUnusedImports: true)
->withSkip([
__DIR__ . '/src/Controller',
__DIR__ . '/src/Command/Preview',
__DIR__ . '/src/Middleware/Routed/Preview',
CallableThisArrayToAnonymousFunctionRector::class,
StaticArrowFunctionRector::class => [
__DIR__ . '/spec',
],
StaticClosureRector::class => [
__DIR__ . '/spec',
],
FirstClassCallableRector::class,
BooleanInBooleanNotRuleFixerRector::class => [
__DIR__ . '/src/Handler/Logging.php',
],
]);
};
22 changes: 11 additions & 11 deletions spec/Middleware/MezzioSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@
allow($handler)->toReceive('handle')->with($this->request)->andReturn(new Response());
$middleware = new Mezzio($config, $this->logging, $this->renderer);

$actual = $middleware->process($this->request, $handler);
expect($actual)->toBeAnInstanceOf(ResponseInterface::class);
$response = $middleware->process($this->request, $handler);
expect($response)->toBeAnInstanceOf(ResponseInterface::class);

});

Expand Down Expand Up @@ -276,10 +276,10 @@
});
$middleware = new Mezzio($config, $logging, $this->renderer);

$actual = $middleware->process($this->request, $handler);
expect($actual)->toBeAnInstanceOf(Response::class);
$response = $middleware->process($this->request, $handler);
expect($response)->toBeAnInstanceOf(Response::class);

$content = $actual->getBody()->__toString();
$content = $response->getBody()->__toString();
expect($content)->toContain('<title>Error');
expect($content)->toContain('<p>We have encountered a problem and we can not fulfill your request');

Expand Down Expand Up @@ -335,9 +335,9 @@
});
$middleware = new Mezzio($config, $logging, null);

$actual = $middleware->process($request, $handler);
expect($actual)->toBeAnInstanceOf(Response::class);
expect($actual->getBody()->__toString())->toBe(<<<json
$response = $middleware->process($request, $handler);
expect($response)->toBeAnInstanceOf(Response::class);
expect($response->getBody()->__toString())->toBe(<<<json
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Internal Server Error",
Expand Down Expand Up @@ -372,9 +372,9 @@
});
$middleware = new Mezzio($config, $logging, $this->renderer);

$actual = $middleware->process($request, $handler);
expect($actual)->toBeAnInstanceOf(Response::class);
expect($actual->getBody()->__toString())->toBe(<<<json
$response = $middleware->process($request, $handler);
expect($response)->toBeAnInstanceOf(Response::class);
expect($response->getBody()->__toString())->toBe(<<<json
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Internal Server Error",
Expand Down

0 comments on commit 74732cc

Please sign in to comment.