Skip to content

Commit

Permalink
Bump dependencies and fix psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
discordier committed Apr 24, 2024
1 parent d57243c commit c3ba71e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .phpcq.lock
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpunit/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.6.18","url":"https://phar.phpunit.de/phpunit-9.6.18.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"fc3729afdbab93cbf9f662de730bcc2f936bd9255bb08c6c53d41b9b0a30ec62"},"signature":"https://phar.phpunit.de/phpunit-9.6.18.phar.asc"}},"composerLock":null},"psalm":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"5.23.1","url":"https://github.com/vimeo/psalm/releases/download/5.23.1/psalm.phar","requirements":{"php":{"php":"^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/5.23.1/psalm.phar.asc"}},"composerLock":null},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}},"composerLock":null},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}},"composerLock":null},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}},"composerLock":null},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}},"composerLock":null},"phpcs":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.9.0","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.0/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.0/phpcs.phar.asc"},"phpcbf":{"version":"3.9.0","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.0/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.0/phpcbf.phar.asc"}},"composerLock":null},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.42.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.42.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.42.0/composer-normalize.phar.asc"}},"composerLock":null}},"tools":[]}
{"plugins":{"phpunit":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpunit/phpunit-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0"},"tool":{"phpunit":"^6.0 || ^7.0 || ^8.0 || ^9.0"}},"checksum":{"type":"sha-512","value":"c73f15658e3ba62665f09492ec91c3a6a715760bfaa88473a987538439fff442540148e086e46a6aa18ce55a3ea2fbf76caaa581384cb84a38859fcc609ae7e4"},"tools":{"phpunit":{"version":"9.6.19","url":"https://phar.phpunit.de/phpunit-9.6.19.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-xml":"*","ext-xmlwriter":"*"}},"checksum":{"type":"sha-256","value":"f30c21743f4fbea14ad8ab8f47673f9067117262dafa147fcb182e75fbc1c249"},"signature":"https://phar.phpunit.de/phpunit-9.6.19.phar.asc"}}},"psalm":{"api-version":"1.0.0","version":"1.2.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/psalm/psalm-1.2.0.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0","ext-dom":"*"},"tool":{"psalm":"^3.0 || ^4.0 || ^5.0"}},"checksum":{"type":"sha-512","value":"4a550c9226d7bca582d7c10bd87cce01190c96398936b1613421640c83df62ed1c6e0d44c1b39635414ea8cf4a892a6458d27590793238add24e7cb5547e6ffd"},"tools":{"psalm":{"version":"5.23.1","url":"https://github.com/vimeo/psalm/releases/download/5.23.1/psalm.phar","requirements":{"php":{"php":"^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-SimpleXML":"*","ext-ctype":"*","ext-dom":"*","ext-json":"*","ext-libxml":"*","ext-mbstring":"*","ext-tokenizer":"*"}},"checksum":null,"signature":"https://github.com/vimeo/psalm/releases/download/5.23.1/psalm.phar.asc"}}},"composer-require-checker":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-require-checker/composer-require-checker-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.4 || ^8.0"},"tool":{"composer-require-checker":"^3.8 || ^4.0"}},"checksum":{"type":"sha-512","value":"d5415bddfe024c5749d894034583882aee4e5c3e1087815d9fdd81cb5e71630f631a0e35de0ff84b97fbbf738c16ece5f83bd8c00695913eb846aa6f04577dc2"},"tools":{"composer-require-checker":{"version":"3.8.0","url":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar","requirements":{"php":{"php":"^7.4 || ^8.0","ext-json":"*","ext-phar":"*"}},"checksum":null,"signature":"https://github.com/maglnet/ComposerRequireChecker/releases/download/3.8.0/composer-require-checker.phar.asc"}}},"phpmd":{"api-version":"1.0.0","version":"1.0.2.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpmd/phpmd-1.0.2.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpmd":"^2.6.1"}},"checksum":{"type":"sha-512","value":"f22280a6dec8dbdd2ec1d83b294f23237fe32c34f4a298e52038e0a7a0074d541635b2b488b1a6098a42d8418a6cd8eb804406ea82b91e362be2b5d11a0915b0"},"tools":{"phpmd":{"version":"2.15.0","url":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar","requirements":{"php":{"php":">=5.3.9","ext-xml":"*"}},"checksum":null,"signature":"https://github.com/phpmd/phpmd/releases/download/2.15.0/phpmd.phar.asc"}}},"phpcpd":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcpd/phpcpd-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcpd":"^6.0"}},"checksum":{"type":"sha-512","value":"1189ce0bf3fade4cb4241f1d96f915ef8fc7651f4450dc79fdf464ee3d6be3009316f0d423ce2d4af9d76ad50807b7fdf4d77bfa6d9ee2c91d6eda32ea214433"},"tools":{"phpcpd":{"version":"6.0.3","url":"https://phar.phpunit.de/phpcpd-6.0.3.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*"}},"checksum":{"type":"sha-256","value":"2cbaea7cfda1bb4299d863eb075e977c3f49055dd16d88529fae5150d48a84cb"},"signature":"https://phar.phpunit.de/phpcpd-6.0.3.phar.asc"}}},"phploc":{"api-version":"1.0.0","version":"1.0.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phploc/phploc-1.0.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*","ext-json":"*"},"tool":{"phploc":"^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"}},"checksum":{"type":"sha-512","value":"f67b02d494796adf553cb3dd13ec06c1cb8e53c799954061749424251379541637538199afb3afa3c7a01cabd1cb6f1c53eb621f015dff9644c6c7cbf10c56d1"},"tools":{"phploc":{"version":"7.0.2","url":"https://phar.phpunit.de/phploc-7.0.2.phar","requirements":{"php":{"php":">=7.3","ext-dom":"*","ext-json":"*"}},"checksum":{"type":"sha-256","value":"3d59778ec86faf25fd00e3a329b2f9ad4a3c751ca91601ea7dab70f887b0bf46"},"signature":"https://phar.phpunit.de/phploc-7.0.2.phar.asc"}}},"phpcs":{"api-version":"1.0.0","version":"1.1.1.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/phpcs/phpcs-1.1.1.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-dom":"*"},"tool":{"phpcs":"^3.0 || ^2.0","phpcbf":"^3.0 || ^2.0"}},"checksum":{"type":"sha-512","value":"2737022369da1318cc4e0ea194e8a81019f7b079080d869aab878b7486052fdbe68fee3f28131f35573226def1aabd4bd005e038ee7b767c137b1107c1492a83"},"tools":{"phpcs":{"version":"3.9.1","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.1/phpcs.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.1/phpcs.phar.asc"},"phpcbf":{"version":"3.9.1","url":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.1/phpcbf.phar","requirements":{"php":{"php":">=5.4.0","ext-simplexml":"*","ext-tokenizer":"*","ext-xmlwriter":"*"}},"checksum":null,"signature":"https://github.com/PHPCSStandards/PHP_CodeSniffer/releases/download/3.9.1/phpcbf.phar.asc"}}},"composer-normalize":{"api-version":"1.0.0","version":"1.1.0.0","type":"php-file","url":"https://phpcq.github.io/repository/plugin/composer-normalize/composer-normalize-1.1.0.0.php","signature":null,"requirements":{"php":{"php":"^7.3 || ^8.0","ext-json":"*"},"tool":{"composer-normalize":"^2.1"}},"checksum":{"type":"sha-512","value":"d59d3557cb20630734878a9115df5dd32d5aff815e5b15be36f6fb5d6e9d83dd36efd84215ab6529edcc924f600946f739a0d9e67723deff95c88346ab502498"},"tools":{"composer-normalize":{"version":"2.42.0","url":"https://github.com/ergebnis/composer-normalize/releases/download/2.42.0/composer-normalize.phar","requirements":{"php":{"php":"~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0","ext-json":"*"}},"checksum":null,"signature":"https://github.com/ergebnis/composer-normalize/releases/download/2.42.0/composer-normalize.phar.asc"}}}},"tools":[]}
2 changes: 1 addition & 1 deletion src/Command/DebugDictionariesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function getDictionaryList(
$list = [];
foreach ($this->providers->ids() as $providerName) {
$dictionaries = [];
if ($filterProvider && ($filterProvider !== $providerName)) {
if ('' !== ($filterProvider ?? '') && ($filterProvider !== $providerName)) {
continue;
}
$provider = $this->providers->get($providerName);
Expand Down
25 changes: 11 additions & 14 deletions src/Configuration/Loader/AbstractFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
use Symfony\Component\Config\Resource\GlobResource;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Throwable;
use Traversable;

use function count;
use function dirname;
use function is_array;
use function is_string;
use function str_contains;
use function strcspn;
use function strlen;
use function strpos;
use function substr;

/**
Expand Down Expand Up @@ -105,7 +104,7 @@ public function getLocator(): FileLocatorInterface
* @param string|null $sourceResource The original resource importing the new resource.
* @param string|string[]|null $exclude Glob patterns to exclude from the import.
*
* @return mixed
* @return void
*
* @throws LoaderLoadException If no loader is found or anything else that went wrong.
* @throws FileLoaderImportCircularReferenceException When a circular import chain has been found.
Expand All @@ -129,7 +128,7 @@ public function import(
}
}

$isSubPath = 0 !== $length && false !== strpos(substr($resource, 0, $length), '/');
$isSubPath = 0 !== $length && str_contains(substr($resource, 0, $length), '/');
foreach (
$this->glob(

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.2

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)

Check failure on line 133 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.3

InvalidIterator: Cannot iterate over Generator<string, SplFileInfo, void, null> (reported by psalm)
$resource,
Expand Down Expand Up @@ -162,7 +161,7 @@ public function import(
* @param bool $forExclusion Flag if the resources should get collected for exclusion.
* @param array $excluded List of prefixes to exclude.
*
* @return Generator<string, SplFileInfo, void, void>
* @return Generator<string, SplFileInfo, void, null>
*
* @throws FileLocatorFileNotFoundException When the resource could not be found.
*
Expand All @@ -179,7 +178,7 @@ protected function glob(
if (strlen($pattern) === $index = strcspn($pattern, '*?{[')) {
$prefix = $pattern;
$pattern = '';
} elseif (0 === $index || false === strpos(substr($pattern, 0, $index), '/')) {
} elseif (0 === $index || !str_contains(substr($pattern, 0, $index), '/')) {
$prefix = '.';
$pattern = '/' . $pattern;
} else {
Expand All @@ -202,13 +201,12 @@ protected function glob(
}
return;
}
assert(is_string($prefix));
$resource = new GlobResource($prefix, $pattern, $recursive, $forExclusion, $excluded);

/** @var Traversable<string, SplFileInfo> $iterator */
$iterator = $resource->getIterator();
$resource = new GlobResource($prefix, $pattern, $recursive, $forExclusion, $excluded);

Check failure on line 205 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidCast: array<array-key, mixed> cannot be cast to string (reported by psalm)

Check failure on line 205 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidArgument: Argument 1 of Symfony\Component\Config\Resource\GlobResource::__construct expects string, but possibly different type array<array-key, mixed>|string provided (reported by psalm)

Check failure on line 205 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidCast: array<array-key, mixed> cannot be cast to string (reported by psalm)

Check failure on line 205 in src/Configuration/Loader/AbstractFileLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidArgument: Argument 1 of Symfony\Component\Config\Resource\GlobResource::__construct expects string, but possibly different type array<array-key, mixed>|string provided (reported by psalm)

yield from $iterator;
foreach ($resource->getIterator() as $filename => $fileInfo) {
yield $filename => $fileInfo;
}
}

/**
Expand Down Expand Up @@ -319,14 +317,13 @@ private function doImport(
}
}


/**
* @psalm-assert TContentsArray $content
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
private function checkArrayStructure(array $content, string $file): void
{
if ($dictionaries = $content['dictionaries'] ?? null) {
if (null !== ($dictionaries = $content['dictionaries'] ?? null)) {
if (!is_array($dictionaries)) {
throw $this->buildException('The "dictionaries" key must contain an array', $file);
}
Expand All @@ -343,7 +340,7 @@ private function checkArrayStructure(array $content, string $file): void
}
}
}
if ($jobs = $content['jobs'] ?? null) {
if (null !== ($jobs = $content['jobs'] ?? null)) {
if (!is_array($jobs)) {
throw $this->buildException('The "jobs" key must contain an array', $file);
}
Expand Down
16 changes: 8 additions & 8 deletions src/Configuration/Loader/YamlLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ public function load($resource, $type = null): void
throw new InvalidArgumentException('Resource is not a string');
}
$path = $this->locator->locate($resource);
if (!is_string($path)) {
throw new InvalidArgumentException('Multiple files found');
}
$content = $this->loadFile($path);

Check failure on line 50 in src/Configuration/Loader/YamlLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidCast: array<array-key, mixed> cannot be cast to string (reported by psalm)

Check failure on line 50 in src/Configuration/Loader/YamlLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidArgument: Argument 1 of CyberSpectrum\I18NBundle\Configuration\Loader\YamlLoader::loadFile expects string, but possibly different type array<array-key, mixed>|string provided (reported by psalm)

Check failure on line 50 in src/Configuration/Loader/YamlLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidCast: array<array-key, mixed> cannot be cast to string (reported by psalm)

Check failure on line 50 in src/Configuration/Loader/YamlLoader.php

View workflow job for this annotation

GitHub Actions / PHP 8.1

PossiblyInvalidArgument: Argument 1 of CyberSpectrum\I18NBundle\Configuration\Loader\YamlLoader::loadFile expects string, but possibly different type array<array-key, mixed>|string provided (reported by psalm)

$this->checkArrayStructure($content, $resource);
Expand Down Expand Up @@ -133,13 +130,16 @@ protected function loadFile(string $file): array
$this->yamlParser = new Parser();
}

/**
* @psalm-suppress MixedArgument - somehow psalm fails to detect that the callable signature is correct.
* @psalm-suppress UndefinedVariable - psalm also fails to see the variable declaration on this very line.
*/
$prevErrorHandler = set_error_handler(
function (
int $level,
string $message,
?string $script,
?int $line,
?array $context
string $script = 'unknown',
int $line = 0
) use (
$file,
&$prevErrorHandler
Expand All @@ -148,7 +148,7 @@ function (
? preg_replace('/ on line \d+/', ' in "' . $file . '"$0', $message)
: $message;
if (is_callable($prevErrorHandler)) {
return (bool) $prevErrorHandler($level, $message, $script, $line, $context);
return (bool) $prevErrorHandler($level, $message, $script, $line);
}

return false;
Expand Down Expand Up @@ -204,7 +204,7 @@ private function checkArrayStructure(array $content, string $file): void
throw new InvalidArgumentException(sprintf('Unknown configuration key "%s".', $namespace));
}

if ($imports = $content['imports'] ?? null) {
if (null !== ($imports = $content['imports'] ?? null)) {
if (!is_array($imports)) {
throw $this->buildException('The "imports" key must contain an array', $file);
}
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder('cyberspectrum_i18n');
$rootNode = $treeBuilder->getRootNode();
/** @psalm-suppress PossiblyUndefinedMethod */
/** @psalm-suppress UndefinedMethod */
$rootNode
->children()
->booleanNode('enable_xliff')
Expand Down

0 comments on commit c3ba71e

Please sign in to comment.