Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump: sigwin/infra #172

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"sigwin/infra": "~1.5.0"
"sigwin/infra": "~1.6.0"
},
"conflict": {
"nikic/php-parser": "< 4.14",
Expand Down
2 changes: 1 addition & 1 deletion psalm.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="true"
limitMethodComplexity="true"
restrictReturnTypes="true"
restrictReturnTypes="false"
strictBinaryOperands="true">
<projectFiles>
<directory name="./"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public function __construct(InlineFragmentRenderer $fragmentRenderer, UrlGenerat

/**
* @psalm-param string|\Symfony\Component\HttpKernel\Controller\ControllerReference $uri
*
* @param mixed $uri
*/
public function render($uri, Request $request, array $options = []): \Symfony\Component\HttpFoundation\Response
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __construct(ExpressionLanguage $expressionLanguage, ClassMetadat
$this->classMetadataFactory = $classMetadataFactory;
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): Collection
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): Collection
{
$type = mb_substr($type, 0, -2);
if ($data === null) {
Expand All @@ -55,7 +55,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return new ReadOnlyCollection($this->expressionLanguage, $this->getProperties($type), $denormalized);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = null): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, ?array $context = null): bool
{
return str_ends_with($type, '[]');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(ExpressionLanguage $expressionLanguage, DatabaseProv
$this->databaseProvider = $databaseProvider;
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = [])
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = [])
{
/** @var string $data */
$value = $this->expressionLanguage->evaluate(mb_substr($data, 2), [
Expand All @@ -47,7 +47,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return $value;
}

public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null): bool
{
return \is_string($data) && str_starts_with($data, '@=');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct(array $classes)
$this->classes = $classes;
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = []): mixed
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed
{
if (isset($this->classes[$type])) {
$locale = $context[LocaleContext::LOCALE];
Expand All @@ -55,7 +55,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return $this->denormalizer->denormalize($data, $type, $format, $context);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = null): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, ?array $context = null): bool
{
return isset($this->classes[$type]) && ($context[self::LOCALIZING_NORMALIZER_LAST_TYPE] ?? null) !== $type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(FileLocatorInterface $locator)
$this->locator = $locator;
}

public function denormalize(mixed $data, string $type, string $format = null, array $context = [])
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = [])
{
if (\is_string($data) === false) {
throw new \LogicException('String expected');
Expand All @@ -35,7 +35,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar
return $this->locator->locate($data);
}

public function supportsDenormalization(mixed $data, string $type, string $format = null): bool
public function supportsDenormalization(mixed $data, string $type, ?string $format = null): bool
{
return $type === Resource::class && \is_string($data) && str_starts_with($data, '@');
}
Expand Down
1 change: 0 additions & 1 deletion src/Storage/FilesystemStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ public static function resolveOptions(array $options): array
$resolver->setRequired(['root']);
$resolver->setAllowedTypes('root', ['array', 'string']);
$resolver->setAllowedTypes('names', ['array', 'string']);
/** @psalm-suppress UnusedClosureParam */
$resolver->setNormalizer('root', static function (OptionsResolver $resolver, array|string $value): array {
if (\is_string($value)) {
$value = [$value];
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private function generate(Generator $generator): void
$called = true;
});
if (! $called) {
static::fail('Callback not called');
self::fail('Callback not called');
}
}

Expand All @@ -121,20 +121,20 @@ private function mockUrlGenerator(string $baseUrl, array $routes, mixed $indexFi
{
$requestContext = $this->getMockBuilder(RequestContext::class)->getMock();
$requestContext
->expects(static::once())
->expects(self::once())
->method('getBaseUrl')
->willReturn($baseUrl)
;
$requestContext
->expects(static::once())
->expects(self::once())
->method('getParameter')
->with('index-file')
->willReturn($indexFile)
;

$urlGenerator = $this->getMockBuilder(UrlGeneratorInterface::class)->getMock();
$urlGenerator
->expects(static::once())
->expects(self::once())
->method('getContext')
->willReturn($requestContext)
;
Expand All @@ -145,7 +145,7 @@ private function mockUrlGenerator(string $baseUrl, array $routes, mixed $indexFi
}

$urlGenerator
->expects(static::exactly(\count($routes)))
->expects(self::exactly(\count($routes)))
->method('generate')
->withConsecutive(...$remapped)
->willReturn('/////')
Expand All @@ -158,21 +158,21 @@ private function mockKernel(string $baseUrl, string|false $body, int $status = 2
{
$response = $this->getMockBuilder(Response::class)->getMock();
$response
->expects(static::once())
->expects(self::once())
->method('getStatusCode')
->willReturn($status)
;
$response
->expects(static::once())
->expects(self::once())
->method('getContent')
->willReturn($body)
;

$kernel = $this->getMockBuilder(KernelInterface::class)->getMock();
$kernel
->expects(static::once())
->expects(self::once())
->method('handle')
->with(static::callback(static function (\Symfony\Component\HttpFoundation\Request $request) use ($baseUrl): bool {
->with(self::callback(static function (\Symfony\Component\HttpFoundation\Request $request) use ($baseUrl): bool {
return $request->getUri() === 'http://localhost/'.$baseUrl;
}))
->willReturn($response)
Expand All @@ -185,7 +185,7 @@ private function mockFilesystem(?string $path, string $content): Filesystem
{
$filesystem = $this->getMockBuilder(Filesystem::class)->getMock();
$filesystem
->expects(static::once())
->expects(self::once())
->method('dumpFile')
->with($path, $content)
;
Expand Down
Loading