Skip to content

Commit

Permalink
Merge pull request #1022 from spiral/psalm
Browse files Browse the repository at this point in the history
Fix Psalm issues
  • Loading branch information
butschster authored Dec 5, 2023
2 parents 4a2a096 + a450a2f commit 420cd3a
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 4 deletions.
4 changes: 4 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Rector\DeadCode\Rector\Property\RemoveUselessVarTagRector;
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php71\Rector\FuncCall\CountOnNullRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;

Expand Down Expand Up @@ -47,6 +48,9 @@
__DIR__ . '/src/Prototype/src/NodeVisitors/RemoveTrait.php',
__DIR__ . '/src/Logger/src/ListenerRegistry.php',
],
RemoveExtraParametersRector::class => [
__DIR__ . '/src/Boot/src/BootloadManager/AbstractBootloadManager.php',
],
]);

$config->import(LevelSetList::UP_TO_PHP_72);
Expand Down
1 change: 0 additions & 1 deletion src/AnnotatedRoutes/src/RouteLocatorListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public function finalize(): void
];
}

/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
\uasort($routes, static fn (array $route1, array $route2) => $route1['priority'] <=> $route2['priority']);

$this->configureRoutes($routes);
Expand Down
1 change: 0 additions & 1 deletion src/Core/src/Internal/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ private function resolveWithoutBinding(string $alias, array $parameters = [], st
*/
private function autowire(Ctx $ctx, array $arguments): object
{
/** @psalm-suppress NoValue, InvalidArrayOffset */
if (!(\class_exists($ctx->class) || (
\interface_exists($ctx->class)
&&
Expand Down
3 changes: 3 additions & 0 deletions src/Framework/Bootloader/Debug/LogCollectorBootloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public function init(
): void {
$listenerRegistry->addListener($logCollector);

/**
* @psalm-suppress InvalidArgument
*/
$debug->addStateCollector($logCollector);
$finalizer->addFinalizer([$logCollector, 'reset']);
}
Expand Down
2 changes: 2 additions & 0 deletions src/Framework/Console/Logger/DebugListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function withOutput(OutputInterface $output): self

/**
* Enable logging in console mode.
* @psalm-suppress InvalidReturnType, InvalidReturnStatement
*/
public function enable(): self
{
Expand All @@ -81,6 +82,7 @@ public function enable(): self

/**
* Disable displaying logs in console.
* @psalm-suppress InvalidReturnType, InvalidReturnStatement
*/
public function disable(): self
{
Expand Down
4 changes: 4 additions & 0 deletions src/Session/src/Handler/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function destroy(string $id): bool

/**
* @codeCoverageIgnore
* @psalm-suppress ParamNameMismatch
*/
public function gc(int $maxlifetime): int
{
Expand All @@ -44,6 +45,9 @@ public function gc(int $maxlifetime): int
return $maxlifetime;
}

/**
* @psalm-suppress ParamNameMismatch
*/
public function open(string $path, string $id): bool
{
return true;
Expand Down
6 changes: 6 additions & 0 deletions src/Session/src/Handler/NullHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,17 @@ public function destroy(string $id): bool
return true;
}

/**
* @psalm-suppress ParamNameMismatch
*/
public function gc(int $maxlifetime): int
{
return $maxlifetime;
}

/**
* @psalm-suppress ParamNameMismatch
*/
public function open(string $path, string $id): bool
{
return true;
Expand Down
2 changes: 0 additions & 2 deletions src/Stempler/src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
if (!\function_exists('inject')) {
/**
* Macro function to be replaced by the injected value.
*
* @psalm-suppress UnusedParam
*/
function inject(string $name, mixed $default = null): mixed
{
Expand Down
1 change: 1 addition & 0 deletions src/Tokenizer/src/Attribute/TargetAttribute.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public function filter(array $classes): \Generator

// If annotations are used, we need to use the annotation reader also
// It will slow down the process a bit, but it will allow us to use annotations
/** @psalm-suppress InternalClass */
$reader = $this->useAnnotations
? (new Factory())->create()
: new AttributeReader($this->namedArguments ? new NamedArgumentsInstantiator() : null);
Expand Down

0 comments on commit 420cd3a

Please sign in to comment.