Skip to content

Commit

Permalink
fix typing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericjaume-oc committed Jun 28, 2024
1 parent fa0d27c commit 20d2483
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Definition/Example/OperationExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class OperationExample
private DeepCopy $deepCopy;

public function __construct(
private string $name,
private string|int $name,
Operation $parent = null,
?int $statusCode = null,
) {
Expand Down Expand Up @@ -153,19 +153,19 @@ public function withBody(BodyExample $body): self
return $clone;
}

public function getName(): string
public function getName(): string|int
{
return $this->name;
}

public function setName(string $name): self
public function setName(string|int $name): self
{
$this->name = $name;

return $this;
}

public function withName(string $name): self
public function withName(string|int $name): self
{
/** @var OperationExample $clone */
$clone = $this->deepCopy->copy($this);
Expand Down
7 changes: 6 additions & 1 deletion src/Preparator/Error404Preparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ private function prepareTestCase(DefinitionResponse $response): array

$testcases = [];

foreach (range(1, $operation->getRequestBodies()->count() ?: 1) as $ignored) {
foreach (
range(
1,
$operation->getRequestBodies()->count() ?: 1

Check failure on line 46 in src/Preparator/Error404Preparator.php

View workflow job for this annotation

GitHub Actions / PHPStan

Short ternary operator is not allowed. Use null coalesce operator if applicable or consider using long ternary.
) as $ignored
) {
$notFoundExample = $operation->getExample(
'404',
OperationExample::create('RandomPath', $operation)->setForceRandom()
Expand Down

0 comments on commit 20d2483

Please sign in to comment.