Skip to content

Commit

Permalink
Fix psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Jan 7, 2025
1 parent 67a8359 commit 0c470fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
7 changes: 2 additions & 5 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@
</file>
<file src="src/Config/RelationConfig.php">
<TooManyArguments>
<code><![CDATA[new Autowire($this->config[$type][self::LOADER])]]></code>
<code><![CDATA[new Autowire($this->config[$type][self::RELATION])]]></code>
<code>new Autowire($loader)</code>
<code>new Autowire($relation)</code>
</TooManyArguments>
</file>
<file src="src/EntityManager.php">
Expand Down Expand Up @@ -297,9 +297,6 @@
],
)]]></code>
</LessSpecificReturnStatement>
<MethodSignatureMismatch>
<code>$alias</code>
</MethodSignatureMismatch>
<MixedArgument>
<code>$class</code>
<code>$class</code>
Expand Down
18 changes: 10 additions & 8 deletions src/Config/RelationConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,21 @@ public static function getDefault(): self

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

return new Autowire($this->config[$type][self::LOADER]);
\assert(\is_string($loader) && $loader !== '');
return new Autowire($loader);
}

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

return new Autowire($this->config[$type][self::RELATION]);
\assert(\is_string($relation) && $relation !== '');
return new Autowire($relation);
}
}

0 comments on commit 0c470fb

Please sign in to comment.