Skip to content

Commit

Permalink
Help out psalm inferring config array shapes
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Dec 5, 2022
1 parent 2e730ff commit d26d4bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 1 addition & 9 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.0.0@4e177bf0c9f03c17d2fbfd83b7cc9c47605274d8">
<files psalm-version="5.1.0@4defa177c89397c5e14737a80fe4896584130674">
<file src="src/Aggregate/AggregateHydrator.php">
<DocblockTypeContradiction occurrences="1">
<code>null === $this-&gt;eventManager</code>
Expand Down Expand Up @@ -107,11 +107,6 @@
<code>Reflection::class</code>
</DeprecatedClass>
</file>
<file src="src/HydratorPluginManagerFactory.php">
<MixedArgument occurrences="1">
<code>$config['hydrators']</code>
</MixedArgument>
</file>
<file src="src/Iterator/HydratingIteratorIterator.php">
<InvalidArgument occurrences="1">
<code>$data</code>
Expand Down Expand Up @@ -434,9 +429,6 @@
<code>$property</code>
</MissingClosureParamType>
</file>
<file src="test/HydratorPluginManagerFactoryTest.php">
<InvalidArgument occurrences="1"/>
</file>
<file src="test/HydratorStrategyTest.php">
<MixedArgument occurrences="2">
<code>$attributes['entities']</code>
Expand Down
7 changes: 6 additions & 1 deletion src/HydratorPluginManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

/**
* @psalm-import-type ServiceManagerConfiguration from ServiceManager
* @final
*/
class HydratorPluginManagerFactory
{
Expand Down Expand Up @@ -45,7 +46,9 @@ public function __invoke(ContainerInterface $container, string $name, ?array $op
));
}

$pluginManager = new HydratorPluginManager($container, $options ?? []);
/** @psalm-var ServiceManagerConfiguration $options */
$options = is_array($options) ? $options : [];
$pluginManager = new HydratorPluginManager($container, $options);

// If this is in a laminas-mvc application, the ServiceListener will inject
// merged configuration during bootstrap.
Expand All @@ -65,6 +68,8 @@ public function __invoke(ContainerInterface $container, string $name, ?array $op
return $pluginManager;
}

/** @psalm-var ServiceManagerConfiguration $config['hydrators'] */

// Wire service configuration for hydrators
(new Config($config['hydrators']))->configureServiceManager($pluginManager);

Expand Down

0 comments on commit d26d4bd

Please sign in to comment.