Fix all PHPStan level 6 errors
- Add missing use App\Entity\EmailTracking in MailerService - Add PHPDoc types for array params/returns in MeilisearchService, MeilisearchMessage, ViteAssetExtension - Remove redundant array_values() in UnsubscribeManager - Ignore Doctrine-managed $id property warnings in phpstan.neon Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,3 +4,10 @@ parameters:
|
||||
- src/
|
||||
excludePaths:
|
||||
- src/Kernel.php
|
||||
ignoreErrors:
|
||||
-
|
||||
message: '#Property App\\Entity\\(EmailTracking|MessengerLog|User)::\$id .* never assigned#'
|
||||
paths:
|
||||
- src/Entity/EmailTracking.php
|
||||
- src/Entity/MessengerLog.php
|
||||
- src/Entity/User.php
|
||||
|
||||
@@ -4,6 +4,9 @@ namespace App\Message;
|
||||
|
||||
class MeilisearchMessage
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $action,
|
||||
public readonly string $index,
|
||||
|
||||
@@ -8,6 +8,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Component\Mailer\Messenger\SendEmailMessage;
|
||||
use App\Entity\EmailTracking;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class MailerService
|
||||
|
||||
@@ -45,11 +45,17 @@ class MeilisearchService
|
||||
$this->bus->dispatch(new MeilisearchMessage('deleteIndex', $index));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $documents
|
||||
*/
|
||||
public function addDocuments(string $index, array $documents): void
|
||||
{
|
||||
$this->bus->dispatch(new MeilisearchMessage('addDocuments', $index, ['documents' => $documents]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<array<string, mixed>> $documents
|
||||
*/
|
||||
public function updateDocuments(string $index, array $documents): void
|
||||
{
|
||||
$this->bus->dispatch(new MeilisearchMessage('updateDocuments', $index, ['documents' => $documents]));
|
||||
@@ -60,16 +66,26 @@ class MeilisearchService
|
||||
$this->bus->dispatch(new MeilisearchMessage('deleteDocument', $index, ['documentId' => $documentId]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string|int> $ids
|
||||
*/
|
||||
public function deleteDocuments(string $index, array $ids): void
|
||||
{
|
||||
$this->bus->dispatch(new MeilisearchMessage('deleteDocuments', $index, ['ids' => $ids]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $settings
|
||||
*/
|
||||
public function updateSettings(string $index, array $settings): void
|
||||
{
|
||||
$this->bus->dispatch(new MeilisearchMessage('updateSettings', $index, ['settings' => $settings]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $options
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function search(string $index, string $query, array $options = []): array
|
||||
{
|
||||
return $this->request('POST', "/indexes/{$index}/search", array_merge([
|
||||
@@ -77,11 +93,18 @@ class MeilisearchService
|
||||
], $options));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function getDocument(string $index, string|int $documentId): array
|
||||
{
|
||||
return $this->request('GET', "/indexes/{$index}/documents/{$documentId}");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed>|null $body
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function request(string $method, string $path, ?array $body = null): array
|
||||
{
|
||||
$options = [
|
||||
|
||||
@@ -69,6 +69,6 @@ class UnsubscribeManager
|
||||
mkdir($dir, 0o755, true);
|
||||
}
|
||||
|
||||
file_put_contents($this->storagePath, json_encode(array_values($hashes)), \LOCK_EX);
|
||||
file_put_contents($this->storagePath, json_encode($hashes), \LOCK_EX);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ use Nelmio\SecurityBundle\EventListener\ContentSecurityPolicyListener;
|
||||
class ViteAssetExtension extends AbstractExtension
|
||||
{
|
||||
const CACHE_KEY = 'vite_manifest';
|
||||
/** @var array<string, array<string, mixed>>|null */
|
||||
private ?array $manifestData = null;
|
||||
private readonly bool $isDev;
|
||||
|
||||
@@ -22,6 +23,7 @@ class ViteAssetExtension extends AbstractExtension
|
||||
$this->isDev = $_ENV['VITE_LOAD'] === "0";
|
||||
}
|
||||
|
||||
/** @return list<TwigFunction> */
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
@@ -60,11 +62,17 @@ class ViteAssetExtension extends AbstractExtension
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $deps
|
||||
*/
|
||||
public function asset(string $entry, array $deps = []): string
|
||||
{
|
||||
return $this->isDev ? $this->assetDev($entry, $deps) : $this->assetProd($entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $deps
|
||||
*/
|
||||
public function assetDev(string $entry, array $deps): string
|
||||
{
|
||||
$nonce = $this->getNonce();
|
||||
|
||||
Reference in New Issue
Block a user