Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock file maintenance, minor type inference improvements #114

Merged
merged 2 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@
"laminas/laminas-stdlib": "^3.0"
},
"require-dev": {
"laminas/laminas-cache": "^3.11.0",
"laminas/laminas-cache": "^3.12.0",
"laminas/laminas-cache-storage-adapter-memory": "^2.3.0",
"laminas/laminas-cache-storage-deprecated-factory": "^1.1",
"laminas/laminas-cache-storage-deprecated-factory": "^1.2",
"laminas/laminas-coding-standard": "~2.5.0",
"laminas/laminas-config": "^3.9.0",
"laminas/laminas-eventmanager": "^3.12",
"laminas/laminas-filter": "^2.33",
"laminas/laminas-validator": "^2.41",
"laminas/laminas-view": "^2.32",
"phpunit/phpunit": "^10.4.2",
"laminas/laminas-eventmanager": "^3.13",
"laminas/laminas-filter": "^2.34",
"laminas/laminas-validator": "^2.46",
"laminas/laminas-view": "^2.33",
"phpunit/phpunit": "^10.5.5",
"psalm/plugin-phpunit": "^0.18.4",
"vimeo/psalm": "^5.15.0"
"vimeo/psalm": "^5.18.0"
},
"conflict": {
"laminas/laminas-view": "<2.20.0",
Expand Down
359 changes: 193 additions & 166 deletions composer.lock

Large diffs are not rendered by default.

40 changes: 4 additions & 36 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.15.0@5c774aca4746caf3d239d9c8cadb9f882ca29352">
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
<file src="src/Exception/ExtensionNotLoadedException.php">
<UnusedClass>
<code>ExtensionNotLoadedException</code>
Expand All @@ -19,40 +19,21 @@
</MixedReturnStatement>
</file>
<file src="src/Filter/Alnum.php">
<DocblockTypeContradiction>
<code><![CDATA[! is_scalar($value) && ! is_array($value)]]></code>
</DocblockTypeContradiction>
<MixedArgumentTypeCoercion>
<code>$value</code>
</MixedArgumentTypeCoercion>
<MixedReturnStatement>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<code>$value</code>
</MoreSpecificImplementedParamType>
<PossiblyInvalidArgument>
<code>$allowWhiteSpaceOrOptions</code>
<code>$allowWhiteSpaceOrOptions</code>
</PossiblyInvalidArgument>
<RedundantCastGivenDocblockType>
<code>(bool) $flag</code>
<code>(string) $value</code>
</RedundantCastGivenDocblockType>
</file>
<file src="src/Filter/Alpha.php">
<DocblockTypeContradiction>
<code><![CDATA[! is_scalar($value) && ! is_array($value)]]></code>
</DocblockTypeContradiction>
<MixedArgumentTypeCoercion>
<code>$value</code>
</MixedArgumentTypeCoercion>
<MixedReturnStatement>
<code>$value</code>
</MixedReturnStatement>
<MoreSpecificImplementedParamType>
<ArgumentTypeCoercion>
<code>$value</code>
</MoreSpecificImplementedParamType>
</ArgumentTypeCoercion>
</file>
<file src="src/Filter/NumberParse.php">
<RedundantCastGivenDocblockType>
Expand Down Expand Up @@ -333,10 +314,6 @@
</UnnecessaryVarAnnotation>
</file>
<file src="src/Translator/TextDomain.php">
<MixedArgumentTypeCoercion>
<code><![CDATA[$textDomain->getArrayCopy()]]></code>
<code><![CDATA[$this->getArrayCopy()]]></code>
</MixedArgumentTypeCoercion>
<PossiblyNullArgument>
<code><![CDATA[$textDomain->getPluralRule()]]></code>
</PossiblyNullArgument>
Expand Down Expand Up @@ -491,9 +468,6 @@
</MixedAssignment>
</file>
<file src="src/Validator/Alnum.php">
<PossiblyInvalidArgument>
<code>$value</code>
</PossiblyInvalidArgument>
<RedundantCastGivenDocblockType>
<code>(bool) $allowWhiteSpace</code>
<code>(bool) $allowWhiteSpace</code>
Expand Down Expand Up @@ -717,17 +691,11 @@
</PossiblyUnusedMethod>
</file>
<file src="test/Filter/AlnumTest.php">
<MixedArgument>
<code>$input</code>
</MixedArgument>
<PossiblyUnusedMethod>
<code>returnUnfilteredDataProvider</code>
</PossiblyUnusedMethod>
</file>
<file src="test/Filter/AlphaTest.php">
<MixedArgument>
<code>$input</code>
</MixedArgument>
<PossiblyUnusedMethod>
<code>returnUnfilteredDataProvider</code>
</PossiblyUnusedMethod>
Expand All @@ -741,8 +709,8 @@
</file>
<file src="test/Filter/NumberParseTest.php">
<PossiblyUnusedMethod>
<code>formattedToNumberProvider</code>
<code>formatNonNumberProvider</code>
<code>formattedToNumberProvider</code>
</PossiblyUnusedMethod>
</file>
<file src="test/TestAsset/ModuleEventInterface.php">
Expand Down
4 changes: 2 additions & 2 deletions src/Filter/Alnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public function getAllowWhiteSpace()
*
* Returns $value as string with all non-alphanumeric characters removed
*
* @param string|array $value
* @return string|array
* @param mixed $value
* @return ($value is scalar|list<scalar> ? string|list<scalar> : mixed)
*/
public function filter($value)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Filter/Alpha.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Alpha extends Alnum
*
* Returns the string $value, removing all but alphabetic characters
*
* @param string|array $value
* @return string|array
* @param mixed $value
* @return ($value is scalar|list<scalar> ? string|list<scalar> : mixed)
*/
public function filter($value)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Translator/TextDomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Text domain.
*
* @template TKey
* @template TKey of array-key
* @template TValue
* @extends ArrayObject<TKey, TValue>
*/
Expand Down Expand Up @@ -90,7 +90,7 @@ public static function getDefaultPluralRule()
*
* @return $this
* @throws Exception\RuntimeException
* @template TNewKey
* @template TNewKey of array-key
* @template TNewValue
* @param self<TNewKey, TNewValue> $textDomain
* @psalm-self-out self<TKey|TNewKey, TValue|TNewValue>
Expand Down
5 changes: 2 additions & 3 deletions src/Translator/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
use Traversable;

use function array_shift;
use function gettype;
use function get_debug_type;
use function is_array;
use function is_file;
use function is_object;
use function is_string;
use function md5;
use function rtrim;
Expand Down Expand Up @@ -125,7 +124,7 @@ public static function factory($options)
throw new Exception\InvalidArgumentException(sprintf(
'%s expects an array or Traversable object; received "%s"',
__METHOD__,
is_object($options) ? $options::class : gettype($options)
get_debug_type($options),
));
}

Expand Down
1 change: 1 addition & 0 deletions test/Validator/DateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class DateTimeTest extends TestCase
{
private DateTimeValidator $validator;
/** @var non-empty-string */
private string $timezone;

protected function setUp(): void
Expand Down