Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ jobs:
- name: Code Style PHP
run: vendor/bin/php-cs-fixer fix --dry-run

- name: Rector
run: vendor/bin/rector --dry-run

- name: PHPStan
run: vendor/bin/phpstan analyse
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
"require-dev": {
"php-cs-fixer/shim": "^3.69",
"phpstan/phpstan": "^2.1",
"phpunit/phpunit": "^11.5"
"phpunit/phpunit": "^11.5",
"rector/rector": "^2.0"
},
"config": {
"sort-packages": true
Expand Down
32 changes: 32 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitSelfCallRector;
use Rector\PHPUnit\CodeQuality\Rector\Class_\PreferPHPUnitThisCallRector;
use Rector\PHPUnit\CodeQuality\Rector\MethodCall\AssertCountWithZeroToAssertEmptyRector;
use Rector\PHPUnit\Set\PHPUnitSetList;

return RectorConfig::configure()
->withPaths([
__DIR__.'/src',
__DIR__.'/tests',
])
->withPhpSets(php82: true)
->withSets([
PHPUnitSetList::PHPUNIT_110,
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
PHPUnitSetList::PHPUNIT_CODE_QUALITY,
])
->withRules([
PreferPHPUnitSelfCallRector::class,
])
->withImportNames(importShortClasses: false)
->withSkip([
AssertCountWithZeroToAssertEmptyRector::class,
ClosureToArrowFunctionRector::class,
PreferPHPUnitThisCallRector::class,
])
->withTypeCoverageLevel(0);
4 changes: 2 additions & 2 deletions src/DependencyInjection/LlmChainExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private function processChainConfig(string $name, array $config, ContainerBuilde
// MODEL
['name' => $modelName, 'version' => $version, 'options' => $options] = $config['model'];

$llmClass = match (strtolower($modelName)) {
$llmClass = match (strtolower((string) $modelName)) {
'gpt' => GPT::class,
'claude' => Claude::class,
'llama' => Llama::class,
Expand Down Expand Up @@ -404,7 +404,7 @@ private function processEmbedderConfig(int|string $name, array $config, Containe
{
['name' => $modelName, 'version' => $version, 'options' => $options] = $config['model'];

$modelClass = match (strtolower($modelName)) {
$modelClass = match (strtolower((string) $modelName)) {
'embeddings' => Embeddings::class,
'voyage' => Voyage::class,
default => throw new \InvalidArgumentException(sprintf('Model "%s" is not supported.', $modelName)),
Expand Down
4 changes: 2 additions & 2 deletions src/Profiler/DataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ final class DataCollector extends AbstractDataCollector
/**
* @var TraceablePlatform[]
*/
private array $platforms;
private readonly array $platforms;

/**
* @var TraceableToolBox[]
*/
private array $toolBoxes;
private readonly array $toolBoxes;

/**
* @param TraceablePlatform[] $platforms
Expand Down
2 changes: 1 addition & 1 deletion src/Profiler/TraceableToolBox.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final class TraceableToolBox implements ToolBoxInterface
public array $calls = [];

public function __construct(
private ToolBoxInterface $toolBox,
private readonly ToolBoxInterface $toolBox,
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Resources/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use PhpLlm\LlmChainBundle\Profiler\DataCollector;
use PhpLlm\LlmChainBundle\Profiler\TraceableToolBox;

return static function (ContainerConfigurator $container) {
return static function (ContainerConfigurator $container): void {
$container->services()
->defaults()
->autowire()
Expand Down
2 changes: 1 addition & 1 deletion tests/Profiler/TraceableToolBoxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ private function createToolBox(array $metadata): ToolBoxInterface
{
return new class($metadata) implements ToolBoxInterface {
public function __construct(
private array $metadata,
private readonly array $metadata,
) {
}

Expand Down