diff --git a/src/agent/src/Agent.php b/src/agent/src/Agent.php index 3e267552a..c51714bc2 100644 --- a/src/agent/src/Agent.php +++ b/src/agent/src/Agent.php @@ -21,17 +21,17 @@ /** * @author Christopher Hertel */ -final readonly class Agent implements AgentInterface +final class Agent implements AgentInterface { /** * @var InputProcessorInterface[] */ - private array $inputProcessors; + private readonly array $inputProcessors; /** * @var OutputProcessorInterface[] */ - private array $outputProcessors; + private readonly array $outputProcessors; /** * @param InputProcessorInterface[] $inputProcessors @@ -39,11 +39,11 @@ * @param non-empty-string $model */ public function __construct( - private PlatformInterface $platform, - private string $model, + private readonly PlatformInterface $platform, + private readonly string $model, iterable $inputProcessors = [], iterable $outputProcessors = [], - private string $name = 'agent', + private readonly string $name = 'agent', ) { $this->inputProcessors = $this->initializeProcessors($inputProcessors, InputProcessorInterface::class); $this->outputProcessors = $this->initializeProcessors($outputProcessors, OutputProcessorInterface::class); diff --git a/src/agent/src/Attribute/AsInputProcessor.php b/src/agent/src/Attribute/AsInputProcessor.php index b21a4d0da..d8a2b2614 100644 --- a/src/agent/src/Attribute/AsInputProcessor.php +++ b/src/agent/src/Attribute/AsInputProcessor.php @@ -15,15 +15,15 @@ * @author Vincent Langlet */ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] -final readonly class AsInputProcessor +final class AsInputProcessor { /** * @param string|null $agent the service id of the agent which will use this processor, * null to register this processor for all existing agents */ public function __construct( - public ?string $agent = null, - public int $priority = 0, + public readonly ?string $agent = null, + public readonly int $priority = 0, ) { } } diff --git a/src/agent/src/Attribute/AsOutputProcessor.php b/src/agent/src/Attribute/AsOutputProcessor.php index c2fc770b7..4c79a3316 100644 --- a/src/agent/src/Attribute/AsOutputProcessor.php +++ b/src/agent/src/Attribute/AsOutputProcessor.php @@ -15,15 +15,15 @@ * @author Vincent Langlet */ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] -final readonly class AsOutputProcessor +final class AsOutputProcessor { /** * @param string|null $agent the service id of the agent which will use this processor, * null to register this processor for all existing agents */ public function __construct( - public ?string $agent = null, - public int $priority = 0, + public readonly ?string $agent = null, + public readonly int $priority = 0, ) { } } diff --git a/src/agent/src/InputProcessor/SystemPromptInputProcessor.php b/src/agent/src/InputProcessor/SystemPromptInputProcessor.php index 0f022cc40..fbe25c67d 100644 --- a/src/agent/src/InputProcessor/SystemPromptInputProcessor.php +++ b/src/agent/src/InputProcessor/SystemPromptInputProcessor.php @@ -26,17 +26,17 @@ /** * @author Christopher Hertel */ -final readonly class SystemPromptInputProcessor implements InputProcessorInterface +final class SystemPromptInputProcessor implements InputProcessorInterface { /** * @param \Stringable|TranslatableInterface|string|File $systemPrompt the system prompt to prepend to the input messages, or a File object to read from * @param ToolboxInterface|null $toolbox the tool box to be used to append the tool definitions to the system prompt */ public function __construct( - private \Stringable|TranslatableInterface|string|File $systemPrompt, - private ?ToolboxInterface $toolbox = null, - private ?TranslatorInterface $translator = null, - private LoggerInterface $logger = new NullLogger(), + private readonly \Stringable|TranslatableInterface|string|File $systemPrompt, + private readonly ?ToolboxInterface $toolbox = null, + private readonly ?TranslatorInterface $translator = null, + private readonly LoggerInterface $logger = new NullLogger(), ) { if ($this->systemPrompt instanceof TranslatableInterface && !$this->translator) { throw new RuntimeException('Translatable system prompt is not supported when no translator is provided.'); diff --git a/src/agent/src/Memory/EmbeddingProvider.php b/src/agent/src/Memory/EmbeddingProvider.php index e93a76fde..440f274d2 100644 --- a/src/agent/src/Memory/EmbeddingProvider.php +++ b/src/agent/src/Memory/EmbeddingProvider.php @@ -23,12 +23,12 @@ /** * @author Denis Zunke */ -final readonly class EmbeddingProvider implements MemoryProviderInterface +final class EmbeddingProvider implements MemoryProviderInterface { public function __construct( - private PlatformInterface $platform, - private Model $model, - private StoreInterface $vectorStore, + private readonly PlatformInterface $platform, + private readonly Model $model, + private readonly StoreInterface $vectorStore, ) { } diff --git a/src/agent/src/Memory/Memory.php b/src/agent/src/Memory/Memory.php index c8aae8414..7312b2fa9 100644 --- a/src/agent/src/Memory/Memory.php +++ b/src/agent/src/Memory/Memory.php @@ -14,10 +14,10 @@ /** * @author Denis Zunke */ -final readonly class Memory +final class Memory { public function __construct( - private string $content, + private readonly string $content, ) { } diff --git a/src/agent/src/Memory/MemoryInputProcessor.php b/src/agent/src/Memory/MemoryInputProcessor.php index 3a4eaee44..3d2b05799 100644 --- a/src/agent/src/Memory/MemoryInputProcessor.php +++ b/src/agent/src/Memory/MemoryInputProcessor.php @@ -18,7 +18,7 @@ /** * @author Denis Zunke */ -final readonly class MemoryInputProcessor implements InputProcessorInterface +final class MemoryInputProcessor implements InputProcessorInterface { private const MEMORY_PROMPT_MESSAGE = << */ -final readonly class StaticMemoryProvider implements MemoryProviderInterface +final class StaticMemoryProvider implements MemoryProviderInterface { /** * @var array */ - private array $memory; + private readonly array $memory; public function __construct(string ...$memory) { diff --git a/src/agent/src/MultiAgent/Handoff.php b/src/agent/src/MultiAgent/Handoff.php index 0d815d44c..05a0f12c0 100644 --- a/src/agent/src/MultiAgent/Handoff.php +++ b/src/agent/src/MultiAgent/Handoff.php @@ -19,14 +19,14 @@ * * @author Oskar Stark */ -final readonly class Handoff +final class Handoff { /** * @param string[] $when Keywords or phrases that indicate this handoff */ public function __construct( - private AgentInterface $to, - private array $when, + private readonly AgentInterface $to, + private readonly array $when, ) { if ([] === $when) { throw new InvalidArgumentException('Handoff must have at least one "when" condition.'); diff --git a/src/agent/src/MultiAgent/Handoff/Decision.php b/src/agent/src/MultiAgent/Handoff/Decision.php index 84ea17be5..e81d55233 100644 --- a/src/agent/src/MultiAgent/Handoff/Decision.php +++ b/src/agent/src/MultiAgent/Handoff/Decision.php @@ -16,15 +16,15 @@ * * @author Oskar Stark */ -final readonly class Decision +final class Decision { /** * @param string $agentName The name of the selected agent, or empty string if no specific agent is selected * @param string $reasoning The reasoning behind the selection */ public function __construct( - private string $agentName, - private string $reasoning = 'No reasoning provided', + private readonly string $agentName, + private readonly string $reasoning = 'No reasoning provided', ) { } diff --git a/src/agent/src/Toolbox/Attribute/AsTool.php b/src/agent/src/Toolbox/Attribute/AsTool.php index 04811ac33..dfdc6a98b 100644 --- a/src/agent/src/Toolbox/Attribute/AsTool.php +++ b/src/agent/src/Toolbox/Attribute/AsTool.php @@ -15,12 +15,12 @@ * @author Christopher Hertel */ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)] -final readonly class AsTool +final class AsTool { public function __construct( - public string $name, - public string $description, - public string $method = '__invoke', + public readonly string $name, + public readonly string $description, + public readonly string $method = '__invoke', ) { } } diff --git a/src/agent/src/Toolbox/Event/ToolCallArgumentsResolved.php b/src/agent/src/Toolbox/Event/ToolCallArgumentsResolved.php index 03e5b0472..589e1857b 100644 --- a/src/agent/src/Toolbox/Event/ToolCallArgumentsResolved.php +++ b/src/agent/src/Toolbox/Event/ToolCallArgumentsResolved.php @@ -18,15 +18,15 @@ * * @author Valtteri R */ -final readonly class ToolCallArgumentsResolved +final class ToolCallArgumentsResolved { /** * @param array $arguments */ public function __construct( - private object $tool, - private Tool $metadata, - private array $arguments, + private readonly object $tool, + private readonly Tool $metadata, + private readonly array $arguments, ) { } diff --git a/src/agent/src/Toolbox/Event/ToolCallFailed.php b/src/agent/src/Toolbox/Event/ToolCallFailed.php index a5e6caf6e..715ea3a38 100644 --- a/src/agent/src/Toolbox/Event/ToolCallFailed.php +++ b/src/agent/src/Toolbox/Event/ToolCallFailed.php @@ -16,16 +16,16 @@ /** * Dispatched after successfully invoking a tool. */ -final readonly class ToolCallFailed +final class ToolCallFailed { /** * @param array $arguments */ public function __construct( - private object $tool, - private Tool $metadata, - private array $arguments, - private \Throwable $exception, + private readonly object $tool, + private readonly Tool $metadata, + private readonly array $arguments, + private readonly \Throwable $exception, ) { } diff --git a/src/agent/src/Toolbox/Event/ToolCallSucceeded.php b/src/agent/src/Toolbox/Event/ToolCallSucceeded.php index 3fe686d32..c64c27f00 100644 --- a/src/agent/src/Toolbox/Event/ToolCallSucceeded.php +++ b/src/agent/src/Toolbox/Event/ToolCallSucceeded.php @@ -17,16 +17,16 @@ /** * Dispatched after successfully invoking a tool. */ -final readonly class ToolCallSucceeded +final class ToolCallSucceeded { /** * @param array $arguments */ public function __construct( - private object $tool, - private Tool $metadata, - private array $arguments, - private ToolResult $result, + private readonly object $tool, + private readonly Tool $metadata, + private readonly array $arguments, + private readonly ToolResult $result, ) { } diff --git a/src/agent/src/Toolbox/FaultTolerantToolbox.php b/src/agent/src/Toolbox/FaultTolerantToolbox.php index 65964c6fb..3a424d73b 100644 --- a/src/agent/src/Toolbox/FaultTolerantToolbox.php +++ b/src/agent/src/Toolbox/FaultTolerantToolbox.php @@ -21,10 +21,10 @@ * * @author Christopher Hertel */ -final readonly class FaultTolerantToolbox implements ToolboxInterface +final class FaultTolerantToolbox implements ToolboxInterface { public function __construct( - private ToolboxInterface $innerToolbox, + private readonly ToolboxInterface $innerToolbox, ) { } diff --git a/src/agent/src/Toolbox/Source/Source.php b/src/agent/src/Toolbox/Source/Source.php index 599164afc..83c9a3fe7 100644 --- a/src/agent/src/Toolbox/Source/Source.php +++ b/src/agent/src/Toolbox/Source/Source.php @@ -11,12 +11,12 @@ namespace Symfony\AI\Agent\Toolbox\Source; -readonly class Source +class Source { public function __construct( - private string $name, - private string $reference, - private string $content, + private readonly string $name, + private readonly string $reference, + private readonly string $content, ) { } diff --git a/src/agent/src/Toolbox/Tool/Agent.php b/src/agent/src/Toolbox/Tool/Agent.php index cba0f85b3..217f53dd3 100644 --- a/src/agent/src/Toolbox/Tool/Agent.php +++ b/src/agent/src/Toolbox/Tool/Agent.php @@ -19,10 +19,10 @@ /** * @author Christopher Hertel */ -final readonly class Agent +final class Agent { public function __construct( - private AgentInterface $agent, + private readonly AgentInterface $agent, ) { } diff --git a/src/agent/src/Toolbox/Tool/Firecrawl.php b/src/agent/src/Toolbox/Tool/Firecrawl.php index ec5f2570c..20e2e9f73 100644 --- a/src/agent/src/Toolbox/Tool/Firecrawl.php +++ b/src/agent/src/Toolbox/Tool/Firecrawl.php @@ -23,12 +23,12 @@ #[AsTool('firecrawl_scrape', description: 'Allow to scrape website using url', method: 'scrape')] #[AsTool('firecrawl_crawl', description: 'Allow to crawl website using url', method: 'crawl')] #[AsTool('firecrawl_map', description: 'Allow to retrieve all urls from a website using url', method: 'map')] -final readonly class Firecrawl +final class Firecrawl { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private string $endpoint, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $endpoint, ) { } diff --git a/src/agent/src/Toolbox/Tool/Mapbox.php b/src/agent/src/Toolbox/Tool/Mapbox.php index 8caefd85c..3da0eeb37 100644 --- a/src/agent/src/Toolbox/Tool/Mapbox.php +++ b/src/agent/src/Toolbox/Tool/Mapbox.php @@ -20,11 +20,11 @@ */ #[AsTool(name: 'geocode', description: 'Convert addresses to coordinates using Mapbox Geocoding API', method: 'geocode')] #[AsTool(name: 'reverse_geocode', description: 'Convert coordinates to addresses using Mapbox Reverse Geocoding API', method: 'reverseGeocode')] -final readonly class Mapbox +final class Mapbox { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $accessToken, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $accessToken, ) { } diff --git a/src/agent/src/Toolbox/Tool/OpenMeteo.php b/src/agent/src/Toolbox/Tool/OpenMeteo.php index 6283614a9..d96768ace 100644 --- a/src/agent/src/Toolbox/Tool/OpenMeteo.php +++ b/src/agent/src/Toolbox/Tool/OpenMeteo.php @@ -20,7 +20,7 @@ */ #[AsTool(name: 'weather_current', description: 'get current weather for a location', method: 'current')] #[AsTool(name: 'weather_forecast', description: 'get weather forecast for a location', method: 'forecast')] -final readonly class OpenMeteo +final class OpenMeteo { private const WMO_CODES = [ 0 => 'Clear', @@ -54,7 +54,7 @@ ]; public function __construct( - private HttpClientInterface $httpClient, + private readonly HttpClientInterface $httpClient, ) { } diff --git a/src/agent/src/Toolbox/Tool/YouTubeTranscriber.php b/src/agent/src/Toolbox/Tool/YouTubeTranscriber.php index be81d1096..1257f017f 100644 --- a/src/agent/src/Toolbox/Tool/YouTubeTranscriber.php +++ b/src/agent/src/Toolbox/Tool/YouTubeTranscriber.php @@ -21,10 +21,10 @@ * @author Christopher Hertel */ #[AsTool('youtube_transcript', 'Fetches the transcript of a YouTube video')] -final readonly class YouTubeTranscriber +final class YouTubeTranscriber { public function __construct( - private HttpClientInterface $client, + private readonly HttpClientInterface $client, ) { if (!class_exists(TranscriptListFetcher::class)) { throw new LogicException('For using the YouTube transcription tool, the mrmysql/youtube-transcript package is required. Try running "composer require mrmysql/youtube-transcript".'); diff --git a/src/agent/src/Toolbox/ToolCallArgumentResolver.php b/src/agent/src/Toolbox/ToolCallArgumentResolver.php index 39c59aff8..1dac37cfb 100644 --- a/src/agent/src/Toolbox/ToolCallArgumentResolver.php +++ b/src/agent/src/Toolbox/ToolCallArgumentResolver.php @@ -25,12 +25,12 @@ /** * @author Valtteri R */ -final readonly class ToolCallArgumentResolver +final class ToolCallArgumentResolver { - private TypeResolver $typeResolver; + private readonly TypeResolver $typeResolver; public function __construct( - private DenormalizerInterface $denormalizer = new Serializer([new DateTimeNormalizer(), new ObjectNormalizer(), new ArrayDenormalizer()]), + private readonly DenormalizerInterface $denormalizer = new Serializer([new DateTimeNormalizer(), new ObjectNormalizer(), new ArrayDenormalizer()]), ?TypeResolver $typeResolver = null, ) { $this->typeResolver = $typeResolver ?? TypeResolver::create(); diff --git a/src/agent/src/Toolbox/ToolFactory/ChainFactory.php b/src/agent/src/Toolbox/ToolFactory/ChainFactory.php index 5fca2bc2a..17d0d1cde 100644 --- a/src/agent/src/Toolbox/ToolFactory/ChainFactory.php +++ b/src/agent/src/Toolbox/ToolFactory/ChainFactory.php @@ -17,12 +17,12 @@ /** * @author Christopher Hertel */ -final readonly class ChainFactory implements ToolFactoryInterface +final class ChainFactory implements ToolFactoryInterface { /** * @var list */ - private array $factories; + private readonly array $factories; /** * @param iterable $factories diff --git a/src/agent/src/Toolbox/ToolResult.php b/src/agent/src/Toolbox/ToolResult.php index 1481ed40c..41c5f99b3 100644 --- a/src/agent/src/Toolbox/ToolResult.php +++ b/src/agent/src/Toolbox/ToolResult.php @@ -17,15 +17,15 @@ /** * @author Christopher Hertel */ -final readonly class ToolResult +final class ToolResult { /** * @param Source[] $sources */ public function __construct( - private ToolCall $toolCall, - private mixed $result, - private array $sources = [], + private readonly ToolCall $toolCall, + private readonly mixed $result, + private readonly array $sources = [], ) { } diff --git a/src/agent/src/Toolbox/ToolResultConverter.php b/src/agent/src/Toolbox/ToolResultConverter.php index bab14798a..e585f3b7b 100644 --- a/src/agent/src/Toolbox/ToolResultConverter.php +++ b/src/agent/src/Toolbox/ToolResultConverter.php @@ -23,10 +23,10 @@ /** * @author Christopher Hertel */ -final readonly class ToolResultConverter +final class ToolResultConverter { public function __construct( - private SerializerInterface $serializer = new Serializer([new JsonSerializableNormalizer(), new DateTimeNormalizer(), new ObjectNormalizer()], [new JsonEncoder()]), + private readonly SerializerInterface $serializer = new Serializer([new JsonSerializableNormalizer(), new DateTimeNormalizer(), new ObjectNormalizer()], [new JsonEncoder()]), ) { } diff --git a/src/chat/src/Bridge/HttpFoundation/SessionStore.php b/src/chat/src/Bridge/HttpFoundation/SessionStore.php index 1e9994f4c..1eebed291 100644 --- a/src/chat/src/Bridge/HttpFoundation/SessionStore.php +++ b/src/chat/src/Bridge/HttpFoundation/SessionStore.php @@ -21,13 +21,13 @@ /** * @author Christopher Hertel */ -final readonly class SessionStore implements ManagedStoreInterface, MessageStoreInterface +final class SessionStore implements ManagedStoreInterface, MessageStoreInterface { - private SessionInterface $session; + private readonly SessionInterface $session; public function __construct( RequestStack $requestStack, - private string $sessionKey = 'messages', + private readonly string $sessionKey = 'messages', ) { if (!class_exists(RequestStack::class)) { throw new RuntimeException('For using the SessionStore as message store, the symfony/http-foundation package is required. Try running "composer require symfony/http-foundation".'); diff --git a/src/chat/src/Bridge/Local/CacheStore.php b/src/chat/src/Bridge/Local/CacheStore.php index 4dc59af9d..d54ed455b 100644 --- a/src/chat/src/Bridge/Local/CacheStore.php +++ b/src/chat/src/Bridge/Local/CacheStore.php @@ -20,12 +20,12 @@ /** * @author Christopher Hertel */ -final readonly class CacheStore implements ManagedStoreInterface, MessageStoreInterface +final class CacheStore implements ManagedStoreInterface, MessageStoreInterface { public function __construct( - private CacheItemPoolInterface $cache, - private string $cacheKey, - private int $ttl = 86400, + private readonly CacheItemPoolInterface $cache, + private readonly string $cacheKey, + private readonly int $ttl = 86400, ) { if (!interface_exists(CacheItemPoolInterface::class)) { throw new RuntimeException('For using the CacheStore as message store, a PSR-6 cache implementation is required. Try running "composer require symfony/cache" or another PSR-6 compatible cache.'); diff --git a/src/chat/src/Bridge/Meilisearch/MessageStore.php b/src/chat/src/Bridge/Meilisearch/MessageStore.php index 82a7a2119..911224784 100644 --- a/src/chat/src/Bridge/Meilisearch/MessageStore.php +++ b/src/chat/src/Bridge/Meilisearch/MessageStore.php @@ -37,14 +37,14 @@ /** * @author Guillaume Loulier */ -final readonly class MessageStore implements ManagedStoreInterface, MessageStoreInterface +final class MessageStore implements ManagedStoreInterface, MessageStoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private ClockInterface $clock, - private string $indexName = '_message_store_meilisearch', + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly ClockInterface $clock, + private readonly string $indexName = '_message_store_meilisearch', ) { if (!interface_exists(ClockInterface::class)) { throw new RuntimeException('For using Meilisearch as a message store , symfony/clock is required. Try running "composer require symfony/clock".'); diff --git a/src/chat/src/Bridge/Pogocache/MessageStore.php b/src/chat/src/Bridge/Pogocache/MessageStore.php index 4b95745d0..f6c0b21d3 100644 --- a/src/chat/src/Bridge/Pogocache/MessageStore.php +++ b/src/chat/src/Bridge/Pogocache/MessageStore.php @@ -34,13 +34,13 @@ /** * @author Guillaume Loulier */ -final readonly class MessageStore implements ManagedStoreInterface, MessageStoreInterface +final class MessageStore implements ManagedStoreInterface, MessageStoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $host, - #[\SensitiveParameter] private string $password, - private string $key = '_message_store_pogocache', + private readonly HttpClientInterface $httpClient, + private readonly string $host, + #[\SensitiveParameter] private readonly string $password, + private readonly string $key = '_message_store_pogocache', ) { } diff --git a/src/chat/src/Chat.php b/src/chat/src/Chat.php index 6673e93d2..153672f02 100644 --- a/src/chat/src/Chat.php +++ b/src/chat/src/Chat.php @@ -21,11 +21,11 @@ /** * @author Christopher Hertel */ -final readonly class Chat implements ChatInterface +final class Chat implements ChatInterface { public function __construct( - private AgentInterface $agent, - private MessageStoreInterface&ManagedStoreInterface $store, + private readonly AgentInterface $agent, + private readonly MessageStoreInterface&ManagedStoreInterface $store, ) { } diff --git a/src/mcp-bundle/src/Controller/McpController.php b/src/mcp-bundle/src/Controller/McpController.php index 3781a7976..54d19df3d 100644 --- a/src/mcp-bundle/src/Controller/McpController.php +++ b/src/mcp-bundle/src/Controller/McpController.php @@ -21,15 +21,15 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -final readonly class McpController +final class McpController { public function __construct( - private Server $server, - private HttpMessageFactoryInterface $httpMessageFactory, - private HttpFoundationFactoryInterface $httpFoundationFactory, - private ResponseFactoryInterface $responseFactory, - private StreamFactoryInterface $streamFactory, - private ?LoggerInterface $logger = null, + private readonly Server $server, + private readonly HttpMessageFactoryInterface $httpMessageFactory, + private readonly HttpFoundationFactoryInterface $httpFoundationFactory, + private readonly ResponseFactoryInterface $responseFactory, + private readonly StreamFactoryInterface $streamFactory, + private readonly ?LoggerInterface $logger = null, ) { } diff --git a/src/platform/src/Bridge/AiMlApi/Completions/ModelClient.php b/src/platform/src/Bridge/AiMlApi/Completions/ModelClient.php index e750eb5a6..640989c1e 100644 --- a/src/platform/src/Bridge/AiMlApi/Completions/ModelClient.php +++ b/src/platform/src/Bridge/AiMlApi/Completions/ModelClient.php @@ -20,12 +20,12 @@ /** * @author Tim Lochmüller */ -final readonly class EmbeddingsModelClient implements ModelClientInterface +final class EmbeddingsModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private string $baseUrl, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $baseUrl, ) { } diff --git a/src/platform/src/Bridge/Albert/GptModelClient.php b/src/platform/src/Bridge/Albert/GptModelClient.php index dcf047fa8..ae5040061 100644 --- a/src/platform/src/Bridge/Albert/GptModelClient.php +++ b/src/platform/src/Bridge/Albert/GptModelClient.php @@ -22,14 +22,14 @@ /** * @author Oskar Stark */ -final readonly class GptModelClient implements ModelClientInterface +final class GptModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private string $baseUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $baseUrl, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/Anthropic/Contract/AnthropicContract.php b/src/platform/src/Bridge/Anthropic/Contract/AnthropicContract.php index 76ca37fdb..b57a0057a 100644 --- a/src/platform/src/Bridge/Anthropic/Contract/AnthropicContract.php +++ b/src/platform/src/Bridge/Anthropic/Contract/AnthropicContract.php @@ -17,7 +17,7 @@ /** * @author Denis Zunke */ -final readonly class AnthropicContract extends Contract +final class AnthropicContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/Anthropic/ModelClient.php b/src/platform/src/Bridge/Anthropic/ModelClient.php index d1a2a6bea..ff4572fba 100644 --- a/src/platform/src/Bridge/Anthropic/ModelClient.php +++ b/src/platform/src/Bridge/Anthropic/ModelClient.php @@ -20,13 +20,13 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/Anthropic/PlatformFactory.php b/src/platform/src/Bridge/Anthropic/PlatformFactory.php index a4fe8a300..92c4e817a 100644 --- a/src/platform/src/Bridge/Anthropic/PlatformFactory.php +++ b/src/platform/src/Bridge/Anthropic/PlatformFactory.php @@ -22,7 +22,7 @@ /** * @author Christopher Hertel */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( #[\SensitiveParameter] string $apiKey, diff --git a/src/platform/src/Bridge/Azure/Meta/LlamaModelClient.php b/src/platform/src/Bridge/Azure/Meta/LlamaModelClient.php index b5f1b7eba..84cd2a280 100644 --- a/src/platform/src/Bridge/Azure/Meta/LlamaModelClient.php +++ b/src/platform/src/Bridge/Azure/Meta/LlamaModelClient.php @@ -20,12 +20,12 @@ /** * @author Christopher Hertel */ -final readonly class LlamaModelClient implements ModelClientInterface +final class LlamaModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $baseUrl, - #[\SensitiveParameter] private string $apiKey, + private readonly HttpClientInterface $httpClient, + private readonly string $baseUrl, + #[\SensitiveParameter] private readonly string $apiKey, ) { } diff --git a/src/platform/src/Bridge/Azure/Meta/LlamaResultConverter.php b/src/platform/src/Bridge/Azure/Meta/LlamaResultConverter.php index 28d1a4d0b..f9cf2226c 100644 --- a/src/platform/src/Bridge/Azure/Meta/LlamaResultConverter.php +++ b/src/platform/src/Bridge/Azure/Meta/LlamaResultConverter.php @@ -21,7 +21,7 @@ /** * @author Christopher Hertel */ -final readonly class LlamaResultConverter implements ResultConverterInterface +final class LlamaResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Azure/Meta/PlatformFactory.php b/src/platform/src/Bridge/Azure/Meta/PlatformFactory.php index 4071a516a..cbb528654 100644 --- a/src/platform/src/Bridge/Azure/Meta/PlatformFactory.php +++ b/src/platform/src/Bridge/Azure/Meta/PlatformFactory.php @@ -22,7 +22,7 @@ /** * @author Christopher Hertel */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( string $baseUrl, diff --git a/src/platform/src/Bridge/Azure/OpenAi/EmbeddingsModelClient.php b/src/platform/src/Bridge/Azure/OpenAi/EmbeddingsModelClient.php index 02189eb2d..86c1a67b8 100644 --- a/src/platform/src/Bridge/Azure/OpenAi/EmbeddingsModelClient.php +++ b/src/platform/src/Bridge/Azure/OpenAi/EmbeddingsModelClient.php @@ -22,16 +22,16 @@ /** * @author Christopher Hertel */ -final readonly class EmbeddingsModelClient implements ModelClientInterface +final class EmbeddingsModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $baseUrl, - private string $deployment, - private string $apiVersion, - #[\SensitiveParameter] private string $apiKey, + private readonly string $baseUrl, + private readonly string $deployment, + private readonly string $apiVersion, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); if (str_starts_with($this->baseUrl, 'http://')) { diff --git a/src/platform/src/Bridge/Azure/OpenAi/GptModelClient.php b/src/platform/src/Bridge/Azure/OpenAi/GptModelClient.php index d2429e644..e952c7f9f 100644 --- a/src/platform/src/Bridge/Azure/OpenAi/GptModelClient.php +++ b/src/platform/src/Bridge/Azure/OpenAi/GptModelClient.php @@ -22,16 +22,16 @@ /** * @author Christopher Hertel */ -final readonly class GptModelClient implements ModelClientInterface +final class GptModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $baseUrl, - private string $deployment, - private string $apiVersion, - #[\SensitiveParameter] private string $apiKey, + private readonly string $baseUrl, + private readonly string $deployment, + private readonly string $apiVersion, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); if (str_starts_with($this->baseUrl, 'http://')) { diff --git a/src/platform/src/Bridge/Azure/OpenAi/PlatformFactory.php b/src/platform/src/Bridge/Azure/OpenAi/PlatformFactory.php index 7089dff97..0ff04f960 100644 --- a/src/platform/src/Bridge/Azure/OpenAi/PlatformFactory.php +++ b/src/platform/src/Bridge/Azure/OpenAi/PlatformFactory.php @@ -26,7 +26,7 @@ /** * @author Christopher Hertel */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( string $baseUrl, diff --git a/src/platform/src/Bridge/Azure/OpenAi/WhisperModelClient.php b/src/platform/src/Bridge/Azure/OpenAi/WhisperModelClient.php index db402c022..b1656f60c 100644 --- a/src/platform/src/Bridge/Azure/OpenAi/WhisperModelClient.php +++ b/src/platform/src/Bridge/Azure/OpenAi/WhisperModelClient.php @@ -23,16 +23,16 @@ /** * @author Christopher Hertel */ -final readonly class WhisperModelClient implements ModelClientInterface +final class WhisperModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $baseUrl, - private string $deployment, - private string $apiVersion, - #[\SensitiveParameter] private string $apiKey, + private readonly string $baseUrl, + private readonly string $deployment, + private readonly string $apiVersion, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); if (str_starts_with($this->baseUrl, 'http://')) { diff --git a/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeModelClient.php b/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeModelClient.php index a2be5356a..1d47b7690 100644 --- a/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeModelClient.php +++ b/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeModelClient.php @@ -26,11 +26,11 @@ /** * @author Björn Altmann */ -final readonly class ClaudeModelClient implements ModelClientInterface +final class ClaudeModelClient implements ModelClientInterface { public function __construct( - private BedrockRuntimeClient $bedrockRuntimeClient, - private string $version = '2023-05-31', + private readonly BedrockRuntimeClient $bedrockRuntimeClient, + private readonly string $version = '2023-05-31', ) { } diff --git a/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeResultConverter.php b/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeResultConverter.php index 4fe27ad8d..61b49d0b1 100644 --- a/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeResultConverter.php +++ b/src/platform/src/Bridge/Bedrock/Anthropic/ClaudeResultConverter.php @@ -24,7 +24,7 @@ /** * @author Björn Altmann */ -final readonly class ClaudeResultConverter implements ResultConverterInterface +final class ClaudeResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Bedrock/PlatformFactory.php b/src/platform/src/Bridge/Bedrock/PlatformFactory.php index c8d7f6e57..2d7632fe0 100644 --- a/src/platform/src/Bridge/Bedrock/PlatformFactory.php +++ b/src/platform/src/Bridge/Bedrock/PlatformFactory.php @@ -30,7 +30,7 @@ /** * @author Björn Altmann */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( BedrockRuntimeClient $bedrockRuntimeClient = new BedrockRuntimeClient(), diff --git a/src/platform/src/Bridge/Bedrock/RawBedrockResult.php b/src/platform/src/Bridge/Bedrock/RawBedrockResult.php index c87243fcf..453eaaa25 100644 --- a/src/platform/src/Bridge/Bedrock/RawBedrockResult.php +++ b/src/platform/src/Bridge/Bedrock/RawBedrockResult.php @@ -18,10 +18,10 @@ /** * @author Christopher Hertel */ -final readonly class RawBedrockResult implements RawResultInterface +final class RawBedrockResult implements RawResultInterface { public function __construct( - private InvokeModelResponse $invokeModelResponse, + private readonly InvokeModelResponse $invokeModelResponse, ) { } diff --git a/src/platform/src/Bridge/Cerebras/ModelClient.php b/src/platform/src/Bridge/Cerebras/ModelClient.php index ac89d1e55..cdc14f103 100644 --- a/src/platform/src/Bridge/Cerebras/ModelClient.php +++ b/src/platform/src/Bridge/Cerebras/ModelClient.php @@ -21,13 +21,13 @@ /** * @author Junaid Farooq */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { if ('' === $apiKey) { throw new InvalidArgumentException('The API key must not be empty.'); diff --git a/src/platform/src/Bridge/Cerebras/PlatformFactory.php b/src/platform/src/Bridge/Cerebras/PlatformFactory.php index 02cf0d7a2..c5706812b 100644 --- a/src/platform/src/Bridge/Cerebras/PlatformFactory.php +++ b/src/platform/src/Bridge/Cerebras/PlatformFactory.php @@ -21,7 +21,7 @@ /** * @author Junaid Farooq */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( #[\SensitiveParameter] string $apiKey, diff --git a/src/platform/src/Bridge/Cerebras/ResultConverter.php b/src/platform/src/Bridge/Cerebras/ResultConverter.php index bfaa831e4..99d5f0f09 100644 --- a/src/platform/src/Bridge/Cerebras/ResultConverter.php +++ b/src/platform/src/Bridge/Cerebras/ResultConverter.php @@ -22,7 +22,7 @@ /** * @author Junaid Farooq */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(BaseModel $model): bool { diff --git a/src/platform/src/Bridge/DeepSeek/ModelClient.php b/src/platform/src/Bridge/DeepSeek/ModelClient.php index 5978ca05e..39d3625c0 100644 --- a/src/platform/src/Bridge/DeepSeek/ModelClient.php +++ b/src/platform/src/Bridge/DeepSeek/ModelClient.php @@ -20,13 +20,13 @@ /** * @author Oskar Stark */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/DeepSeek/PlatformFactory.php b/src/platform/src/Bridge/DeepSeek/PlatformFactory.php index f3f2abd9d..ce1d1334e 100644 --- a/src/platform/src/Bridge/DeepSeek/PlatformFactory.php +++ b/src/platform/src/Bridge/DeepSeek/PlatformFactory.php @@ -18,7 +18,7 @@ use Symfony\Component\HttpClient\EventSourceHttpClient; use Symfony\Contracts\HttpClient\HttpClientInterface; -final readonly class PlatformFactory +final class PlatformFactory { public static function create( #[\SensitiveParameter] string $apiKey, diff --git a/src/platform/src/Bridge/DockerModelRunner/Completions/ModelClient.php b/src/platform/src/Bridge/DockerModelRunner/Completions/ModelClient.php index 83c05dccc..940971dfb 100644 --- a/src/platform/src/Bridge/DockerModelRunner/Completions/ModelClient.php +++ b/src/platform/src/Bridge/DockerModelRunner/Completions/ModelClient.php @@ -21,13 +21,13 @@ /** * @author Mathieu Santostefano */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $hostUrl, + private readonly string $hostUrl, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/DockerModelRunner/Embeddings/ModelClient.php b/src/platform/src/Bridge/DockerModelRunner/Embeddings/ModelClient.php index e2d5ae812..56ed51690 100644 --- a/src/platform/src/Bridge/DockerModelRunner/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/DockerModelRunner/Embeddings/ModelClient.php @@ -20,11 +20,11 @@ /** * @author Mathieu Santostefano */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $hostUrl, + private readonly HttpClientInterface $httpClient, + private readonly string $hostUrl, ) { } diff --git a/src/platform/src/Bridge/ElevenLabs/Contract/AudioNormalizer.php b/src/platform/src/Bridge/ElevenLabs/Contract/AudioNormalizer.php index 75f68447b..fd83e83c5 100644 --- a/src/platform/src/Bridge/ElevenLabs/Contract/AudioNormalizer.php +++ b/src/platform/src/Bridge/ElevenLabs/Contract/AudioNormalizer.php @@ -17,7 +17,7 @@ /** * @author Guillaume Loulier */ -final readonly class AudioNormalizer implements NormalizerInterface +final class AudioNormalizer implements NormalizerInterface { public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool { diff --git a/src/platform/src/Bridge/ElevenLabs/Contract/ElevenLabsContract.php b/src/platform/src/Bridge/ElevenLabs/Contract/ElevenLabsContract.php index 32c06f509..fbe5fe108 100644 --- a/src/platform/src/Bridge/ElevenLabs/Contract/ElevenLabsContract.php +++ b/src/platform/src/Bridge/ElevenLabs/Contract/ElevenLabsContract.php @@ -17,7 +17,7 @@ /** * @author Guillaume Loulier */ -final readonly class ElevenLabsContract extends Contract +final class ElevenLabsContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/ElevenLabs/ElevenLabsClient.php b/src/platform/src/Bridge/ElevenLabs/ElevenLabsClient.php index 6ff61810c..f3d0cd55b 100644 --- a/src/platform/src/Bridge/ElevenLabs/ElevenLabsClient.php +++ b/src/platform/src/Bridge/ElevenLabs/ElevenLabsClient.php @@ -22,12 +22,12 @@ /** * @author Guillaume Loulier */ -final readonly class ElevenLabsClient implements ModelClientInterface +final class ElevenLabsClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private string $hostUrl = 'https://api.elevenlabs.io/v1', + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $hostUrl = 'https://api.elevenlabs.io/v1', ) { } diff --git a/src/platform/src/Bridge/ElevenLabs/ElevenLabsResultConverter.php b/src/platform/src/Bridge/ElevenLabs/ElevenLabsResultConverter.php index d5e60d931..70d561c4f 100644 --- a/src/platform/src/Bridge/ElevenLabs/ElevenLabsResultConverter.php +++ b/src/platform/src/Bridge/ElevenLabs/ElevenLabsResultConverter.php @@ -26,10 +26,10 @@ /** * @author Guillaume Loulier */ -final readonly class ElevenLabsResultConverter implements ResultConverterInterface +final class ElevenLabsResultConverter implements ResultConverterInterface { public function __construct( - private HttpClientInterface $httpClient, + private readonly HttpClientInterface $httpClient, ) { } diff --git a/src/platform/src/Bridge/ElevenLabs/PlatformFactory.php b/src/platform/src/Bridge/ElevenLabs/PlatformFactory.php index bd4898681..a1ed7249d 100644 --- a/src/platform/src/Bridge/ElevenLabs/PlatformFactory.php +++ b/src/platform/src/Bridge/ElevenLabs/PlatformFactory.php @@ -22,7 +22,7 @@ /** * @author Guillaume Loulier */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( string $apiKey, diff --git a/src/platform/src/Bridge/Gemini/Contract/GeminiContract.php b/src/platform/src/Bridge/Gemini/Contract/GeminiContract.php index cd92019af..670ea4380 100644 --- a/src/platform/src/Bridge/Gemini/Contract/GeminiContract.php +++ b/src/platform/src/Bridge/Gemini/Contract/GeminiContract.php @@ -17,7 +17,7 @@ /** * @author Denis Zunke */ -final readonly class GeminiContract extends Contract +final class GeminiContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/Gemini/Embeddings/ModelClient.php b/src/platform/src/Bridge/Gemini/Embeddings/ModelClient.php index d87d64d36..1bd527135 100644 --- a/src/platform/src/Bridge/Gemini/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/Gemini/Embeddings/ModelClient.php @@ -20,11 +20,11 @@ /** * @author Valtteri R */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, ) { } diff --git a/src/platform/src/Bridge/Gemini/Embeddings/ResultConverter.php b/src/platform/src/Bridge/Gemini/Embeddings/ResultConverter.php index 518c2ccff..1f858718f 100644 --- a/src/platform/src/Bridge/Gemini/Embeddings/ResultConverter.php +++ b/src/platform/src/Bridge/Gemini/Embeddings/ResultConverter.php @@ -22,7 +22,7 @@ /** * @author Valtteri R */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Gemini/Gemini/ModelClient.php b/src/platform/src/Bridge/Gemini/Gemini/ModelClient.php index 964083096..ed9c15c38 100644 --- a/src/platform/src/Bridge/Gemini/Gemini/ModelClient.php +++ b/src/platform/src/Bridge/Gemini/Gemini/ModelClient.php @@ -22,13 +22,13 @@ /** * @author Roy Garrido */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/Gemini/Gemini/ResultConverter.php b/src/platform/src/Bridge/Gemini/Gemini/ResultConverter.php index 4b81624d5..d69999378 100644 --- a/src/platform/src/Bridge/Gemini/Gemini/ResultConverter.php +++ b/src/platform/src/Bridge/Gemini/Gemini/ResultConverter.php @@ -29,7 +29,7 @@ /** * @author Roy Garrido */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public const OUTCOME_OK = 'OUTCOME_OK'; public const OUTCOME_FAILED = 'OUTCOME_FAILED'; diff --git a/src/platform/src/Bridge/Gemini/PlatformFactory.php b/src/platform/src/Bridge/Gemini/PlatformFactory.php index dfa35112d..584b8ab8e 100644 --- a/src/platform/src/Bridge/Gemini/PlatformFactory.php +++ b/src/platform/src/Bridge/Gemini/PlatformFactory.php @@ -26,7 +26,7 @@ /** * @author Roy Garrido */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( #[\SensitiveParameter] string $apiKey, diff --git a/src/platform/src/Bridge/HuggingFace/ModelClient.php b/src/platform/src/Bridge/HuggingFace/ModelClient.php index 56cb7870f..10b2240fb 100644 --- a/src/platform/src/Bridge/HuggingFace/ModelClient.php +++ b/src/platform/src/Bridge/HuggingFace/ModelClient.php @@ -20,14 +20,14 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $provider, - #[\SensitiveParameter] private string $apiKey, + private readonly string $provider, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/HuggingFace/Output/Classification.php b/src/platform/src/Bridge/HuggingFace/Output/Classification.php index 48775e270..7828ebdab 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/Classification.php +++ b/src/platform/src/Bridge/HuggingFace/Output/Classification.php @@ -14,11 +14,11 @@ /** * @author Christopher Hertel */ -final readonly class Classification +final class Classification { public function __construct( - public string $label, - public float $score, + public readonly string $label, + public readonly float $score, ) { } } diff --git a/src/platform/src/Bridge/HuggingFace/Output/DetectedObject.php b/src/platform/src/Bridge/HuggingFace/Output/DetectedObject.php index e81b07881..126003894 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/DetectedObject.php +++ b/src/platform/src/Bridge/HuggingFace/Output/DetectedObject.php @@ -14,15 +14,15 @@ /** * @author Christopher Hertel */ -final readonly class DetectedObject +final class DetectedObject { public function __construct( - public string $label, - public float $score, - public float $xmin, - public float $ymin, - public float $xmax, - public float $ymax, + public readonly string $label, + public readonly float $score, + public readonly float $xmin, + public readonly float $ymin, + public readonly float $xmax, + public readonly float $ymax, ) { } } diff --git a/src/platform/src/Bridge/HuggingFace/Output/ImageSegment.php b/src/platform/src/Bridge/HuggingFace/Output/ImageSegment.php index 327942151..286c85911 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/ImageSegment.php +++ b/src/platform/src/Bridge/HuggingFace/Output/ImageSegment.php @@ -14,12 +14,12 @@ /** * @author Christopher Hertel */ -final readonly class ImageSegment +final class ImageSegment { public function __construct( - public string $label, - public ?float $score, - public string $mask, + public readonly string $label, + public readonly ?float $score, + public readonly string $mask, ) { } } diff --git a/src/platform/src/Bridge/HuggingFace/Output/MaskFill.php b/src/platform/src/Bridge/HuggingFace/Output/MaskFill.php index 242ead4ee..6951f272c 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/MaskFill.php +++ b/src/platform/src/Bridge/HuggingFace/Output/MaskFill.php @@ -14,13 +14,13 @@ /** * @author Christopher Hertel */ -final readonly class MaskFill +final class MaskFill { public function __construct( - public int $token, - public string $tokenStr, - public string $sequence, - public float $score, + public readonly int $token, + public readonly string $tokenStr, + public readonly string $sequence, + public readonly float $score, ) { } } diff --git a/src/platform/src/Bridge/HuggingFace/Output/QuestionAnsweringResult.php b/src/platform/src/Bridge/HuggingFace/Output/QuestionAnsweringResult.php index 67015b4a4..dcce5aba0 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/QuestionAnsweringResult.php +++ b/src/platform/src/Bridge/HuggingFace/Output/QuestionAnsweringResult.php @@ -14,13 +14,13 @@ /** * @author Christopher Hertel */ -final readonly class QuestionAnsweringResult +final class QuestionAnsweringResult { public function __construct( - public string $answer, - public int $startIndex, - public int $endIndex, - public float $score, + public readonly string $answer, + public readonly int $startIndex, + public readonly int $endIndex, + public readonly float $score, ) { } diff --git a/src/platform/src/Bridge/HuggingFace/Output/SentenceSimilarityResult.php b/src/platform/src/Bridge/HuggingFace/Output/SentenceSimilarityResult.php index a0dea8cd9..1ac9025d6 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/SentenceSimilarityResult.php +++ b/src/platform/src/Bridge/HuggingFace/Output/SentenceSimilarityResult.php @@ -14,13 +14,13 @@ /** * @author Christopher Hertel */ -final readonly class SentenceSimilarityResult +final class SentenceSimilarityResult { /** * @param array $similarities */ public function __construct( - public array $similarities, + public readonly array $similarities, ) { } diff --git a/src/platform/src/Bridge/HuggingFace/Output/TableQuestionAnsweringResult.php b/src/platform/src/Bridge/HuggingFace/Output/TableQuestionAnsweringResult.php index ac5ad45bc..e6d024d75 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/TableQuestionAnsweringResult.php +++ b/src/platform/src/Bridge/HuggingFace/Output/TableQuestionAnsweringResult.php @@ -14,16 +14,16 @@ /** * @author Christopher Hertel */ -final readonly class TableQuestionAnsweringResult +final class TableQuestionAnsweringResult { /** * @param array $cells * @param array $aggregator */ public function __construct( - public string $answer, - public array $cells = [], - public array $aggregator = [], + public readonly string $answer, + public readonly array $cells = [], + public readonly array $aggregator = [], ) { } diff --git a/src/platform/src/Bridge/HuggingFace/Output/Token.php b/src/platform/src/Bridge/HuggingFace/Output/Token.php index 3d1dd5465..213a11878 100644 --- a/src/platform/src/Bridge/HuggingFace/Output/Token.php +++ b/src/platform/src/Bridge/HuggingFace/Output/Token.php @@ -14,14 +14,14 @@ /** * @author Christopher Hertel */ -final readonly class Token +final class Token { public function __construct( - public string $entityGroup, - public float $score, - public string $word, - public int $start, - public int $end, + public readonly string $entityGroup, + public readonly float $score, + public readonly string $word, + public readonly int $start, + public readonly int $end, ) { } } diff --git a/src/platform/src/Bridge/HuggingFace/PlatformFactory.php b/src/platform/src/Bridge/HuggingFace/PlatformFactory.php index 63fb23f7b..e9303416e 100644 --- a/src/platform/src/Bridge/HuggingFace/PlatformFactory.php +++ b/src/platform/src/Bridge/HuggingFace/PlatformFactory.php @@ -22,7 +22,7 @@ /** * @author Christopher Hertel */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( #[\SensitiveParameter] string $apiKey, diff --git a/src/platform/src/Bridge/HuggingFace/ResultConverter.php b/src/platform/src/Bridge/HuggingFace/ResultConverter.php index 8a2dd7eee..ac63843ea 100644 --- a/src/platform/src/Bridge/HuggingFace/ResultConverter.php +++ b/src/platform/src/Bridge/HuggingFace/ResultConverter.php @@ -36,7 +36,7 @@ /** * @author Christopher Hertel */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/LmStudio/Completions/ModelClient.php b/src/platform/src/Bridge/LmStudio/Completions/ModelClient.php index 80abef08c..8b6af2d8b 100644 --- a/src/platform/src/Bridge/LmStudio/Completions/ModelClient.php +++ b/src/platform/src/Bridge/LmStudio/Completions/ModelClient.php @@ -21,13 +21,13 @@ /** * @author André Lubian */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $hostUrl, + private readonly string $hostUrl, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/LmStudio/Embeddings/ModelClient.php b/src/platform/src/Bridge/LmStudio/Embeddings/ModelClient.php index f6208e437..be1bbbe48 100644 --- a/src/platform/src/Bridge/LmStudio/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/LmStudio/Embeddings/ModelClient.php @@ -21,11 +21,11 @@ * @author Christopher Hertel * @author André Lubian */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $hostUrl, + private readonly HttpClientInterface $httpClient, + private readonly string $hostUrl, ) { } diff --git a/src/platform/src/Bridge/Mistral/Embeddings/ModelClient.php b/src/platform/src/Bridge/Mistral/Embeddings/ModelClient.php index f2d3e2228..4a5e5e993 100644 --- a/src/platform/src/Bridge/Mistral/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/Mistral/Embeddings/ModelClient.php @@ -21,13 +21,13 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/Mistral/Embeddings/ResultConverter.php b/src/platform/src/Bridge/Mistral/Embeddings/ResultConverter.php index 182e524ce..af5de3547 100644 --- a/src/platform/src/Bridge/Mistral/Embeddings/ResultConverter.php +++ b/src/platform/src/Bridge/Mistral/Embeddings/ResultConverter.php @@ -23,7 +23,7 @@ /** * @author Christopher Hertel */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Mistral/Llm/ModelClient.php b/src/platform/src/Bridge/Mistral/Llm/ModelClient.php index be4809e25..ebc4dc469 100644 --- a/src/platform/src/Bridge/Mistral/Llm/ModelClient.php +++ b/src/platform/src/Bridge/Mistral/Llm/ModelClient.php @@ -21,13 +21,13 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/Mistral/Llm/ResultConverter.php b/src/platform/src/Bridge/Mistral/Llm/ResultConverter.php index 9fb26386f..987d8b9c4 100644 --- a/src/platform/src/Bridge/Mistral/Llm/ResultConverter.php +++ b/src/platform/src/Bridge/Mistral/Llm/ResultConverter.php @@ -27,7 +27,7 @@ /** * @author Christopher Hertel */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Ollama/Contract/OllamaContract.php b/src/platform/src/Bridge/Ollama/Contract/OllamaContract.php index 345778c42..a324ee811 100644 --- a/src/platform/src/Bridge/Ollama/Contract/OllamaContract.php +++ b/src/platform/src/Bridge/Ollama/Contract/OllamaContract.php @@ -17,7 +17,7 @@ /** * @author Joshua Behrens */ -final readonly class OllamaContract extends Contract +final class OllamaContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/Ollama/OllamaClient.php b/src/platform/src/Bridge/Ollama/OllamaClient.php index f1220ed79..34238a8db 100644 --- a/src/platform/src/Bridge/Ollama/OllamaClient.php +++ b/src/platform/src/Bridge/Ollama/OllamaClient.php @@ -20,11 +20,11 @@ /** * @author Christopher Hertel */ -final readonly class OllamaClient implements ModelClientInterface +final class OllamaClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $hostUrl, + private readonly HttpClientInterface $httpClient, + private readonly string $hostUrl, ) { } diff --git a/src/platform/src/Bridge/Ollama/OllamaMessageChunk.php b/src/platform/src/Bridge/Ollama/OllamaMessageChunk.php index 5224172c2..aa2a0c50d 100644 --- a/src/platform/src/Bridge/Ollama/OllamaMessageChunk.php +++ b/src/platform/src/Bridge/Ollama/OllamaMessageChunk.php @@ -14,16 +14,16 @@ /** * @author Shaun Johnston */ -final readonly class OllamaMessageChunk +final class OllamaMessageChunk { /** * @param array $message */ public function __construct( - public string $model, - public \DateTimeImmutable $created_at, - public array $message, - public bool $done, + public readonly string $model, + public readonly \DateTimeImmutable $created_at, + public readonly array $message, + public readonly bool $done, ) { } diff --git a/src/platform/src/Bridge/Ollama/OllamaResultConverter.php b/src/platform/src/Bridge/Ollama/OllamaResultConverter.php index bc41e768d..998d90fd0 100644 --- a/src/platform/src/Bridge/Ollama/OllamaResultConverter.php +++ b/src/platform/src/Bridge/Ollama/OllamaResultConverter.php @@ -26,7 +26,7 @@ /** * @author Christopher Hertel */ -final readonly class OllamaResultConverter implements ResultConverterInterface +final class OllamaResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/OpenAi/AbstractModelClient.php b/src/platform/src/Bridge/OpenAi/AbstractModelClient.php index 748ae5a20..93a53ea6a 100644 --- a/src/platform/src/Bridge/OpenAi/AbstractModelClient.php +++ b/src/platform/src/Bridge/OpenAi/AbstractModelClient.php @@ -16,7 +16,7 @@ /** * @author Oskar Stark */ -abstract readonly class AbstractModelClient +abstract class AbstractModelClient { protected static function getBaseUrl(?string $region): string { diff --git a/src/platform/src/Bridge/OpenAi/Contract/OpenAiContract.php b/src/platform/src/Bridge/OpenAi/Contract/OpenAiContract.php index 06aa90038..5aa4f13fa 100644 --- a/src/platform/src/Bridge/OpenAi/Contract/OpenAiContract.php +++ b/src/platform/src/Bridge/OpenAi/Contract/OpenAiContract.php @@ -18,7 +18,7 @@ /** * @author Guillermo Lengemann */ -final readonly class OpenAiContract extends Contract +final class OpenAiContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/OpenAi/DallE/Base64Image.php b/src/platform/src/Bridge/OpenAi/DallE/Base64Image.php index f5eb9f37c..9305b3dbd 100644 --- a/src/platform/src/Bridge/OpenAi/DallE/Base64Image.php +++ b/src/platform/src/Bridge/OpenAi/DallE/Base64Image.php @@ -16,10 +16,10 @@ /** * @author Denis Zunke */ -final readonly class Base64Image +final class Base64Image { public function __construct( - public string $encodedImage, + public readonly string $encodedImage, ) { if ('' === $encodedImage) { throw new InvalidArgumentException('The base64 encoded image generated must be given.'); diff --git a/src/platform/src/Bridge/OpenAi/DallE/ModelClient.php b/src/platform/src/Bridge/OpenAi/DallE/ModelClient.php index 7fc719f0d..11ed7a905 100644 --- a/src/platform/src/Bridge/OpenAi/DallE/ModelClient.php +++ b/src/platform/src/Bridge/OpenAi/DallE/ModelClient.php @@ -23,12 +23,12 @@ * * @author Denis Zunke */ -final readonly class ModelClient extends AbstractModelClient implements ModelClientInterface +final class ModelClient extends AbstractModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private ?string $region = null, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly ?string $region = null, ) { self::validateApiKey($apiKey); } diff --git a/src/platform/src/Bridge/OpenAi/DallE/ResultConverter.php b/src/platform/src/Bridge/OpenAi/DallE/ResultConverter.php index 21e239e2a..1a618cd82 100644 --- a/src/platform/src/Bridge/OpenAi/DallE/ResultConverter.php +++ b/src/platform/src/Bridge/OpenAi/DallE/ResultConverter.php @@ -23,7 +23,7 @@ * * @author Denis Zunke */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/OpenAi/DallE/UrlImage.php b/src/platform/src/Bridge/OpenAi/DallE/UrlImage.php index b1102201f..731d859bf 100644 --- a/src/platform/src/Bridge/OpenAi/DallE/UrlImage.php +++ b/src/platform/src/Bridge/OpenAi/DallE/UrlImage.php @@ -16,10 +16,10 @@ /** * @author Denis Zunke */ -final readonly class UrlImage +final class UrlImage { public function __construct( - public string $url, + public readonly string $url, ) { if ('' === $url) { throw new InvalidArgumentException('The image url must be given.'); diff --git a/src/platform/src/Bridge/OpenAi/Embeddings/ModelClient.php b/src/platform/src/Bridge/OpenAi/Embeddings/ModelClient.php index dc71020ee..c3208fbee 100644 --- a/src/platform/src/Bridge/OpenAi/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/OpenAi/Embeddings/ModelClient.php @@ -21,12 +21,12 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient extends AbstractModelClient implements ModelClientInterface +final class ModelClient extends AbstractModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private ?string $region = null, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly ?string $region = null, ) { self::validateApiKey($apiKey); } diff --git a/src/platform/src/Bridge/OpenAi/Gpt/ModelClient.php b/src/platform/src/Bridge/OpenAi/Gpt/ModelClient.php index 94034c1c1..5317e82c2 100644 --- a/src/platform/src/Bridge/OpenAi/Gpt/ModelClient.php +++ b/src/platform/src/Bridge/OpenAi/Gpt/ModelClient.php @@ -22,14 +22,14 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient extends AbstractModelClient implements ModelClientInterface +final class ModelClient extends AbstractModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private ?string $region = null, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly ?string $region = null, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); self::validateApiKey($apiKey); diff --git a/src/platform/src/Bridge/OpenAi/PlatformFactory.php b/src/platform/src/Bridge/OpenAi/PlatformFactory.php index 406f3eed1..946ed2ff9 100644 --- a/src/platform/src/Bridge/OpenAi/PlatformFactory.php +++ b/src/platform/src/Bridge/OpenAi/PlatformFactory.php @@ -22,7 +22,7 @@ /** * @author Christopher Hertel */ -final readonly class PlatformFactory +final class PlatformFactory { public const REGION_EU = 'EU'; public const REGION_US = 'US'; diff --git a/src/platform/src/Bridge/OpenAi/Whisper/ModelClient.php b/src/platform/src/Bridge/OpenAi/Whisper/ModelClient.php index 88db5fac7..c4d5f901d 100644 --- a/src/platform/src/Bridge/OpenAi/Whisper/ModelClient.php +++ b/src/platform/src/Bridge/OpenAi/Whisper/ModelClient.php @@ -21,12 +21,12 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient extends AbstractModelClient implements ModelClientInterface +final class ModelClient extends AbstractModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, - private ?string $region = null, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly ?string $region = null, ) { self::validateApiKey($apiKey); } diff --git a/src/platform/src/Bridge/OpenRouter/ModelClient.php b/src/platform/src/Bridge/OpenRouter/ModelClient.php index 3e2ffc71f..9b4b45540 100644 --- a/src/platform/src/Bridge/OpenRouter/ModelClient.php +++ b/src/platform/src/Bridge/OpenRouter/ModelClient.php @@ -21,13 +21,13 @@ /** * @author rglozman */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); if ('' === $apiKey) { diff --git a/src/platform/src/Bridge/OpenRouter/ResultConverter.php b/src/platform/src/Bridge/OpenRouter/ResultConverter.php index 79ab8b8c3..586b3d22d 100644 --- a/src/platform/src/Bridge/OpenRouter/ResultConverter.php +++ b/src/platform/src/Bridge/OpenRouter/ResultConverter.php @@ -21,7 +21,7 @@ /** * @author rglozman */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Perplexity/Contract/PerplexityContract.php b/src/platform/src/Bridge/Perplexity/Contract/PerplexityContract.php index d25cbe8f0..a94ec6948 100644 --- a/src/platform/src/Bridge/Perplexity/Contract/PerplexityContract.php +++ b/src/platform/src/Bridge/Perplexity/Contract/PerplexityContract.php @@ -17,7 +17,7 @@ /** * @author Mathieu Santostefano */ -final readonly class PerplexityContract extends Contract +final class PerplexityContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/Perplexity/ModelClient.php b/src/platform/src/Bridge/Perplexity/ModelClient.php index 8c11a94f6..f412ead24 100644 --- a/src/platform/src/Bridge/Perplexity/ModelClient.php +++ b/src/platform/src/Bridge/Perplexity/ModelClient.php @@ -22,13 +22,13 @@ /** * @author Mathieu Santostefano */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); diff --git a/src/platform/src/Bridge/Replicate/Client.php b/src/platform/src/Bridge/Replicate/Client.php index f3483352b..c5bbbc5d5 100644 --- a/src/platform/src/Bridge/Replicate/Client.php +++ b/src/platform/src/Bridge/Replicate/Client.php @@ -18,12 +18,12 @@ /** * @author Christopher Hertel */ -final readonly class Client +final class Client { public function __construct( - private HttpClientInterface $httpClient, - private ClockInterface $clock, - #[\SensitiveParameter] private string $apiKey, + private readonly HttpClientInterface $httpClient, + private readonly ClockInterface $clock, + #[\SensitiveParameter] private readonly string $apiKey, ) { } diff --git a/src/platform/src/Bridge/Replicate/LlamaModelClient.php b/src/platform/src/Bridge/Replicate/LlamaModelClient.php index 44dbb088e..9f84ee909 100644 --- a/src/platform/src/Bridge/Replicate/LlamaModelClient.php +++ b/src/platform/src/Bridge/Replicate/LlamaModelClient.php @@ -20,10 +20,10 @@ /** * @author Christopher Hertel */ -final readonly class LlamaModelClient implements ModelClientInterface +final class LlamaModelClient implements ModelClientInterface { public function __construct( - private Client $client, + private readonly Client $client, ) { } diff --git a/src/platform/src/Bridge/Replicate/LlamaResultConverter.php b/src/platform/src/Bridge/Replicate/LlamaResultConverter.php index 18bb24abb..8c5ff8cbf 100644 --- a/src/platform/src/Bridge/Replicate/LlamaResultConverter.php +++ b/src/platform/src/Bridge/Replicate/LlamaResultConverter.php @@ -22,7 +22,7 @@ /** * @author Christopher Hertel */ -final readonly class LlamaResultConverter implements ResultConverterInterface +final class LlamaResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Scaleway/Embeddings/ModelClient.php b/src/platform/src/Bridge/Scaleway/Embeddings/ModelClient.php index aa6186432..3072cfd0e 100644 --- a/src/platform/src/Bridge/Scaleway/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/Scaleway/Embeddings/ModelClient.php @@ -21,11 +21,11 @@ /** * @author Marcus Stöhr */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, ) { if ('' === $apiKey) { throw new InvalidArgumentException('The API key must not be empty.'); diff --git a/src/platform/src/Bridge/Scaleway/Embeddings/ResultConverter.php b/src/platform/src/Bridge/Scaleway/Embeddings/ResultConverter.php index 6a919afe4..97cdc6134 100644 --- a/src/platform/src/Bridge/Scaleway/Embeddings/ResultConverter.php +++ b/src/platform/src/Bridge/Scaleway/Embeddings/ResultConverter.php @@ -23,7 +23,7 @@ /** * @author Marcus Stöhr */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/Scaleway/Llm/ModelClient.php b/src/platform/src/Bridge/Scaleway/Llm/ModelClient.php index c18f15711..f6d59c1c2 100644 --- a/src/platform/src/Bridge/Scaleway/Llm/ModelClient.php +++ b/src/platform/src/Bridge/Scaleway/Llm/ModelClient.php @@ -21,13 +21,13 @@ /** * @author Marcus Stöhr */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + #[\SensitiveParameter] private readonly string $apiKey, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/TransformersPhp/ModelClient.php b/src/platform/src/Bridge/TransformersPhp/ModelClient.php index 1650dca5f..a41e38791 100644 --- a/src/platform/src/Bridge/TransformersPhp/ModelClient.php +++ b/src/platform/src/Bridge/TransformersPhp/ModelClient.php @@ -17,7 +17,7 @@ use function Codewithkyrian\Transformers\Pipelines\pipeline; -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Bridge/TransformersPhp/PlatformFactory.php b/src/platform/src/Bridge/TransformersPhp/PlatformFactory.php index 448d3ac7e..348533af0 100644 --- a/src/platform/src/Bridge/TransformersPhp/PlatformFactory.php +++ b/src/platform/src/Bridge/TransformersPhp/PlatformFactory.php @@ -20,7 +20,7 @@ /** * @author Christopher Hertel */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( ModelCatalogInterface $modelCatalog = new ModelCatalog(), diff --git a/src/platform/src/Bridge/TransformersPhp/RawPipelineResult.php b/src/platform/src/Bridge/TransformersPhp/RawPipelineResult.php index d785b13ae..79e7555df 100644 --- a/src/platform/src/Bridge/TransformersPhp/RawPipelineResult.php +++ b/src/platform/src/Bridge/TransformersPhp/RawPipelineResult.php @@ -17,10 +17,10 @@ /** * @author Christopher Hertel */ -final readonly class RawPipelineResult implements RawResultInterface +final class RawPipelineResult implements RawResultInterface { public function __construct( - private PipelineExecution $pipelineExecution, + private readonly PipelineExecution $pipelineExecution, ) { } diff --git a/src/platform/src/Bridge/VertexAi/Contract/GeminiContract.php b/src/platform/src/Bridge/VertexAi/Contract/GeminiContract.php index 3decac9e3..7b531ec3e 100644 --- a/src/platform/src/Bridge/VertexAi/Contract/GeminiContract.php +++ b/src/platform/src/Bridge/VertexAi/Contract/GeminiContract.php @@ -17,7 +17,7 @@ /** * @author Junaid Farooq */ -final readonly class GeminiContract extends Contract +final class GeminiContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/VertexAi/Embeddings/ModelClient.php b/src/platform/src/Bridge/VertexAi/Embeddings/ModelClient.php index fa637df97..8a0ae98da 100644 --- a/src/platform/src/Bridge/VertexAi/Embeddings/ModelClient.php +++ b/src/platform/src/Bridge/VertexAi/Embeddings/ModelClient.php @@ -20,12 +20,12 @@ /** * @author Junaid Farooq */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $location, - private string $projectId, + private readonly HttpClientInterface $httpClient, + private readonly string $location, + private readonly string $projectId, ) { } diff --git a/src/platform/src/Bridge/VertexAi/Embeddings/ResultConverter.php b/src/platform/src/Bridge/VertexAi/Embeddings/ResultConverter.php index 5e6d029f5..8c637170a 100644 --- a/src/platform/src/Bridge/VertexAi/Embeddings/ResultConverter.php +++ b/src/platform/src/Bridge/VertexAi/Embeddings/ResultConverter.php @@ -21,7 +21,7 @@ /** * @author Junaid Farooq */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(BaseModel $model): bool { diff --git a/src/platform/src/Bridge/VertexAi/Gemini/ModelClient.php b/src/platform/src/Bridge/VertexAi/Gemini/ModelClient.php index 9ffdb29a3..e8f7f802c 100644 --- a/src/platform/src/Bridge/VertexAi/Gemini/ModelClient.php +++ b/src/platform/src/Bridge/VertexAi/Gemini/ModelClient.php @@ -21,14 +21,14 @@ /** * @author Junaid Farooq */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { - private EventSourceHttpClient $httpClient; + private readonly EventSourceHttpClient $httpClient; public function __construct( HttpClientInterface $httpClient, - private string $location, - private string $projectId, + private readonly string $location, + private readonly string $projectId, ) { $this->httpClient = $httpClient instanceof EventSourceHttpClient ? $httpClient : new EventSourceHttpClient($httpClient); } diff --git a/src/platform/src/Bridge/VertexAi/Gemini/ResultConverter.php b/src/platform/src/Bridge/VertexAi/Gemini/ResultConverter.php index a02fa5836..16a70e391 100644 --- a/src/platform/src/Bridge/VertexAi/Gemini/ResultConverter.php +++ b/src/platform/src/Bridge/VertexAi/Gemini/ResultConverter.php @@ -29,7 +29,7 @@ /** * @author Junaid Farooq */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public const OUTCOME_OK = 'OUTCOME_OK'; public const OUTCOME_FAILED = 'OUTCOME_FAILED'; diff --git a/src/platform/src/Bridge/VertexAi/PlatformFactory.php b/src/platform/src/Bridge/VertexAi/PlatformFactory.php index 51bad139d..e80865edd 100644 --- a/src/platform/src/Bridge/VertexAi/PlatformFactory.php +++ b/src/platform/src/Bridge/VertexAi/PlatformFactory.php @@ -28,7 +28,7 @@ /** * @author Junaid Farooq */ -final readonly class PlatformFactory +final class PlatformFactory { public static function create( string $location, diff --git a/src/platform/src/Bridge/Voyage/Contract/VoyageContract.php b/src/platform/src/Bridge/Voyage/Contract/VoyageContract.php index 4919d7c89..911b3e390 100644 --- a/src/platform/src/Bridge/Voyage/Contract/VoyageContract.php +++ b/src/platform/src/Bridge/Voyage/Contract/VoyageContract.php @@ -19,7 +19,7 @@ use Symfony\AI\Platform\Contract; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -final readonly class VoyageContract extends Contract +final class VoyageContract extends Contract { public static function create(NormalizerInterface ...$normalizer): Contract { diff --git a/src/platform/src/Bridge/Voyage/ModelClient.php b/src/platform/src/Bridge/Voyage/ModelClient.php index 99bacca41..27ee31b73 100644 --- a/src/platform/src/Bridge/Voyage/ModelClient.php +++ b/src/platform/src/Bridge/Voyage/ModelClient.php @@ -20,11 +20,11 @@ /** * @author Christopher Hertel */ -final readonly class ModelClient implements ModelClientInterface +final class ModelClient implements ModelClientInterface { public function __construct( - private HttpClientInterface $httpClient, - #[\SensitiveParameter] private string $apiKey, + private readonly HttpClientInterface $httpClient, + #[\SensitiveParameter] private readonly string $apiKey, ) { } diff --git a/src/platform/src/Bridge/Voyage/ResultConverter.php b/src/platform/src/Bridge/Voyage/ResultConverter.php index 5882fd62d..e4619cf06 100644 --- a/src/platform/src/Bridge/Voyage/ResultConverter.php +++ b/src/platform/src/Bridge/Voyage/ResultConverter.php @@ -22,7 +22,7 @@ /** * @author Christopher Hertel */ -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function supports(Model $model): bool { diff --git a/src/platform/src/Contract.php b/src/platform/src/Contract.php index dc45f57a9..8fd92dc43 100644 --- a/src/platform/src/Contract.php +++ b/src/platform/src/Contract.php @@ -31,12 +31,12 @@ /** * @author Christopher Hertel */ -readonly class Contract +class Contract { public const CONTEXT_MODEL = 'model'; final public function __construct( - protected NormalizerInterface $normalizer, + protected readonly NormalizerInterface $normalizer, ) { } diff --git a/src/platform/src/Contract/JsonSchema/Attribute/With.php b/src/platform/src/Contract/JsonSchema/Attribute/With.php index cc311c5f4..651de14b1 100644 --- a/src/platform/src/Contract/JsonSchema/Attribute/With.php +++ b/src/platform/src/Contract/JsonSchema/Attribute/With.php @@ -17,7 +17,7 @@ * @author Oskar Stark */ #[\Attribute(\Attribute::TARGET_PARAMETER | \Attribute::TARGET_PROPERTY)] -final readonly class With +final class With { /** * @param list|null $enum @@ -25,32 +25,32 @@ */ public function __construct( // can be used by many types - public ?array $enum = null, - public string|int|array|null $const = null, + public readonly ?array $enum = null, + public readonly string|int|array|null $const = null, // string - public ?string $pattern = null, - public ?int $minLength = null, - public ?int $maxLength = null, + public readonly ?string $pattern = null, + public readonly ?int $minLength = null, + public readonly ?int $maxLength = null, // integer - public ?int $minimum = null, - public ?int $maximum = null, - public ?int $multipleOf = null, - public ?int $exclusiveMinimum = null, - public ?int $exclusiveMaximum = null, + public readonly ?int $minimum = null, + public readonly ?int $maximum = null, + public readonly ?int $multipleOf = null, + public readonly ?int $exclusiveMinimum = null, + public readonly ?int $exclusiveMaximum = null, // array - public ?int $minItems = null, - public ?int $maxItems = null, - public ?bool $uniqueItems = null, - public ?int $minContains = null, - public ?int $maxContains = null, + public readonly ?int $minItems = null, + public readonly ?int $maxItems = null, + public readonly ?bool $uniqueItems = null, + public readonly ?int $minContains = null, + public readonly ?int $maxContains = null, // object - public ?int $minProperties = null, - public ?int $maxProperties = null, - public ?bool $dependentRequired = null, + public readonly ?int $minProperties = null, + public readonly ?int $maxProperties = null, + public readonly ?bool $dependentRequired = null, ) { if (\is_array($enum)) { /* @phpstan-ignore-next-line function.alreadyNarrowedType */ diff --git a/src/platform/src/Contract/JsonSchema/DescriptionParser.php b/src/platform/src/Contract/JsonSchema/DescriptionParser.php index cdb8a3afb..2ad476438 100644 --- a/src/platform/src/Contract/JsonSchema/DescriptionParser.php +++ b/src/platform/src/Contract/JsonSchema/DescriptionParser.php @@ -14,7 +14,7 @@ /** * @author Christopher Hertel */ -final readonly class DescriptionParser +final class DescriptionParser { public function getDescription(\ReflectionProperty|\ReflectionParameter $reflector): string { diff --git a/src/platform/src/Contract/JsonSchema/Factory.php b/src/platform/src/Contract/JsonSchema/Factory.php index f8cb05840..43f5cba73 100644 --- a/src/platform/src/Contract/JsonSchema/Factory.php +++ b/src/platform/src/Contract/JsonSchema/Factory.php @@ -58,12 +58,12 @@ * @author Christopher Hertel * @author Oskar Stark */ -final readonly class Factory +final class Factory { - private TypeResolver $typeResolver; + private readonly TypeResolver $typeResolver; public function __construct( - private DescriptionParser $descriptionParser = new DescriptionParser(), + private readonly DescriptionParser $descriptionParser = new DescriptionParser(), ?TypeResolver $typeResolver = null, ) { $this->typeResolver = $typeResolver ?? TypeResolver::create(); diff --git a/src/platform/src/Message/Content/Audio.php b/src/platform/src/Message/Content/Audio.php index b7a5800c6..2552d139e 100644 --- a/src/platform/src/Message/Content/Audio.php +++ b/src/platform/src/Message/Content/Audio.php @@ -14,6 +14,6 @@ /** * @author Christopher Hertel */ -final readonly class Audio extends File +final class Audio extends File { } diff --git a/src/platform/src/Message/Content/Collection.php b/src/platform/src/Message/Content/Collection.php index e0316dd88..ddee6d949 100644 --- a/src/platform/src/Message/Content/Collection.php +++ b/src/platform/src/Message/Content/Collection.php @@ -11,12 +11,12 @@ namespace Symfony\AI\Platform\Message\Content; -final readonly class Collection implements ContentInterface +final class Collection implements ContentInterface { /** * @var ContentInterface[] */ - private array $content; + private readonly array $content; public function __construct(ContentInterface ...$content) { diff --git a/src/platform/src/Message/Content/Document.php b/src/platform/src/Message/Content/Document.php index d6bd91440..f27228679 100644 --- a/src/platform/src/Message/Content/Document.php +++ b/src/platform/src/Message/Content/Document.php @@ -14,6 +14,6 @@ /** * @author Christopher Hertel */ -final readonly class Document extends File +final class Document extends File { } diff --git a/src/platform/src/Message/Content/DocumentUrl.php b/src/platform/src/Message/Content/DocumentUrl.php index dea8507ca..365974189 100644 --- a/src/platform/src/Message/Content/DocumentUrl.php +++ b/src/platform/src/Message/Content/DocumentUrl.php @@ -14,10 +14,10 @@ /** * @author Christopher Hertel */ -final readonly class DocumentUrl implements ContentInterface +final class DocumentUrl implements ContentInterface { public function __construct( - private string $url, + private readonly string $url, ) { } diff --git a/src/platform/src/Message/Content/File.php b/src/platform/src/Message/Content/File.php index 73f0faa0b..9d638dc40 100644 --- a/src/platform/src/Message/Content/File.php +++ b/src/platform/src/Message/Content/File.php @@ -19,12 +19,12 @@ /** * @author Christopher Hertel */ -readonly class File implements ContentInterface +class File implements ContentInterface { final public function __construct( - private string|\Closure $data, - private string $format, - private ?string $path = null, + private readonly string|\Closure $data, + private readonly string $format, + private readonly ?string $path = null, ) { } diff --git a/src/platform/src/Message/Content/Image.php b/src/platform/src/Message/Content/Image.php index 1a98399e8..2c568dd58 100644 --- a/src/platform/src/Message/Content/Image.php +++ b/src/platform/src/Message/Content/Image.php @@ -14,6 +14,6 @@ /** * @author Denis Zunke */ -final readonly class Image extends File +final class Image extends File { } diff --git a/src/platform/src/Message/Content/ImageUrl.php b/src/platform/src/Message/Content/ImageUrl.php index 882e75837..6a6ffc167 100644 --- a/src/platform/src/Message/Content/ImageUrl.php +++ b/src/platform/src/Message/Content/ImageUrl.php @@ -14,10 +14,10 @@ /** * @author Christopher Hertel */ -final readonly class ImageUrl implements ContentInterface +final class ImageUrl implements ContentInterface { public function __construct( - private string $url, + private readonly string $url, ) { } diff --git a/src/platform/src/Message/Content/Text.php b/src/platform/src/Message/Content/Text.php index 362816c02..32d616ea9 100644 --- a/src/platform/src/Message/Content/Text.php +++ b/src/platform/src/Message/Content/Text.php @@ -14,10 +14,10 @@ /** * @author Denis Zunke */ -final readonly class Text implements ContentInterface +final class Text implements ContentInterface { public function __construct( - private string $text, + private readonly string $text, ) { } diff --git a/src/platform/src/Message/Message.php b/src/platform/src/Message/Message.php index ae0195339..eb384ea84 100644 --- a/src/platform/src/Message/Message.php +++ b/src/platform/src/Message/Message.php @@ -19,7 +19,7 @@ * @author Christopher Hertel * @author Denis Zunke */ -final readonly class Message +final class Message { // Disabled by default, just a bridge to the specific messages private function __construct() diff --git a/src/platform/src/Result/InMemoryRawResult.php b/src/platform/src/Result/InMemoryRawResult.php index a597757e6..6c737907d 100644 --- a/src/platform/src/Result/InMemoryRawResult.php +++ b/src/platform/src/Result/InMemoryRawResult.php @@ -16,16 +16,16 @@ * * @author Ramy Hakam */ -final readonly class InMemoryRawResult implements RawResultInterface +final class InMemoryRawResult implements RawResultInterface { /** * @param array $data * @param iterable> $dataStream */ public function __construct( - private array $data = [], - private iterable $dataStream = [], - private object $object = new \stdClass(), + private readonly array $data = [], + private readonly iterable $dataStream = [], + private readonly object $object = new \stdClass(), ) { } diff --git a/src/platform/src/Result/RawHttpResult.php b/src/platform/src/Result/RawHttpResult.php index 8459862fd..cf3ced922 100644 --- a/src/platform/src/Result/RawHttpResult.php +++ b/src/platform/src/Result/RawHttpResult.php @@ -18,10 +18,10 @@ /** * @author Christopher Hertel */ -final readonly class RawHttpResult implements RawResultInterface +final class RawHttpResult implements RawResultInterface { public function __construct( - private ResponseInterface $response, + private readonly ResponseInterface $response, ) { } diff --git a/src/platform/src/Result/ToolCall.php b/src/platform/src/Result/ToolCall.php index 86f5f32b5..0dfa3eb86 100644 --- a/src/platform/src/Result/ToolCall.php +++ b/src/platform/src/Result/ToolCall.php @@ -14,15 +14,15 @@ /** * @author Christopher Hertel */ -final readonly class ToolCall implements \JsonSerializable +final class ToolCall implements \JsonSerializable { /** * @param array $arguments */ public function __construct( - private string $id, - private string $name, - private array $arguments = [], + private readonly string $id, + private readonly string $name, + private readonly array $arguments = [], ) { } diff --git a/src/platform/src/StructuredOutput/ResponseFormatFactory.php b/src/platform/src/StructuredOutput/ResponseFormatFactory.php index a3b1b626f..9dab5a4f1 100644 --- a/src/platform/src/StructuredOutput/ResponseFormatFactory.php +++ b/src/platform/src/StructuredOutput/ResponseFormatFactory.php @@ -18,10 +18,10 @@ /** * @author Christopher Hertel */ -final readonly class ResponseFormatFactory implements ResponseFormatFactoryInterface +final class ResponseFormatFactory implements ResponseFormatFactoryInterface { public function __construct( - private Factory $schemaFactory = new Factory(), + private readonly Factory $schemaFactory = new Factory(), ) { } diff --git a/src/platform/src/StructuredOutput/ResultConverter.php b/src/platform/src/StructuredOutput/ResultConverter.php index a7222f5d8..4f6e6b21f 100644 --- a/src/platform/src/StructuredOutput/ResultConverter.php +++ b/src/platform/src/StructuredOutput/ResultConverter.php @@ -21,12 +21,12 @@ use Symfony\Component\Serializer\Exception\ExceptionInterface as SerializerExceptionInterface; use Symfony\Component\Serializer\SerializerInterface; -final readonly class ResultConverter implements ResultConverterInterface +final class ResultConverter implements ResultConverterInterface { public function __construct( - private ResultConverterInterface $innerConverter, - private SerializerInterface $serializer, - private ?string $outputClass = null, + private readonly ResultConverterInterface $innerConverter, + private readonly SerializerInterface $serializer, + private readonly ?string $outputClass = null, ) { } diff --git a/src/platform/src/Test/PlainConverter.php b/src/platform/src/Test/PlainConverter.php index d2c932693..df139ce7f 100644 --- a/src/platform/src/Test/PlainConverter.php +++ b/src/platform/src/Test/PlainConverter.php @@ -16,10 +16,10 @@ use Symfony\AI\Platform\Result\ResultInterface; use Symfony\AI\Platform\ResultConverterInterface; -final readonly class PlainConverter implements ResultConverterInterface +final class PlainConverter implements ResultConverterInterface { public function __construct( - private ResultInterface $result, + private readonly ResultInterface $result, ) { } diff --git a/src/platform/src/Tool/Tool.php b/src/platform/src/Tool/Tool.php index c670016e1..95b85a9ca 100644 --- a/src/platform/src/Tool/Tool.php +++ b/src/platform/src/Tool/Tool.php @@ -18,16 +18,16 @@ * * @author Christopher Hertel */ -final readonly class Tool +final class Tool { /** * @param JsonSchema|null $parameters */ public function __construct( - private ExecutionReference $reference, - private string $name, - private string $description, - private ?array $parameters = null, + private readonly ExecutionReference $reference, + private readonly string $name, + private readonly string $description, + private readonly ?array $parameters = null, ) { } diff --git a/src/store/src/Bridge/Azure/SearchStore.php b/src/store/src/Bridge/Azure/SearchStore.php index 5b3eeddbc..6e6dc5fed 100644 --- a/src/store/src/Bridge/Azure/SearchStore.php +++ b/src/store/src/Bridge/Azure/SearchStore.php @@ -22,18 +22,18 @@ /** * @author Christopher Hertel */ -final readonly class SearchStore implements StoreInterface +final class SearchStore implements StoreInterface { /** * @param string $vectorFieldName The name of the field int the index that contains the vector */ public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private string $indexName, - private string $apiVersion, - private string $vectorFieldName = 'vector', + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $indexName, + private readonly string $apiVersion, + private readonly string $vectorFieldName = 'vector', ) { } diff --git a/src/store/src/Bridge/ChromaDb/Store.php b/src/store/src/Bridge/ChromaDb/Store.php index a2fae92ae..3f29f44e6 100644 --- a/src/store/src/Bridge/ChromaDb/Store.php +++ b/src/store/src/Bridge/ChromaDb/Store.php @@ -22,11 +22,11 @@ /** * @author Christopher Hertel */ -final readonly class Store implements StoreInterface +final class Store implements StoreInterface { public function __construct( - private Client $client, - private string $collectionName, + private readonly Client $client, + private readonly string $collectionName, ) { if (!class_exists(Client::class)) { throw new RuntimeException('For using the ChromaDB as retrieval vector store, the codewithkyrian/chromadb-php package is required. Try running "composer require codewithkyrian/chromadb-php".'); diff --git a/src/store/src/Bridge/Cloudflare/Store.php b/src/store/src/Bridge/Cloudflare/Store.php index 0356cf1a9..f248e15c9 100644 --- a/src/store/src/Bridge/Cloudflare/Store.php +++ b/src/store/src/Bridge/Cloudflare/Store.php @@ -24,16 +24,16 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $accountId, - #[\SensitiveParameter] private string $apiKey, - private string $index, - private int $dimensions = 1536, - private string $metric = 'cosine', - private string $endpointUrl = 'https://api.cloudflare.com/client/v4/accounts', + private readonly HttpClientInterface $httpClient, + private readonly string $accountId, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $index, + private readonly int $dimensions = 1536, + private readonly string $metric = 'cosine', + private readonly string $endpointUrl = 'https://api.cloudflare.com/client/v4/accounts', ) { } diff --git a/src/store/src/Bridge/Local/CacheStore.php b/src/store/src/Bridge/Local/CacheStore.php index b528f4043..ad85bea40 100644 --- a/src/store/src/Bridge/Local/CacheStore.php +++ b/src/store/src/Bridge/Local/CacheStore.php @@ -25,12 +25,12 @@ /** * @author Guillaume Loulier */ -final readonly class CacheStore implements ManagedStoreInterface, StoreInterface +final class CacheStore implements ManagedStoreInterface, StoreInterface { public function __construct( - private CacheInterface&CacheItemPoolInterface $cache, - private DistanceCalculator $distanceCalculator = new DistanceCalculator(), - private string $cacheKey = '_vectors', + private readonly CacheInterface&CacheItemPoolInterface $cache, + private readonly DistanceCalculator $distanceCalculator = new DistanceCalculator(), + private readonly string $cacheKey = '_vectors', ) { if (!interface_exists(CacheInterface::class)) { throw new RuntimeException('For using the CacheStore as vector store, a symfony/contracts cache implementation is required. Try running "composer require symfony/cache" or another symfony/contracts compatible cache.'); diff --git a/src/store/src/Bridge/Local/DistanceCalculator.php b/src/store/src/Bridge/Local/DistanceCalculator.php index 2845af6de..b85031085 100644 --- a/src/store/src/Bridge/Local/DistanceCalculator.php +++ b/src/store/src/Bridge/Local/DistanceCalculator.php @@ -17,10 +17,10 @@ /** * @author Guillaume Loulier */ -final readonly class DistanceCalculator +final class DistanceCalculator { public function __construct( - private DistanceStrategy $strategy = DistanceStrategy::COSINE_DISTANCE, + private readonly DistanceStrategy $strategy = DistanceStrategy::COSINE_DISTANCE, ) { } diff --git a/src/store/src/Bridge/MariaDb/Store.php b/src/store/src/Bridge/MariaDb/Store.php index a4824f233..d82980310 100644 --- a/src/store/src/Bridge/MariaDb/Store.php +++ b/src/store/src/Bridge/MariaDb/Store.php @@ -29,7 +29,7 @@ * * @author Valtteri R */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { /** * @param string $tableName The name of the table @@ -37,10 +37,10 @@ * @param string $vectorFieldName The name of the field in the index that contains the vector */ public function __construct( - private \PDO $connection, - private string $tableName, - private string $indexName, - private string $vectorFieldName, + private readonly \PDO $connection, + private readonly string $tableName, + private readonly string $indexName, + private readonly string $vectorFieldName, ) { if (!\extension_loaded('pdo')) { throw new RuntimeException('For using MariaDB as retrieval vector store, the PDO extension needs to be enabled.'); diff --git a/src/store/src/Bridge/Meilisearch/Store.php b/src/store/src/Bridge/Meilisearch/Store.php index 7aed6ce16..18057e99a 100644 --- a/src/store/src/Bridge/Meilisearch/Store.php +++ b/src/store/src/Bridge/Meilisearch/Store.php @@ -24,20 +24,20 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { /** * @param string $embedder The name of the embedder where vectors are stored * @param string $vectorFieldName The name of the field int the index that contains the vector */ public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private string $indexName, - private string $embedder = 'default', - private string $vectorFieldName = '_vectors', - private int $embeddingsDimension = 1536, + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $indexName, + private readonly string $embedder = 'default', + private readonly string $vectorFieldName = '_vectors', + private readonly int $embeddingsDimension = 1536, ) { } diff --git a/src/store/src/Bridge/Milvus/Store.php b/src/store/src/Bridge/Milvus/Store.php index 1a9e2f356..24b616011 100644 --- a/src/store/src/Bridge/Milvus/Store.php +++ b/src/store/src/Bridge/Milvus/Store.php @@ -24,17 +24,17 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private string $database, - private string $collection, - private string $vectorFieldName = '_vectors', - private int $dimensions = 1536, - private string $metricType = 'COSINE', + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $database, + private readonly string $collection, + private readonly string $vectorFieldName = '_vectors', + private readonly int $dimensions = 1536, + private readonly string $metricType = 'COSINE', ) { } diff --git a/src/store/src/Bridge/MongoDb/Store.php b/src/store/src/Bridge/MongoDb/Store.php index 5a7692fa8..1f5b58102 100644 --- a/src/store/src/Bridge/MongoDb/Store.php +++ b/src/store/src/Bridge/MongoDb/Store.php @@ -49,7 +49,7 @@ * * @author Oskar Stark */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { /** * @param string $databaseName The name of the database @@ -59,13 +59,13 @@ * @param bool $bulkWrite Use bulk write operations */ public function __construct( - private Client $client, - private string $databaseName, - private string $collectionName, - private string $indexName, - private string $vectorFieldName = 'vector', - private bool $bulkWrite = false, - private LoggerInterface $logger = new NullLogger(), + private readonly Client $client, + private readonly string $databaseName, + private readonly string $collectionName, + private readonly string $indexName, + private readonly string $vectorFieldName = 'vector', + private readonly bool $bulkWrite = false, + private readonly LoggerInterface $logger = new NullLogger(), ) { if (!class_exists(Client::class)) { throw new RuntimeException('For using MongoDB Atlas as retrieval vector store, the mongodb/mongodb package is required. Try running "composer require mongodb/mongodb".'); diff --git a/src/store/src/Bridge/Neo4j/Store.php b/src/store/src/Bridge/Neo4j/Store.php index 52096b2c7..a69d2ab92 100644 --- a/src/store/src/Bridge/Neo4j/Store.php +++ b/src/store/src/Bridge/Neo4j/Store.php @@ -24,20 +24,20 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - private string $username, - #[\SensitiveParameter] private string $password, - private string $databaseName, - private string $vectorIndexName, - private string $nodeName, - private string $embeddingsField = 'embeddings', - private int $embeddingsDimension = 1536, - private string $embeddingsDistance = 'cosine', - private bool $quantization = false, + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + private readonly string $username, + #[\SensitiveParameter] private readonly string $password, + private readonly string $databaseName, + private readonly string $vectorIndexName, + private readonly string $nodeName, + private readonly string $embeddingsField = 'embeddings', + private readonly int $embeddingsDimension = 1536, + private readonly string $embeddingsDistance = 'cosine', + private readonly bool $quantization = false, ) { } diff --git a/src/store/src/Bridge/Pinecone/Store.php b/src/store/src/Bridge/Pinecone/Store.php index 3d1e2a9d9..ac5a01d22 100644 --- a/src/store/src/Bridge/Pinecone/Store.php +++ b/src/store/src/Bridge/Pinecone/Store.php @@ -23,16 +23,16 @@ /** * @author Christopher Hertel */ -final readonly class Store implements StoreInterface +final class Store implements StoreInterface { /** * @param array $filter */ public function __construct( - private Client $pinecone, - private ?string $namespace = null, - private array $filter = [], - private int $topK = 3, + private readonly Client $pinecone, + private readonly ?string $namespace = null, + private readonly array $filter = [], + private readonly int $topK = 3, ) { if (!class_exists(Client::class)) { throw new RuntimeException('For using the Pinecone as retrieval vector store, the probots-io/pinecone-php package is required. Try running "composer require probots-io/pinecone-php".'); diff --git a/src/store/src/Bridge/Postgres/Store.php b/src/store/src/Bridge/Postgres/Store.php index 4cb222d40..cd5ebf1dd 100644 --- a/src/store/src/Bridge/Postgres/Store.php +++ b/src/store/src/Bridge/Postgres/Store.php @@ -28,13 +28,13 @@ * * @see https://github.com/pgvector/pgvector */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private \PDO $connection, - private string $tableName, - private string $vectorFieldName = 'embedding', - private Distance $distance = Distance::L2, + private readonly \PDO $connection, + private readonly string $tableName, + private readonly string $vectorFieldName = 'embedding', + private readonly Distance $distance = Distance::L2, ) { } diff --git a/src/store/src/Bridge/Qdrant/Store.php b/src/store/src/Bridge/Qdrant/Store.php index 8d9e207ff..8d6fa146e 100644 --- a/src/store/src/Bridge/Qdrant/Store.php +++ b/src/store/src/Bridge/Qdrant/Store.php @@ -24,15 +24,15 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private string $collectionName, - private int $embeddingsDimension = 1536, - private string $embeddingsDistance = 'Cosine', + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $collectionName, + private readonly int $embeddingsDimension = 1536, + private readonly string $embeddingsDistance = 'Cosine', ) { } diff --git a/src/store/src/Bridge/Supabase/Store.php b/src/store/src/Bridge/Supabase/Store.php index f1043c82d..8a2d558e7 100644 --- a/src/store/src/Bridge/Supabase/Store.php +++ b/src/store/src/Bridge/Supabase/Store.php @@ -33,16 +33,16 @@ * @see https://github.com/pgvector/pgvector pgvector extension documentation * @see https://supabase.com/docs/guides/ai/vector-columns Supabase vector guide */ -final readonly class Store implements StoreInterface +final class Store implements StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $url, - private string $apiKey, - private string $table = 'documents', - private string $vectorFieldName = 'embedding', - private int $vectorDimension = 1536, - private string $functionName = 'match_documents', + private readonly HttpClientInterface $httpClient, + private readonly string $url, + private readonly string $apiKey, + private readonly string $table = 'documents', + private readonly string $vectorFieldName = 'embedding', + private readonly int $vectorDimension = 1536, + private readonly string $functionName = 'match_documents', ) { } diff --git a/src/store/src/Bridge/Typesense/Store.php b/src/store/src/Bridge/Typesense/Store.php index 8bcb8d14f..0f65ae85f 100644 --- a/src/store/src/Bridge/Typesense/Store.php +++ b/src/store/src/Bridge/Typesense/Store.php @@ -24,15 +24,15 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private string $collection, - private string $vectorFieldName = '_vectors', - private int $embeddingsDimension = 1536, + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $collection, + private readonly string $vectorFieldName = '_vectors', + private readonly int $embeddingsDimension = 1536, ) { } diff --git a/src/store/src/Bridge/Weaviate/Store.php b/src/store/src/Bridge/Weaviate/Store.php index 89ddd6aa4..a31e95b4a 100644 --- a/src/store/src/Bridge/Weaviate/Store.php +++ b/src/store/src/Bridge/Weaviate/Store.php @@ -24,13 +24,13 @@ /** * @author Guillaume Loulier */ -final readonly class Store implements ManagedStoreInterface, StoreInterface +final class Store implements ManagedStoreInterface, StoreInterface { public function __construct( - private HttpClientInterface $httpClient, - private string $endpointUrl, - #[\SensitiveParameter] private string $apiKey, - private string $collection, + private readonly HttpClientInterface $httpClient, + private readonly string $endpointUrl, + #[\SensitiveParameter] private readonly string $apiKey, + private readonly string $collection, ) { } diff --git a/src/store/src/Document/Loader/InMemoryLoader.php b/src/store/src/Document/Loader/InMemoryLoader.php index a41055d3e..c08b31f5f 100644 --- a/src/store/src/Document/Loader/InMemoryLoader.php +++ b/src/store/src/Document/Loader/InMemoryLoader.php @@ -20,13 +20,13 @@ * * @author Oskar Stark */ -final readonly class InMemoryLoader implements LoaderInterface +final class InMemoryLoader implements LoaderInterface { /** * @param EmbeddableDocumentInterface[] $documents */ public function __construct( - private array $documents = [], + private readonly array $documents = [], ) { } diff --git a/src/store/src/Document/Loader/Rss/RssItem.php b/src/store/src/Document/Loader/Rss/RssItem.php index 9fabd03c8..a8ac9d898 100644 --- a/src/store/src/Document/Loader/Rss/RssItem.php +++ b/src/store/src/Document/Loader/Rss/RssItem.php @@ -16,16 +16,16 @@ /** * @author Niklas Grießer */ -final readonly class RssItem +final class RssItem { public function __construct( - public Uuid $id, - public string $title, - public string $link, - public \DateTimeImmutable $date, - public string $description, - public ?string $author, - public ?string $content, + public readonly Uuid $id, + public readonly string $title, + public readonly string $link, + public readonly \DateTimeImmutable $date, + public readonly string $description, + public readonly ?string $author, + public readonly ?string $content, ) { } diff --git a/src/store/src/Document/Loader/RssFeedLoader.php b/src/store/src/Document/Loader/RssFeedLoader.php index 6c93ec599..5bd9ba7aa 100644 --- a/src/store/src/Document/Loader/RssFeedLoader.php +++ b/src/store/src/Document/Loader/RssFeedLoader.php @@ -25,7 +25,7 @@ /** * @author Niklas Grießer */ -final readonly class RssFeedLoader implements LoaderInterface +final class RssFeedLoader implements LoaderInterface { public const OPTION_UUID_NAMESPACE = 'uuid_namespace'; @@ -33,8 +33,8 @@ * @param string $uuidNamespace The namespace used to generate stable identifiers using UUIDv5 */ public function __construct( - private HttpClientInterface $httpClient, - private string $uuidNamespace = '6ba7b810-9dad-11d1-80b4-00c04fd430c8', + private readonly HttpClientInterface $httpClient, + private readonly string $uuidNamespace = '6ba7b810-9dad-11d1-80b4-00c04fd430c8', ) { } diff --git a/src/store/src/Document/Loader/TextFileLoader.php b/src/store/src/Document/Loader/TextFileLoader.php index bf365ff48..28e0dc552 100644 --- a/src/store/src/Document/Loader/TextFileLoader.php +++ b/src/store/src/Document/Loader/TextFileLoader.php @@ -21,7 +21,7 @@ /** * @author Christopher Hertel */ -final readonly class TextFileLoader implements LoaderInterface +final class TextFileLoader implements LoaderInterface { public function load(?string $source, array $options = []): iterable { diff --git a/src/store/src/Document/TextDocument.php b/src/store/src/Document/TextDocument.php index 04ad92847..eefac3f31 100644 --- a/src/store/src/Document/TextDocument.php +++ b/src/store/src/Document/TextDocument.php @@ -17,12 +17,12 @@ /** * @author Christopher Hertel */ -final readonly class TextDocument implements EmbeddableDocumentInterface +final class TextDocument implements EmbeddableDocumentInterface { public function __construct( - private Uuid $id, - private string $content, - private Metadata $metadata = new Metadata(), + private readonly Uuid $id, + private readonly string $content, + private readonly Metadata $metadata = new Metadata(), ) { if ('' === trim($this->content)) { throw new InvalidArgumentException('The content shall not be an empty string.'); diff --git a/src/store/src/Document/Transformer/ChainTransformer.php b/src/store/src/Document/Transformer/ChainTransformer.php index 832b7174a..bd9c76fcc 100644 --- a/src/store/src/Document/Transformer/ChainTransformer.php +++ b/src/store/src/Document/Transformer/ChainTransformer.php @@ -13,12 +13,12 @@ use Symfony\AI\Store\Document\TransformerInterface; -final readonly class ChainTransformer implements TransformerInterface +final class ChainTransformer implements TransformerInterface { /** * @var TransformerInterface[] */ - private array $transformers; + private readonly array $transformers; /** * @param iterable $transformers diff --git a/src/store/src/Document/Transformer/ChunkDelayTransformer.php b/src/store/src/Document/Transformer/ChunkDelayTransformer.php index 7124abba0..c3114e30e 100644 --- a/src/store/src/Document/Transformer/ChunkDelayTransformer.php +++ b/src/store/src/Document/Transformer/ChunkDelayTransformer.php @@ -20,13 +20,13 @@ * * @author Christopher Hertel */ -final readonly class ChunkDelayTransformer implements TransformerInterface +final class ChunkDelayTransformer implements TransformerInterface { public const OPTION_CHUNK_SIZE = 'chunk_size'; public const OPTION_DELAY = 'delay'; public function __construct( - private ClockInterface $clock, + private readonly ClockInterface $clock, ) { } diff --git a/src/store/src/Document/Transformer/TextReplaceTransformer.php b/src/store/src/Document/Transformer/TextReplaceTransformer.php index b6a63d9bc..675401bfc 100644 --- a/src/store/src/Document/Transformer/TextReplaceTransformer.php +++ b/src/store/src/Document/Transformer/TextReplaceTransformer.php @@ -20,14 +20,14 @@ * * @author Oskar Stark */ -final readonly class TextReplaceTransformer implements TransformerInterface +final class TextReplaceTransformer implements TransformerInterface { public const OPTION_SEARCH = 'search'; public const OPTION_REPLACE = 'replace'; public function __construct( - private string $search = '', - private string $replace = '', + private readonly string $search = '', + private readonly string $replace = '', ) { self::validate($search, $replace); } diff --git a/src/store/src/Document/Transformer/TextSplitTransformer.php b/src/store/src/Document/Transformer/TextSplitTransformer.php index 7b2b7ff8e..19a611efb 100644 --- a/src/store/src/Document/Transformer/TextSplitTransformer.php +++ b/src/store/src/Document/Transformer/TextSplitTransformer.php @@ -24,14 +24,14 @@ * * @author Christopher Hertel */ -final readonly class TextSplitTransformer implements TransformerInterface +final class TextSplitTransformer implements TransformerInterface { public const OPTION_CHUNK_SIZE = 'chunk_size'; public const OPTION_OVERLAP = 'overlap'; public function __construct( - private int $chunkSize = 1000, - private int $overlap = 200, + private readonly int $chunkSize = 1000, + private readonly int $overlap = 200, ) { if ($this->overlap < 0 || $this->overlap >= $this->chunkSize) { throw new InvalidArgumentException(\sprintf('Overlap must be non-negative and less than chunk size. Got chunk size: %d, overlap: %d.', $this->chunkSize, $this->overlap)); diff --git a/src/store/src/Document/Transformer/TextTrimTransformer.php b/src/store/src/Document/Transformer/TextTrimTransformer.php index cb9c1231d..be818969e 100644 --- a/src/store/src/Document/Transformer/TextTrimTransformer.php +++ b/src/store/src/Document/Transformer/TextTrimTransformer.php @@ -19,7 +19,7 @@ * * @author Oskar Stark */ -final readonly class TextTrimTransformer implements TransformerInterface +final class TextTrimTransformer implements TransformerInterface { /** * @param iterable $documents diff --git a/src/store/src/Document/VectorDocument.php b/src/store/src/Document/VectorDocument.php index 294c94521..f6b06d6ab 100644 --- a/src/store/src/Document/VectorDocument.php +++ b/src/store/src/Document/VectorDocument.php @@ -17,13 +17,13 @@ /** * @author Christopher Hertel */ -final readonly class VectorDocument +final class VectorDocument { public function __construct( - public Uuid $id, - public VectorInterface $vector, - public Metadata $metadata = new Metadata(), - public ?float $score = null, + public readonly Uuid $id, + public readonly VectorInterface $vector, + public readonly Metadata $metadata = new Metadata(), + public readonly ?float $score = null, ) { } } diff --git a/src/store/src/Document/Vectorizer.php b/src/store/src/Document/Vectorizer.php index 3cb662c3b..f6b6490c7 100644 --- a/src/store/src/Document/Vectorizer.php +++ b/src/store/src/Document/Vectorizer.php @@ -18,12 +18,12 @@ use Symfony\AI\Platform\Vector\Vector; use Symfony\AI\Store\Exception\RuntimeException; -final readonly class Vectorizer implements VectorizerInterface +final class Vectorizer implements VectorizerInterface { public function __construct( - private PlatformInterface $platform, - private string $model, - private LoggerInterface $logger = new NullLogger(), + private readonly PlatformInterface $platform, + private readonly string $model, + private readonly LoggerInterface $logger = new NullLogger(), ) { } diff --git a/src/store/tests/Document/VectorDocumentTest.php b/src/store/tests/Document/VectorDocumentTest.php index 201222f0a..54a5c2f82 100644 --- a/src/store/tests/Document/VectorDocumentTest.php +++ b/src/store/tests/Document/VectorDocumentTest.php @@ -89,25 +89,6 @@ public function testConstructorWithDifferentScores(?float $score) $this->assertSame($score, $document->score); } - #[TestDox('Ensures all properties are readonly')] - public function testReadonlyProperties() - { - $id = Uuid::v4(); - $vector = new Vector([0.1, 0.2, 0.3]); - $metadata = new Metadata(['key' => 'value']); - $score = 0.85; - - $document = new VectorDocument($id, $vector, $metadata, $score); - - $this->assertSame($id, $document->id); - $this->assertSame($vector, $document->vector); - $this->assertSame($metadata, $document->metadata); - $this->assertSame($score, $document->score); - - $reflection = new \ReflectionClass(VectorDocument::class); - $this->assertTrue($reflection->isReadOnly()); - } - #[TestDox('Handles metadata with special keys')] public function testMetadataWithSpecialKeys() {