Skip to content

Commit

Permalink
Merge pull request #78 from gsteel/improve-plugin-manager-type-inference
Browse files Browse the repository at this point in the history
General static analysis improvements and Removal of Interop\Container
  • Loading branch information
Ocramius authored Jul 12, 2022
2 parents 1654fcd + 657ec27 commit e77c04c
Show file tree
Hide file tree
Showing 18 changed files with 313 additions and 436 deletions.
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"require": {
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"ext-intl": "*",
"laminas/laminas-servicemanager": "^3.14.0",
"laminas/laminas-stdlib": "^2.7 || ^3.0"
},
"require-dev": {
Expand All @@ -42,15 +43,14 @@
"laminas/laminas-cache-storage-deprecated-factory": "^1.0.0",
"laminas/laminas-coding-standard": "~2.3.0",
"laminas/laminas-config": "^3.4.0",
"laminas/laminas-eventmanager": "^3.4.0",
"laminas/laminas-filter": "^2.10.0",
"laminas/laminas-servicemanager": "^3.7.0",
"laminas/laminas-validator": "^2.14.0",
"laminas/laminas-view": "^2.20.0",
"laminas/laminas-eventmanager": "^3.5.0",
"laminas/laminas-filter": "^2.16.0",
"laminas/laminas-validator": "^2.17.0",
"laminas/laminas-view": "^2.21.0",
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.16.1",
"vimeo/psalm": "^4.21"
"phpunit/phpunit": "^9.5.21",
"psalm/plugin-phpunit": "^0.17.0",
"vimeo/psalm": "^4.24.0"
},
"conflict": {
"laminas/laminas-view": "<2.20.0",
Expand Down
422 changes: 195 additions & 227 deletions composer.lock

Large diffs are not rendered by default.

125 changes: 7 additions & 118 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.21.0@d8bec4c7aaee111a532daec32fb09de5687053d1">
<file src="src/ConfigProvider.php">
<MixedArrayOffset occurrences="4"/>
<UndefinedClass occurrences="19">
<code>\Zend\I18n\Filter\Alnum</code>
<code>\Zend\I18n\Filter\Alpha</code>
<code>\Zend\I18n\Filter\NumberFormat</code>
<code>\Zend\I18n\Filter\NumberParse</code>
<code>\Zend\I18n\Translator\LoaderPluginManager</code>
<code>\Zend\I18n\Translator\TranslatorInterface</code>
<code>\Zend\I18n\Validator\Alnum</code>
<code>\Zend\I18n\Validator\Alpha</code>
<code>\Zend\I18n\Validator\DateTime</code>
<code>\Zend\I18n\Validator\IsFloat</code>
<code>\Zend\I18n\Validator\IsInt</code>
<code>\Zend\I18n\Validator\PhoneNumber</code>
<code>\Zend\I18n\Validator\PostCode</code>
<code>\Zend\I18n\View\Helper\CurrencyFormat</code>
<code>\Zend\I18n\View\Helper\DateFormat</code>
<code>\Zend\I18n\View\Helper\NumberFormat</code>
<code>\Zend\I18n\View\Helper\Plural</code>
<code>\Zend\I18n\View\Helper\Translate</code>
<code>\Zend\I18n\View\Helper\TranslatePlural</code>
</UndefinedClass>
</file>
<files psalm-version="4.24.0@06dd975cb55d36af80f242561738f16c5f58264f">
<file src="src/Filter/AbstractLocale.php">
<MixedInferredReturnType occurrences="1">
<code>string</code>
Expand Down Expand Up @@ -209,25 +185,22 @@
<MissingReturnType occurrences="1">
<code>validatePlugin</code>
</MissingReturnType>
<MixedArrayOffset occurrences="1"/>
<MixedPropertyTypeCoercion occurrences="1"/>
<NonInvariantDocblockPropertyType occurrences="2">
<code>$aliases</code>
<code>$factories</code>
</NonInvariantDocblockPropertyType>
<ParamNameMismatch occurrences="1">
<code>$plugin</code>
</ParamNameMismatch>
<UndefinedClass occurrences="3">
<code>Gettext</code>
<code>Ini</code>
<code>PhpArray</code>
</UndefinedClass>
</file>
<file src="src/Translator/LoaderPluginManagerFactory.php">
<DeprecatedInterface occurrences="1">
<code>LoaderPluginManagerFactory</code>
</DeprecatedInterface>
<DeprecatedProperty occurrences="2">
<code>$this-&gt;creationOptions</code>
<code>$this-&gt;creationOptions</code>
</DeprecatedProperty>
<MixedArgument occurrences="1">
<code>$config['translator_plugins']</code>
</MixedArgument>
Expand Down Expand Up @@ -402,10 +375,6 @@
<code>$r</code>
<code>$r</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="2">
<code>static function ($r) {</code>
<code>static function ($r) {</code>
</MissingClosureReturnType>
<MissingConstructor occurrences="2">
<code>$events</code>
<code>$pluginManager</code>
Expand Down Expand Up @@ -520,41 +489,15 @@
</MixedAssignment>
</file>
<file src="src/Validator/Alnum.php">
<DocblockTypeContradiction occurrences="2">
<code>! is_string($value) &amp;&amp; ! is_int($value) &amp;&amp; ! is_float($value)</code>
<code>null === static::$filter</code>
</DocblockTypeContradiction>
<InvalidScalarArgument occurrences="1">
<code>$value</code>
</InvalidScalarArgument>
<MixedArgument occurrences="1">
<code>$this-&gt;options['allowWhiteSpace']</code>
</MixedArgument>
<MixedInferredReturnType occurrences="1">
<code>bool</code>
</MixedInferredReturnType>
<MixedReturnStatement occurrences="1">
<code>$this-&gt;options['allowWhiteSpace']</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
<RedundantCastGivenDocblockType occurrences="2">
<code>(bool) $allowWhiteSpace</code>
<code>(bool) $allowWhiteSpace</code>
</RedundantCastGivenDocblockType>
</file>
<file src="src/Validator/Alpha.php">
<DocblockTypeContradiction occurrences="2">
<code>is_string($value)</code>
<code>null === static::$filter</code>
</DocblockTypeContradiction>
<MixedArgument occurrences="1">
<code>$this-&gt;options['allowWhiteSpace']</code>
</MixedArgument>
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
<NonInvariantDocblockPropertyType occurrences="1">
<code>$filter</code>
</NonInvariantDocblockPropertyType>
Expand Down Expand Up @@ -583,33 +526,22 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="src/Validator/IsFloat.php">
<DocblockTypeContradiction occurrences="2">
<code>! is_scalar($value)</code>
<code>is_bool($value)</code>
</DocblockTypeContradiction>
<MixedArgument occurrences="1">
<code>$options['locale']</code>
</MixedArgument>
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyFalseArgument occurrences="1">
<code>$lastStringGroup</code>
</PossiblyFalseArgument>
</file>
<file src="src/Validator/IsInt.php">
<DocblockTypeContradiction occurrences="2">
<code>! is_string($value) &amp;&amp; ! is_int($value) &amp;&amp; ! is_float($value)</code>
<DocblockTypeContradiction occurrences="1">
<code>is_bool($strict)</code>
</DocblockTypeContradiction>
<InvalidArrayOffset occurrences="1"/>
<MixedArgument occurrences="2">
<code>$options['locale']</code>
<code>$options['strict']</code>
</MixedArgument>
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyNullArgument occurrences="1">
<code>$locale</code>
</PossiblyNullArgument>
Expand Down Expand Up @@ -648,9 +580,6 @@
<MixedReturnStatement occurrences="1">
<code>static::$phone[$code]</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
<RedundantCastGivenDocblockType occurrences="1">
<code>(bool) $possible</code>
</RedundantCastGivenDocblockType>
Expand All @@ -660,9 +589,6 @@
<code>getService</code>
<code>setService</code>
</DeprecatedMethod>
<DocblockTypeContradiction occurrences="1">
<code>! is_string($value) &amp;&amp; ! is_int($value)</code>
</DocblockTypeContradiction>
<InvalidScalarArgument occurrences="2">
<code>$value</code>
<code>$value</code>
Expand All @@ -684,9 +610,6 @@
<code>$format</code>
<code>$format</code>
</MixedOperand>
<MoreSpecificImplementedParamType occurrences="1">
<code>$value</code>
</MoreSpecificImplementedParamType>
</file>
<file src="src/View/Helper/AbstractTranslatorHelper.php">
<RedundantCastGivenDocblockType occurrences="1">
Expand Down Expand Up @@ -924,10 +847,6 @@
<code>$container</code>
<code>$container</code>
</MissingClosureParamType>
<MissingClosureReturnType occurrences="2">
<code>static function ($container) use ($translator) {</code>
<code>static function ($container) use ($translator) {</code>
</MissingClosureReturnType>
<UnusedClosureParam occurrences="2">
<code>$container</code>
<code>$container</code>
Expand Down Expand Up @@ -1049,19 +968,6 @@
<code>$doNotTrigger</code>
</UnusedVariable>
</file>
<file src="test/Validator/AlnumTest.php">
<InvalidArgument occurrences="1">
<code>[1 =&gt; 1]</code>
</InvalidArgument>
</file>
<file src="test/Validator/AlphaTest.php">
<InvalidArgument occurrences="1">
<code>[1 =&gt; 1]</code>
</InvalidArgument>
<InvalidCast occurrences="1">
<code>[1 =&gt; 1]</code>
</InvalidCast>
</file>
<file src="test/Validator/DateTimeTest.php">
<MissingReturnType occurrences="7">
<code>testApplicationOptionLocale</code>
Expand All @@ -1083,24 +989,12 @@
</UndefinedMethod>
</file>
<file src="test/Validator/IsFloatTest.php">
<InvalidArgument occurrences="1">
<code>[1 =&gt; 1]</code>
</InvalidArgument>
<MixedArgument occurrences="2">
<code>$message['notFloat']</code>
<code>$value</code>
</MixedArgument>
<MixedOperand occurrences="1">
<code>$value</code>
</MixedOperand>
</file>
<file src="test/Validator/IsIntTest.php">
<InvalidArgument occurrences="1">
<code>[1 =&gt; 1]</code>
</InvalidArgument>
<MixedArgument occurrences="3">
<code>$intVal</code>
<code>$intVal</code>
<MixedArgument occurrences="1">
<code>$strict</code>
</MixedArgument>
</file>
Expand All @@ -1113,11 +1007,6 @@
<code>static function ($value) use ($params) {</code>
<code>static function ($value) use ($params) {</code>
</MissingClosureReturnType>
<MixedArgument occurrences="3">
<code>$message['postcodeNoMatch']</code>
<code>$message['postcodeService']</code>
<code>$postCode</code>
</MixedArgument>
</file>
<file src="test/View/Helper/CurrencyFormatTest.php">
<PossiblyNullArgument occurrences="1">
Expand Down
Loading

0 comments on commit e77c04c

Please sign in to comment.