Skip to content

Commit

Permalink
Minor CS and SA fixes
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jun 28, 2024
1 parent cd906d5 commit 5bd9f56
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 106 deletions.
70 changes: 35 additions & 35 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 27 additions & 30 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,11 @@
</UnusedClass>
</file>
<file src="src/Explode.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->getPluginManager()->build($name, $options)]]></code>
</LessSpecificReturnStatement>
<MixedInferredReturnType>
<code><![CDATA[ValidatorInterface]]></code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[$this->getPluginManager()->build($name, $options)]]></code>
<code><![CDATA[$this->getPluginManager()->build($name, $options)]]></code>
<code><![CDATA[$this->getPluginManager()->get($validator)]]></code>
<code><![CDATA[$this->getPluginManager()->get($validator)]]></code>
Expand Down Expand Up @@ -1277,54 +1275,39 @@
</file>
<file src="src/ValidatorPluginManager.php">
<DeprecatedMethod>
<code><![CDATA[getServiceLocator]]></code>
<code><![CDATA[getServiceLocator]]></code>
<code><![CDATA[addInitializer]]></code>
<code><![CDATA[addInitializer]]></code>
</DeprecatedMethod>
<MethodSignatureMismatch>
<code><![CDATA[ValidatorPluginManager]]></code>
</MethodSignatureMismatch>
<MissingParamType>
<code><![CDATA[$configOrContainerInstance]]></code>
</MissingParamType>
<MixedArgument>
<code><![CDATA[$configOrContainerInstance]]></code>
<code><![CDATA[$container->get('MvcTranslator')]]></code>
</MixedArgument>
<PossiblyUnusedMethod>
<code><![CDATA[validatePlugin]]></code>
</PossiblyUnusedMethod>
<PossiblyUnusedProperty>
<code><![CDATA[$shareByDefault]]></code>
</PossiblyUnusedProperty>
<RedundantConditionGivenDocblockType>
<code><![CDATA[$container->getServiceLocator()]]></code>
</RedundantConditionGivenDocblockType>
<NonInvariantDocblockPropertyType>
<code><![CDATA[$instanceOf]]></code>
</NonInvariantDocblockPropertyType>
<UnusedParam>
<code><![CDATA[$container]]></code>
</UnusedParam>
</file>
<file src="src/ValidatorPluginManagerAwareInterface.php">
<MissingReturnType>
<code><![CDATA[setValidatorPluginManager]]></code>
</MissingReturnType>
</file>
<file src="src/ValidatorPluginManagerFactory.php">
<DeprecatedClass>
<code><![CDATA[new Config($config['validators'])]]></code>
</DeprecatedClass>
<DeprecatedInterface>
<code><![CDATA[ValidatorPluginManagerFactory]]></code>
</DeprecatedInterface>
<MixedArgument>
<code><![CDATA[$config['validators']]]></code>
</MixedArgument>
<ParamNameMismatch>
<code><![CDATA[$container]]></code>
</ParamNameMismatch>
</file>
<file src="src/ValidatorProviderInterface.php">
<UnusedClass>
<code><![CDATA[ValidatorProviderInterface]]></code>
</UnusedClass>
</file>
<file src="test/AbstractValidatorTest.php">
<DeprecatedMethod>
<code><![CDATA[setService]]></code>
<code><![CDATA[setService]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[$options]]></code>
</InvalidArgument>
Expand Down Expand Up @@ -1408,6 +1391,9 @@
</PossiblyUnusedMethod>
</file>
<file src="test/EmailAddressTest.php">
<DeprecatedMethod>
<code><![CDATA[setService]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[Hostname::ALLOW_ALL]]></code>
<code><![CDATA[Hostname::ALLOW_ALL]]></code>
Expand Down Expand Up @@ -1724,6 +1710,9 @@
</PossiblyUnusedMethod>
</file>
<file src="test/HostnameTest.php">
<DeprecatedMethod>
<code><![CDATA[setService]]></code>
</DeprecatedMethod>
<InvalidArgument>
<code><![CDATA[$option]]></code>
<code><![CDATA[$option]]></code>
Expand Down Expand Up @@ -1930,6 +1919,9 @@
</PossiblyInvalidCast>
</file>
<file src="test/StaticValidatorTest.php">
<DeprecatedMethod>
<code><![CDATA[setService]]></code>
</DeprecatedMethod>
<NullArgument>
<code><![CDATA[null]]></code>
</NullArgument>
Expand Down Expand Up @@ -1997,4 +1989,9 @@
<code><![CDATA[$errnum]]></code>
</UnusedParam>
</file>
<file src="test/ValidatorPluginManagerTest.php">
<DeprecatedMethod>
<code><![CDATA[setService]]></code>
</DeprecatedMethod>
</file>
</files>
8 changes: 0 additions & 8 deletions src/ValidatorPluginManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
*/
final class ValidatorPluginManagerFactory
{
/**
* {@inheritDoc}
*
* @param string $name
* @param ServiceManagerConfiguration|null $options
* @return ValidatorPluginManager
* @psalm-suppress MoreSpecificImplementedParamType
*/
public function __invoke(ContainerInterface $container): ValidatorPluginManager
{
// If this is in a laminas-mvc application, the ServiceListener will inject
Expand Down
5 changes: 3 additions & 2 deletions test/StaticAnalysis/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace LaminasTest\Validator\StaticAnalysis;

use Laminas\ServiceManager\ServiceManager;
use Laminas\Validator\Uuid;
use Laminas\Validator\ValidatorInterface;
use Laminas\Validator\ValidatorPluginManager;
Expand All @@ -13,13 +14,13 @@ final class PluginManager
{
public function validateAssertsPluginType(mixed $input): ValidatorInterface
{
(new ValidatorPluginManager())->validate($input);
(new ValidatorPluginManager(new ServiceManager()))->validate($input);

return $input;
}

public function getWithClassStringReturnsCorrectInstanceType(): ValidatorInterface
{
return (new ValidatorPluginManager())->get(Uuid::class);
return (new ValidatorPluginManager(new ServiceManager()))->get(Uuid::class);
}
}
Loading

0 comments on commit 5bd9f56

Please sign in to comment.