Skip to content

Commit

Permalink
Changes after PHP CS Fixer update
Browse files Browse the repository at this point in the history
  • Loading branch information
otsch committed Aug 7, 2024
1 parent d81f5f2 commit 3cd99e8
Show file tree
Hide file tree
Showing 19 changed files with 65 additions and 65 deletions.
4 changes: 2 additions & 2 deletions src/HttpCrawler/AnonymousHttpCrawlerBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function __construct() {}

public function withBotUserAgent(string $productToken): HttpCrawler
{
$instance = new class () extends HttpCrawler {
$instance = new class extends HttpCrawler {
protected function userAgent(): UserAgentInterface
{
return new UserAgent('temp');
Expand All @@ -27,7 +27,7 @@ protected function userAgent(): UserAgentInterface

public function withUserAgent(string|UserAgentInterface $userAgent): HttpCrawler
{
$instance = new class () extends HttpCrawler {
$instance = new class extends HttpCrawler {
protected function userAgent(): UserAgentInterface
{
return new UserAgent('temp');
Expand Down
32 changes: 16 additions & 16 deletions tests/CrawlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ function () {
it('immediately stops when keepAs() is not used with a scalar value output step', function () {
$crawler = helper_getDummyCrawler();

$step1 = new class () extends Step {
$step1 = new class extends Step {
public bool $wasCalled = false;

protected function invoke(mixed $input): Generator
Expand All @@ -296,7 +296,7 @@ public function outputType(): StepOutputType
}
};

$step2 = new class () extends Step {
$step2 = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield 'foo';
Expand Down Expand Up @@ -333,7 +333,7 @@ public function outputType(): StepOutputType

$crawler->setStore($store);

$step = new class () extends Step {
$step = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield 'one';
Expand Down Expand Up @@ -398,7 +398,7 @@ function () {
it(
'cascades step outputs immediately and doesn\'t wait for the current step being called with all the inputs',
function () {
$step1 = new class () extends Step {
$step1 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step1 called');
Expand All @@ -409,7 +409,7 @@ protected function invoke(mixed $input): Generator
}
};

$step2 = new class () extends Step {
$step2 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step2 called');
Expand All @@ -418,7 +418,7 @@ protected function invoke(mixed $input): Generator
}
};

$store = new class () extends Store {
$store = new class extends Store {
public function store(Result $result): void
{
$this->logger?->info('Stored a result');
Expand Down Expand Up @@ -453,7 +453,7 @@ public function store(Result $result): void
it(
'immediately calls the store for each final output',
function () {
$step1 = new class () extends Step {
$step1 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step1 called');
Expand All @@ -464,7 +464,7 @@ protected function invoke(mixed $input): Generator
}
};

$step2 = new class () extends Step {
$step2 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step2 called: ' . $input);
Expand All @@ -475,7 +475,7 @@ protected function invoke(mixed $input): Generator
}
};

$step3 = new class () extends Step {
$step3 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step3 called: ' . $input);
Expand All @@ -486,7 +486,7 @@ protected function invoke(mixed $input): Generator
}
};

$step4 = new class () extends Step {
$step4 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step4 called: ' . $input);
Expand All @@ -497,7 +497,7 @@ protected function invoke(mixed $input): Generator
}
};

$store = new class () extends Store {
$store = new class extends Store {
public function store(Result $result): void
{
$this->logger?->info('Stored a result: ' . $result->get('unnamed'));
Expand Down Expand Up @@ -557,7 +557,7 @@ public function store(Result $result): void
'does not wait for all child outputs originating from an output of a step where keepAs() was called before ' .
'calling the store',
function () {
$step1 = new class () extends Step {
$step1 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step1 called');
Expand All @@ -568,7 +568,7 @@ protected function invoke(mixed $input): Generator
}
};

$step2 = new class () extends Step {
$step2 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step2 called: ' . $input);
Expand All @@ -581,7 +581,7 @@ protected function invoke(mixed $input): Generator

$step2->keepAs('foo');

$step3 = new class () extends Step {
$step3 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step3 called: ' . $input);
Expand All @@ -592,7 +592,7 @@ protected function invoke(mixed $input): Generator
}
};

$step4 = new class () extends Step {
$step4 = new class extends Step {
protected function invoke(mixed $input): Generator
{
$this->logger?->info('step4 called: ' . $input);
Expand All @@ -605,7 +605,7 @@ protected function invoke(mixed $input): Generator

$step4->keepAs('bar');

$store = new class () extends Store {
$store = new class extends Store {
public function store(Result $result): void
{
$this->logger?->info('Stored a result: ' . $result->get('bar'));
Expand Down
4 changes: 2 additions & 2 deletions tests/Loader/Http/HttpLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public function isAllowedToBeLoaded(UriInterface $uri, bool $throwsException = f

$httpClient->shouldReceive('sendRequest')->once()->andReturn(new Response(200));

$throttler = new class () extends Throttler {
$throttler = new class extends Throttler {
public function trackRequestStartFor(UriInterface $url): void
{
echo 'Track request start ' . $url . PHP_EOL;
Expand Down Expand Up @@ -330,7 +330,7 @@ function (string $loadingMethod) {
})
->andReturn(new Response(200));

$throttler = new class () extends Throttler {
$throttler = new class extends Throttler {
public function trackRequestEndFor(UriInterface $url): void
{
echo 'Track request end ' . $url . PHP_EOL;
Expand Down
14 changes: 7 additions & 7 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function outputType(): StepOutputType

function helper_getInputReturningStep(): Step
{
return new class () extends Step {
return new class extends Step {
protected function invoke(mixed $input): Generator
{
yield $input;
Expand All @@ -95,7 +95,7 @@ protected function invoke(mixed $input): Generator

function helper_getNumberIncrementingStep(): Step
{
return new class () extends Step {
return new class extends Step {
protected function invoke(mixed $input): Generator
{
yield $input + 1;
Expand All @@ -105,7 +105,7 @@ protected function invoke(mixed $input): Generator

function helper_getStepYieldingMultipleNumbers(): Step
{
return new class () extends Step {
return new class extends Step {
protected function invoke(mixed $input): Generator
{
foreach (['one', 'two', 'two', 'three', 'four', 'three', 'five', 'three'] as $number) {
Expand All @@ -117,7 +117,7 @@ protected function invoke(mixed $input): Generator

function helper_getStepYieldingMultipleArraysWithNumber(): Step
{
return new class () extends Step {
return new class extends Step {
protected function invoke(mixed $input): Generator
{
foreach (['one', 'two', 'two', 'three', 'four', 'three', 'five', 'three'] as $key => $number) {
Expand All @@ -143,7 +143,7 @@ protected function invoke(mixed $input): Generator

function helper_getStepYieldingMultipleObjectsWithNumber(): Step
{
return new class () extends Step {
return new class extends Step {
protected function invoke(mixed $input): Generator
{
foreach (['one', 'two', 'two', 'three', 'four', 'three', 'five', 'three'] as $key => $number) {
Expand All @@ -157,7 +157,7 @@ protected function invoke(mixed $input): Generator

function helper_getLoadingStep(): Step
{
return new class () extends Step {
return new class extends Step {
use LoadingStep;

protected function invoke(mixed $input): Generator
Expand Down Expand Up @@ -275,7 +275,7 @@ function helper_getFastLoader(

function helper_getFastCrawler(): HttpCrawler
{
return new class () extends HttpCrawler {
return new class extends HttpCrawler {
protected function userAgent(): UserAgentInterface
{
return new UserAgent('TestBot');
Expand Down
10 changes: 5 additions & 5 deletions tests/Steps/BaseStepTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function () {
})->throws(InvalidArgumentException::class);

it('removes an UTF-8 byte order mark from the beginning of a string', function () {
$step = new class () extends Step {
$step = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield $input;
Expand Down Expand Up @@ -200,7 +200,7 @@ protected function validateAndSanitizeInput(mixed $input): mixed
it(
'throws an exception in validateBeforeRun() when output type is scalar and keep() was used but not keepAs()',
function () {
$step = new class () extends Step {
$step = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield $input;
Expand Down Expand Up @@ -292,7 +292,7 @@ protected function invoke(mixed $input): Generator
})->throwsNoExceptions();

it('logs a warning, when keepFromInput() was called and previous step yields mixed outputs', function () {
$stepWithMixedOutputType = new class () extends Step {
$stepWithMixedOutputType = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield 'yo';
Expand Down Expand Up @@ -327,7 +327,7 @@ public function outputType(): StepOutputType
it('adds all from object output to the keep array in the output object, when keep() is called', function () {
$step = helper_getInputReturningStep()->keep();

$outputObject = new class () {
$outputObject = new class {
/**
* @return array<string, string>
*/
Expand Down Expand Up @@ -422,7 +422,7 @@ public function toArray(): array
it('adds all from object input to the keep array in the output object, when keepFromInput() is called', function () {
$step = helper_getValueReturningStep('foo')->keepFromInput();

$inputObject = new class () {
$inputObject = new class {
/**
* @return array<string, string>
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Steps/CsvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function helper_csvFilePath(string $fileName): string
});

it('works with an object having a __toString method', function () {
$object = new class () {
$object = new class {
public function __toString(): string
{
return <<<CSV
Expand Down
6 changes: 3 additions & 3 deletions tests/Steps/GroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function helper_addUpdateInputUsingOutputCallbackToSteps(Closure $callback, Step

function helper_getStepThatRemembersIfItWasCalled(): Step
{
return new class () extends Step {
return new class extends Step {
public bool $called = false;

protected function invoke(mixed $input): Generator
Expand Down Expand Up @@ -533,7 +533,7 @@ function () {
'when steps yield multiple outputs it combines the first output from first step with first output from second ' .
'step and so on.',
function () {
$step1 = new class () extends Step {
$step1 = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield ['one' => 'foo'];
Expand All @@ -542,7 +542,7 @@ protected function invoke(mixed $input): Generator
}
};

$step2 = new class () extends Step {
$step2 = new class extends Step {
protected function invoke(mixed $input): Generator
{
yield ['three' => 'baz'];
Expand Down
4 changes: 2 additions & 2 deletions tests/Steps/Loading/LoadingStepTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use function tests\helper_traverseIterable;

test('you can add a loader', function () {
$step = new class () extends Step {
$step = new class extends Step {
use LoadingStep;

protected function invoke(mixed $input): Generator
Expand Down Expand Up @@ -46,7 +46,7 @@ function () {

$loaderTwo->shouldReceive('load')->once()->andReturn('Hi');

$step = new class () extends Step {
$step = new class extends Step {
use LoadingStep;

protected function invoke(mixed $input): Generator
Expand Down
Loading

0 comments on commit 3cd99e8

Please sign in to comment.