mirror of
https://github.com/shlinkio/shlink.git
synced 2026-11-01 09:38:04 -06:00
Merge pull request #2680 from acelaya-forks/fix-static-checks
Fix static checks
This commit is contained in:
4 files changed
+54
-66
No files matched your search
+44
-56
@@ -258,18 +258,6 @@ code = "redundant-logical-operation"
|
||||
message = "Redundant `&&` operation: left operand is evaluated and right operand is always falsy."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/src/Command/ShortUrl/DeleteExpiredShortUrlsCommand.php"
|
||||
code = "redundant-condition"
|
||||
message = "Redundant condition"
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php"
|
||||
code = "invalid-array-element-key"
|
||||
message = "Cannot use spread operator on an iterable with key type `mixed`."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php"
|
||||
code = "less-specific-nested-return-statement"
|
||||
@@ -285,7 +273,7 @@ count = 1
|
||||
[[issues]]
|
||||
file = "module/CLI/src/Command/ShortUrl/ListShortUrlsCommand.php"
|
||||
code = "mixed-property-access"
|
||||
message = "Attempting to access a property on a non-object type (`mixed`)."
|
||||
message = "Attempting to access property `$total` on a non-object type (`mixed`)."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
@@ -462,6 +450,24 @@ code = "deprecated-class"
|
||||
message = 'Class `Shlinkio\Shlink\CLI\ApiKey\RoleResolver` is deprecated and should no longer be used.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/test/ApiKey/RoleResolverTest.php"
|
||||
code = "deprecated-property"
|
||||
message = 'Use of deprecated property `Shlinkio\Shlink\CLI\Command\Api\Input\ApiKeyInput::$authorOnly`.'
|
||||
count = 2
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/test/ApiKey/RoleResolverTest.php"
|
||||
code = "deprecated-property"
|
||||
message = 'Use of deprecated property `Shlinkio\Shlink\CLI\Command\Api\Input\ApiKeyInput::$domain`.'
|
||||
count = 3
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/test/ApiKey/RoleResolverTest.php"
|
||||
code = "deprecated-property"
|
||||
message = 'Use of deprecated property `Shlinkio\Shlink\CLI\Command\Api\Input\ApiKeyInput::$noOrphanVisits`.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/test/ApiKey/RoleResolverTest.php"
|
||||
code = "invalid-array-element-key"
|
||||
@@ -528,12 +534,24 @@ code = "invalid-return-statement"
|
||||
message = 'Invalid return type for function `ShlinkioTest\Shlink\CLI\Util\CliTestUtils::createCommandStub`: expected `PHPUnit\Framework\MockObject\Stub&Symfony\Component\Console\Command\Command`, but found `PHPUnit\Framework\MockObject\MockObject|PHPUnit\Framework\MockObject\Stub`.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/CLI/test/Util/CliTestUtils.php"
|
||||
code = "named-argument-not-allowed"
|
||||
message = 'Named arguments are not allowed for `PHPUnit\Framework\MockObject\Generator\Generator::testDouble`.'
|
||||
count = 3
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/array-utils.php"
|
||||
code = "mixed-argument"
|
||||
message = 'Invalid argument type for argument #2 of `callable`: expected `string|unknown-ref(Shlinkio\Shlink\Core\ArrayUtils\number)`, but found `mixed`.'
|
||||
count = 2
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/array-utils.php"
|
||||
code = "mixed-array-index"
|
||||
message = '''Invalid index type `mixed` used in array assignment on `array<array-key, ('R.shlinkio\shlink\core\arrayutils\map() extends mixed)>`.'''
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/array-utils.php"
|
||||
code = "mixed-assignment"
|
||||
@@ -606,24 +624,12 @@ code = "mixed-assignment"
|
||||
message = "Assigning `nonnull` type to a variable may lead to unexpected behavior."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/functions.php"
|
||||
code = "mixed-method-access"
|
||||
message = "Attempting to access a method on a non-object type (`nonnull`)."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/functions.php"
|
||||
code = "mixed-return-statement"
|
||||
message = 'Could not infer a precise return type for function `Shlinkio\Shlink\Core\enumSide`. Saw type `nonnull`.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/functions.php"
|
||||
code = "mixed-return-statement"
|
||||
message = 'Could not infer a precise return type for function `Shlinkio\Shlink\Core\generateRandomShortCode`. Saw type `mixed`.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/functions/functions.php"
|
||||
code = "mixed-return-statement"
|
||||
@@ -738,6 +744,12 @@ code = "deprecated-method"
|
||||
message = 'Call to deprecated method: `Doctrine\DBAL\Schema\Table::setPrimaryKey`.'
|
||||
count = 2
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/migrations/Version20240226214216.php"
|
||||
code = "mixed-array-index"
|
||||
message = "Invalid index type `mixed` used in array assignment on `array<array-key, int(2)|int(3)>`."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/migrations/Version20240226214216.php"
|
||||
code = "mixed-assignment"
|
||||
@@ -1638,30 +1650,6 @@ code = "less-specific-return-statement"
|
||||
message = 'Returned type `Doctrine\Common\Collections\ArrayCollection<array-key, Shlinkio\Shlink\Core\Tag\Entity\Tag>` is less specific than the declared return type `Doctrine\Common\Collections\Collection<int, Shlinkio\Shlink\Core\Tag\Entity\Tag>` for function `Shlinkio\Shlink\Core\ShortUrl\Resolver\PersistenceShortUrlRelationResolver::resolveTags`.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/src/ShortUrl/Resolver/PersistenceShortUrlRelationResolver.php"
|
||||
code = "mixed-assignment"
|
||||
message = "Assigning `mixed` type to a variable may lead to unexpected behavior."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/src/ShortUrl/Resolver/PersistenceShortUrlRelationResolver.php"
|
||||
code = "mixed-method-access"
|
||||
message = "Attempting to access a method on a non-object type (`mixed`)."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/src/ShortUrl/Resolver/PersistenceShortUrlRelationResolver.php"
|
||||
code = "property-type-coercion"
|
||||
message = 'A value of a less specific type `array<array-key, mixed>` is being assigned to property `$domainLocks` (array<string, Symfony\Component\Lock\SharedLockInterface>).'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/src/ShortUrl/Resolver/PersistenceShortUrlRelationResolver.php"
|
||||
code = "property-type-coercion"
|
||||
message = 'A value of a less specific type `array<array-key, mixed>` is being assigned to property `$tagLocks` (array<string, Symfony\Component\Lock\SharedLockInterface>).'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/src/ShortUrl/Resolver/PersistenceShortUrlRelationResolver.php"
|
||||
code = "redundant-docblock-type"
|
||||
@@ -1887,7 +1875,7 @@ count = 1
|
||||
[[issues]]
|
||||
file = "module/Core/src/Visit/Repository/VisitIterationRepository.php"
|
||||
code = "mixed-method-access"
|
||||
message = "Attempting to access a method on a non-object type (`mixed`)."
|
||||
message = "Attempting to call method `getId()` on a non-object type (`mixed`)."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
@@ -1962,12 +1950,6 @@ code = "less-specific-nested-argument-type"
|
||||
message = 'Argument type mismatch for argument #1 of `Shlinkio\Shlink\Core\Visit\VisitsTracker::trackVisit`: expected `(callable(Shlinkio\Shlink\Core\Visit\Model\Visitor): Shlinkio\Shlink\Core\Visit\Entity\Visit)`, but provided type `(callable(...mixed=): mixed)` is less specific.'
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/test-api/Action/RedirectTest.php"
|
||||
code = "invalid-array-element-key"
|
||||
message = "Invalid array key type."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/test-api/Action/RedirectTest.php"
|
||||
code = "invalid-iterator"
|
||||
@@ -1986,6 +1968,12 @@ code = "mixed-array-access"
|
||||
message = "Unsafe array access on type `mixed`."
|
||||
count = 3
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/test-api/Action/RedirectTest.php"
|
||||
code = "mixed-array-index"
|
||||
message = "Possibly invalid array key type."
|
||||
count = 1
|
||||
|
||||
[[issues]]
|
||||
file = "module/Core/test-api/Action/RedirectTest.php"
|
||||
code = "mixed-assignment"
|
||||
|
||||
@@ -49,11 +49,12 @@ class ListShortUrlsCommand extends Command
|
||||
$result = $this->renderPage($io, $columnsMap, $params, $paramsInput->all);
|
||||
$paramsInput->page += 1;
|
||||
|
||||
$continue = $result->hasNextPage()
|
||||
&& $io->confirm(
|
||||
sprintf('Continue with page <options=bold>%s</>?', $paramsInput->page),
|
||||
default: false,
|
||||
);
|
||||
$continue =
|
||||
$result->hasNextPage()
|
||||
&& $io->confirm(
|
||||
sprintf('Continue with page <options=bold>%s</>?', $paramsInput->page),
|
||||
default: false,
|
||||
);
|
||||
} while ($continue);
|
||||
|
||||
$io->newLine();
|
||||
|
||||
@@ -42,10 +42,7 @@ use const Shlinkio\Shlink\IP_ADDRESS_REQUEST_ATTRIBUTE;
|
||||
|
||||
function generateRandomShortCode(int $length, ShortUrlMode $mode = ShortUrlMode::STRICT): string
|
||||
{
|
||||
static $nanoIdClient;
|
||||
if ($nanoIdClient === null) {
|
||||
$nanoIdClient = new NanoidClient();
|
||||
}
|
||||
static $nanoIdClient = new NanoidClient();
|
||||
|
||||
$alphabet = $mode === ShortUrlMode::STRICT
|
||||
? '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
|
||||
@@ -114,7 +114,6 @@ class PersistenceShortUrlRelationResolver implements ShortUrlRelationResolverInt
|
||||
}
|
||||
|
||||
/**
|
||||
* /**
|
||||
* @param array<string, SharedLockInterface> $locks
|
||||
*/
|
||||
private function releaseLock(array &$locks, string $name): void
|
||||
@@ -134,6 +133,9 @@ class PersistenceShortUrlRelationResolver implements ShortUrlRelationResolverInt
|
||||
$this->releaseLocks($this->domainLocks);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, SharedLockInterface> $locks
|
||||
*/
|
||||
private function releaseLocks(array &$locks): void
|
||||
{
|
||||
foreach ($locks as $tagLock) {
|
||||
|
||||
Reference in new issue
Block a user