Skip to content

Commit a18464c

Browse files
committed
Fix PHPStan level 5 errors (batch 1)
- Change HasLaravelStyleCommand trait to use Application instead of ContainerInterface - this correctly reflects that the container in Hypervel is always an Application instance - Update RetryCommand to match the trait's Application type - Fix ScheduleListCommand to iterate over lines instead of passing array - Add ignore for Redis zadd signature mismatch (Hyperf proxy differs)
1 parent 6c100a7 commit a18464c

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

src/cache/src/RedisTagSet.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function addEntry(string $key, int $ttl = 0, ?string $updateWhen = null):
2525

2626
foreach ($this->tagIds() as $tagKey) {
2727
if ($updateWhen) {
28-
$this->store->connection()->zadd($this->store->getPrefix() . $tagKey, $updateWhen, $ttl, $key);
28+
$this->store->connection()->zadd($this->store->getPrefix() . $tagKey, $updateWhen, $ttl, $key); // @phpstan-ignore argument.type
2929
} else {
3030
$this->store->connection()->zadd($this->store->getPrefix() . $tagKey, $ttl, $key);
3131
}

src/console/src/Commands/ScheduleListCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public function handle()
7373
return $this->listEvent($event, $terminalWidth, $expressionSpacing, $repeatExpressionSpacing, $timezone);
7474
});
7575

76-
$this->line(
77-
$events->flatten()->filter()->prepend('')->push('')->toArray()
78-
);
76+
foreach ($events->flatten()->filter()->prepend('')->push('')->toArray() as $line) {
77+
$this->line($line);
78+
}
7979
}
8080

8181
/**

src/queue/src/Console/RetryCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
use Hyperf\Collection\Collection;
1111
use Hyperf\Command\Command;
1212
use Hypervel\Encryption\Contracts\Encrypter;
13+
use Hypervel\Foundation\Contracts\Application;
1314
use Hypervel\Queue\Contracts\Factory as QueueFactory;
1415
use Hypervel\Queue\Events\JobRetryRequested;
1516
use Hypervel\Queue\Failed\FailedJobProviderInterface;
1617
use Hypervel\Support\Traits\HasLaravelStyleCommand;
17-
use Psr\Container\ContainerInterface;
1818
use Psr\EventDispatcher\EventDispatcherInterface;
1919
use RuntimeException;
2020
use stdClass;
@@ -40,7 +40,7 @@ class RetryCommand extends Command
4040
* Create a new queue restart command.
4141
*/
4242
public function __construct(
43-
protected ContainerInterface $app,
43+
protected Application $app,
4444
protected FailedJobProviderInterface $failer
4545
) {
4646
parent::__construct();

src/support/src/Traits/HasLaravelStyleCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@
66

77
use Hyperf\Context\ApplicationContext;
88
use Hypervel\Foundation\Console\Contracts\Kernel as KernelContract;
9-
use Psr\Container\ContainerInterface;
9+
use Hypervel\Foundation\Contracts\Application;
1010

1111
trait HasLaravelStyleCommand
1212
{
13-
protected ContainerInterface $app;
13+
protected Application $app;
1414

1515
public function __construct(?string $name = null)
1616
{
1717
parent::__construct($name);
1818

19-
$this->app = ApplicationContext::getContainer();
19+
/** @var Application $app */
20+
$app = ApplicationContext::getContainer();
21+
$this->app = $app;
2022
}
2123

2224
/**

0 commit comments

Comments
 (0)