Skip to content

Commit f52764a

Browse files
committed
Fix psalm issues
1 parent 67a8359 commit f52764a

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

psalm-baseline.xml

+2-5
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,8 @@
229229
</file>
230230
<file src="src/Config/RelationConfig.php">
231231
<TooManyArguments>
232-
<code><![CDATA[new Autowire($this->config[$type][self::LOADER])]]></code>
233-
<code><![CDATA[new Autowire($this->config[$type][self::RELATION])]]></code>
232+
<code>new Autowire($loader)</code>
233+
<code>new Autowire($relation)</code>
234234
</TooManyArguments>
235235
</file>
236236
<file src="src/EntityManager.php">
@@ -297,9 +297,6 @@
297297
],
298298
)]]></code>
299299
</LessSpecificReturnStatement>
300-
<MethodSignatureMismatch>
301-
<code>$alias</code>
302-
</MethodSignatureMismatch>
303300
<MixedArgument>
304301
<code>$class</code>
305302
<code>$class</code>

src/Config/RelationConfig.php

+10-8
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,21 @@ public static function getDefault(): self
6161

6262
public function getLoader(int|string $type): Autowire
6363
{
64-
if (!isset($this->config[$type][self::LOADER])) {
65-
throw new ConfigException("Unable to get relation loader `{$type}`.");
66-
}
64+
$loader = $this->config[$type][self::LOADER] ?? throw new ConfigException(
65+
"Unable to get relation loader `{$type}`.",
66+
);
6767

68-
return new Autowire($this->config[$type][self::LOADER]);
68+
\assert(\is_string($loader));
69+
return new Autowire($loader);
6970
}
7071

7172
public function getRelation(int|string $type): Autowire
7273
{
73-
if (!isset($this->config[$type][self::RELATION])) {
74-
throw new ConfigException("Unable to get relation `{$type}`.");
75-
}
74+
$relation = $this->config[$type][self::RELATION] ?? throw new ConfigException(
75+
"Unable to get relation `{$type}`.",
76+
);
7677

77-
return new Autowire($this->config[$type][self::RELATION]);
78+
\assert(\is_string($relation));
79+
return new Autowire($relation);
7880
}
7981
}

0 commit comments

Comments
 (0)