Skip to content

Commit

Permalink
🎨 Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel committed Jan 24, 2025
1 parent 5b19e07 commit 7d5d3ad
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/Console/CreateWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function handle(): int
$fullQualifiedName = $namespace . $closestModel;
}

/** @var Model $class */
/** @var class-string<Model> $class */
$class = $fullQualifiedName;

$methods = ['create', 'update', 'delete'];
Expand Down
2 changes: 1 addition & 1 deletion src/Console/ReactivateWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(): int
return self::FAILURE;
}

/** @var Model $class */
/** @var class-string<Model> $class */
$class = $fullQualifiedName;

try {
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/HasWhere.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function where(
*/
public function orWhere(
mixed $key,
string $operator = null,
?string $operator = null,
mixed $value = null,
string $boolean = '|',
): self {
Expand Down
32 changes: 15 additions & 17 deletions tests/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testItShouldGenerateFuzzySearchQuery(): void
{
$this->igdb->fuzzySearch(['name', 'company'], 'phpunit test')->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);',
Expand All @@ -110,7 +110,7 @@ public function testItShouldGenerateOrFuzzySearchQuery(): void
{
$this->igdb->where('name', 'Fortnite')->orFuzzySearch(['name', 'company'], 'phpunit test')->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where name = "Fortnite" | (name ~ *"phpunit"* | name ~ *"test"* | company ~ *"phpunit"* | company ~ *"test"*);',
Expand Down Expand Up @@ -147,7 +147,7 @@ public function testItShouldGenerateNestedWhereQuery(): void
->where('first_release_date', '<=', $nextYear);
})->orWhere('name', 'Fortnite')->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
"where (first_release_date >= $now & first_release_date <= $nextYear) | name = \"Fortnite\";",
Expand Down Expand Up @@ -208,7 +208,6 @@ public static function datesDataProvider(): array
}

/**
*
* @throws ReflectionException
* @throws InvalidParamsException
* @throws JsonException
Expand All @@ -226,7 +225,6 @@ public function testItShouldCastDateStrings(string $key): void
}

/**
*
* @throws MissingEndpointException
* @throws ReflectionException
* @throws InvalidParamsException
Expand Down Expand Up @@ -366,31 +364,31 @@ public function testItShouldGenerateWhereBetweenQuery(): void
{
$this->igdb->whereBetween('first_release_date', 1546297200, 1577833199)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where (first_release_date >= 1546297200 & first_release_date <= 1577833199);',
));

$this->igdb->where('name', 'Fortnite')->orWhereBetween('first_release_date', 1546297200, 1577833199)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where name = "Fortnite" | (first_release_date >= 1546297200 & first_release_date <= 1577833199);',
));

$this->igdb->whereNotBetween('first_release_date', 1546297200, 1577833199)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where (first_release_date < 1546297200 | first_release_date > 1577833199);',
));

$this->igdb->where('name', 'Fortnite')->orWhereNotBetween('first_release_date', 1546297200, 1577833199)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where name = "Fortnite" | (first_release_date < 1546297200 | first_release_date > 1577833199);',
Expand All @@ -404,7 +402,7 @@ public function testItShouldGenerateWhereBetweenQueryWithoutBoundaries(): void
{
$this->igdb->whereBetween('first_release_date', 1546297200, 1577833199, false)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where (first_release_date > 1546297200 & first_release_date < 1577833199);',
Expand Down Expand Up @@ -534,15 +532,15 @@ public function testItShouldGenerateWhereDateEqualsQuery(): void

$this->igdb->whereDate('first_release_date', $date->format('Y-m-d'))->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
"where (first_release_date >= $start & first_release_date <= $end);",
));

$this->igdb->where('name', 'Fortnite')->orWhereDate('first_release_date', $date->format('Y-m-d'))->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
"where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);",
Expand Down Expand Up @@ -646,15 +644,15 @@ public function testItShouldGenerateWhereYearEqualsQuery(): void

$this->igdb->whereYear('first_release_date', $date->year)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
"where (first_release_date >= $start & first_release_date <= $end);",
));

$this->igdb->where('name', 'Fortnite')->orWhereYear('first_release_date', $date->year)->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
"where name = \"Fortnite\" | (first_release_date >= $start & first_release_date <= $end);",
Expand Down Expand Up @@ -752,7 +750,7 @@ public function testItShouldGenerateNestedOrWhereQuery(): void
->where('aggregated_rating_count', '>=', 3000);
})->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where name = "Fortnite" | (aggregated_rating >= 90 & aggregated_rating_count >= 3000);',
Expand All @@ -770,7 +768,7 @@ public function testItShouldGenerateArrayWhereQuery(): void

$this->igdb->where('name', 'Fortnite')->orWhere([['name', 'Call of Duty'], ['name', 'Borderlands 2']])->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where name = "Fortnite" | (name = "Call of Duty" & name = "Borderlands 2");',
Expand All @@ -780,7 +778,7 @@ public function testItShouldGenerateArrayWhereQuery(): void

$this->igdb->where('name', 'Fortnite')->where(['name' => 'Borderlands', 'first_release_date' => $now])->get();

Http::assertSent(fn(Request $request) => $this->isApiCall(
Http::assertSent(fn (Request $request) => $this->isApiCall(
$request,
'games',
'where name = "Fortnite" & (name = "Borderlands" & first_release_date = ' . $now . ');',
Expand Down

0 comments on commit 7d5d3ad

Please sign in to comment.