Skip to content

Commit 05cbd0f

Browse files
zimingsoyuka
andauthored
chore(laravel): phpstan/phpdoc-parser ^2.0, larastan ^3.0 (#6900)
Co-authored-by: soyuka <[email protected]>
1 parent a11988e commit 05cbd0f

File tree

11 files changed

+21
-12
lines changed

11 files changed

+21
-12
lines changed

src/Laravel/Eloquent/Filter/DateFilter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ public function getSchema(Parameter $parameter): array
8484
return ['type' => 'date'];
8585
}
8686

87-
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
87+
/**
88+
* @return OpenApiParameter[]
89+
*/
90+
public function getOpenApiParameters(Parameter $parameter): array
8891
{
8992
$in = $parameter instanceof QueryParameter ? 'query' : 'header';
9093
$key = $parameter->getKey();

src/Laravel/Eloquent/Filter/OrFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getSchema(Parameter $parameter): array
4949
return ['type' => 'array', 'items' => $schema];
5050
}
5151

52-
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
52+
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter
5353
{
5454
return new OpenApiParameter(name: $parameter->getKey().'[]', in: 'query', style: 'deepObject', explode: true);
5555
}

src/Laravel/Eloquent/Filter/OrderFilter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ public function getSchema(Parameter $parameter): array
5454
return ['type' => 'string', 'enum' => ['asc', 'desc']];
5555
}
5656

57-
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
57+
/**
58+
* @return OpenApiParameter[]|null
59+
*/
60+
public function getOpenApiParameters(Parameter $parameter): ?array
5861
{
5962
if (str_contains($parameter->getKey(), ':property')) {
6063
$parameters = [];

src/Laravel/Eloquent/Filter/RangeFilter.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ public function getSchema(Parameter $parameter): array
5252
return ['type' => 'number'];
5353
}
5454

55-
public function getOpenApiParameters(Parameter $parameter): OpenApiParameter|array|null
55+
/**
56+
* @return OpenApiParameter[]
57+
*/
58+
public function getOpenApiParameters(Parameter $parameter): array
5659
{
5760
$in = $parameter instanceof QueryParameter ? 'query' : 'header';
5861
$key = $parameter->getKey();

src/Laravel/Eloquent/Paginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434

3535
public function count(): int
3636
{
37-
return $this->paginator->count();
37+
return $this->paginator->count(); // @phpstan-ignore-line
3838
}
3939

4040
public function getLastPage(): float

src/Laravel/Eloquent/PartialPaginator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(
3333

3434
public function count(): int
3535
{
36-
return $this->paginator->count();
36+
return $this->paginator->count(); // @phpstan-ignore-line
3737
}
3838

3939
public function getCurrentPage(): float

src/Laravel/Routing/IriConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private function generateRoute(object|string $resource, int $referenceType = Url
159159
if (\is_object($resource)) {
160160
try {
161161
$identifiers = $this->identifiersExtractor->getIdentifiersFromItem($resource, $identifiersExtractorOperation, $context);
162-
} catch (InvalidArgumentException|RuntimeException $e) {
162+
} catch (RuntimeException $e) {
163163
// We can try using context uri variables if any
164164
if (!$identifiers) {
165165
throw new InvalidArgumentException(\sprintf('Unable to generate an IRI for the item of type "%s"', $operation->getClass()), $e->getCode(), $e);

src/Laravel/Routing/SkolemIriConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getResourceFromIri(string $iri, array $context = [], ?Operation
5353
/**
5454
* {@inheritdoc}
5555
*/
56-
public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): ?string
56+
public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): string
5757
{
5858
$referenceType = $operation ? ($operation->getUrlGenerationStrategy() ?? $referenceType) : $referenceType;
5959
if (($isObject = \is_object($resource)) && $this->objectHashMap->contains($resource)) {

src/Laravel/Tests/Console/Maker/MakeStateProcessorCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MakeStateProcessorCommandTest extends TestCase
3030
/** @var string */
3131
private const CHOSEN_CLASS_NAME = 'Choose a class name for your state processor (e.g. <fg=yellow>AwesomeStateProcessor</>)';
3232

33-
private ?Filesystem $filesystem;
33+
private Filesystem $filesystem;
3434
private PathResolver $pathResolver;
3535
private AppServiceFileGenerator $appServiceFileGenerator;
3636

src/Laravel/Tests/Console/Maker/MakeStateProviderCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MakeStateProviderCommandTest extends TestCase
3030
/** @var string */
3131
private const STATE_PROVIDER_CLASS_NAME = 'Choose a class name for your state provider (e.g. <fg=yellow>AwesomeStateProvider</>)';
3232

33-
private ?Filesystem $filesystem;
33+
private Filesystem $filesystem;
3434
private PathResolver $pathResolver;
3535
private AppServiceFileGenerator $appServiceFileGenerator;
3636

0 commit comments

Comments
 (0)