Skip to content

Commit 20cfc18

Browse files
ohmyfelixf3l1x
authored andcommitted
QA: fix PHPStan assertions
Tighten the config schema callbacks and correct the stdClass casing so the latest PHPStan run passes again.
1 parent 54ac58d commit 20cfc18

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/DI/OrmExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,16 @@ public function getConfigSchema(): Schema
8989
$autoGenerateProxy = boolval($parameters['debugMode'] ?? true);
9090

9191
$expectService = Expect::anyOf(
92-
Expect::string()->required()->assert(fn ($input) => str_starts_with($input, '@') || class_exists($input) || interface_exists($input)),
92+
Expect::string()->required()->assert(static fn (mixed $input): bool => is_string($input) && (str_starts_with($input, '@') || class_exists($input) || interface_exists($input))),
9393
Expect::type(Statement::class)->required(),
9494
);
9595

9696
return Expect::structure([
9797
'managers' => Expect::arrayOf(
9898
Expect::structure([
9999
'connection' => Expect::string()->required(),
100-
'entityManagerDecoratorClass' => Expect::string()->assert(fn ($input) => is_a($input, EntityManagerDecorator::class, true), 'EntityManager decorator class must be subclass of ' . EntityManagerDecorator::class),
101-
'configurationClass' => Expect::string(Configuration::class)->assert(fn ($input) => is_a($input, Configuration::class, true), 'Configuration class must be subclass of ' . Configuration::class),
100+
'entityManagerDecoratorClass' => Expect::string()->assert(static fn (mixed $input): bool => is_string($input) && is_a($input, EntityManagerDecorator::class, true), 'EntityManager decorator class must be subclass of ' . EntityManagerDecorator::class),
101+
'configurationClass' => Expect::string(Configuration::class)->assert(static fn (mixed $input): bool => is_string($input) && is_a($input, Configuration::class, true), 'Configuration class must be subclass of ' . Configuration::class),
102102
'lazyNativeObjects' => Expect::bool(),
103103
'proxyDir' => Expect::string()->default($proxyDir)->before(fn (mixed $v) => $v ?? $proxyDir)->assert(fn (mixed $v) => !($v === null || $v === ''), 'proxyDir must be filled'),
104104
'autoGenerateProxyClasses' => Expect::anyOf(Expect::int(), Expect::bool(), Expect::type(Statement::class))->default($autoGenerateProxy),

src/DI/Pass/AbstractPass.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public function getContainerBuilder(): ContainerBuilder
5151
return $this->extension->getContainerBuilder();
5252
}
5353

54-
public function getConfig(): stdclass
54+
public function getConfig(): stdClass
5555
{
56-
/** @var stdclass $ret */
56+
/** @var stdClass $ret */
5757
$ret = (object) $this->extension->getConfig();
5858

5959
return $ret;

0 commit comments

Comments
 (0)