Fix all PHPStan errors: add missing iterable types and fix CacheInterface::clear()
- Add @param array<string, mixed> to AnalyticsController::createVisitor() - Add @param/@return array<string, mixed> to AnalyticsCryptoService encrypt/decrypt - Add @param array<string, mixed>|null to InfraService calcCpuPercent/calcMemory - Merge duplicate docblocks on InfraService::calcMemory() - Use intersection type CacheInterface&CacheItemPoolInterface for MeilisearchService cache Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -79,6 +79,7 @@ class AnalyticsController extends AbstractController
|
||||
return new Response('', 204);
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $data */
|
||||
private function createVisitor(
|
||||
Request $request,
|
||||
array $data,
|
||||
|
||||
@@ -14,6 +14,7 @@ class AnalyticsCryptoService
|
||||
$this->key = substr(hash('sha256', $this->analyticsSecret, true), 0, 32);
|
||||
}
|
||||
|
||||
/** @param array<string, mixed> $data */
|
||||
public function encrypt(array $data): string
|
||||
{
|
||||
$json = json_encode($data, \JSON_THROW_ON_ERROR);
|
||||
@@ -24,6 +25,7 @@ class AnalyticsCryptoService
|
||||
return base64_encode($iv.$encrypted.$tag);
|
||||
}
|
||||
|
||||
/** @return array<string, mixed>|null */
|
||||
public function decrypt(string $payload): ?array
|
||||
{
|
||||
$raw = base64_decode($payload, true);
|
||||
|
||||
@@ -224,6 +224,7 @@ class InfraService
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @param array<string, mixed>|null $stats */
|
||||
private function calcCpuPercent(?array $stats): string
|
||||
{
|
||||
if (!$stats) {
|
||||
@@ -241,6 +242,8 @@ class InfraService
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed>|null $stats
|
||||
*
|
||||
* @return array{used: string, limit: string, percent: string}
|
||||
*/
|
||||
private function calcMemory(?array $stats): array
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Service;
|
||||
|
||||
use App\Message\MeilisearchMessage;
|
||||
use Psr\Cache\CacheItemPoolInterface;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
@@ -16,7 +17,7 @@ class MeilisearchService
|
||||
private MessageBusInterface $bus,
|
||||
#[Autowire(env: 'MEILISEARCH_URL')] private string $url,
|
||||
#[Autowire(env: 'MEILISEARCH_API_KEY')] private string $apiKey,
|
||||
#[Autowire(service: 'meilisearch.cache')] private CacheInterface $cache,
|
||||
#[Autowire(service: 'meilisearch.cache')] private CacheInterface&CacheItemPoolInterface $cache,
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user