Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit c1fad8a

Browse files
authored
ci: add rector/rector (#18)
1 parent bc89175 commit c1fad8a

29 files changed

+147
-72
lines changed

.github/workflows/pipeline.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
- name: Code Style PHP
3232
run: vendor/bin/php-cs-fixer fix --dry-run
3333

34+
- name: Rector
35+
run: vendor/bin/rector
36+
3437
- name: PHPStan
3538
run: vendor/bin/phpstan analyse
3639

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ qa:
22
vendor/bin/php-cs-fixer fix
33
vendor/bin/phpstan
44
vendor/bin/phpunit
5+
vendor/bin/rector
56

67
qa-lowest:
78
composer update --prefer-lowest

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"phpstan/phpstan": "^1.12",
2828
"phpunit/phpunit": "^11.3",
2929
"probots-io/pinecone-php": "^1.0",
30+
"rector/rector": "^1.2",
3031
"symfony/clock": "^6.4 || ^7.1",
3132
"symfony/console": "^6.4 || ^7.1",
3233
"symfony/css-selector": "^6.4 || ^7.1",

rector.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
7+
use Rector\PHPUnit\Set\PHPUnitSetList;
8+
9+
return RectorConfig::configure()
10+
->withPaths([
11+
__DIR__.'/examples',
12+
__DIR__.'/src',
13+
__DIR__.'/tests',
14+
])
15+
->withPhpSets(php82: true)
16+
->withSets([
17+
PHPUnitSetList::PHPUNIT_110,
18+
PHPUnitSetList::ANNOTATIONS_TO_ATTRIBUTES,
19+
])
20+
->withImportNames(importNames: true, importShortClasses: false)
21+
->withSkip([
22+
ClosureToArrowFunctionRector::class,
23+
])
24+
->withTypeCoverageLevel(0);

src/Anthropic/Model/Claude.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use PhpLlm\LlmChain\Response\Choice;
1212
use PhpLlm\LlmChain\Response\Response;
1313

14-
final class Claude implements LanguageModel
14+
final readonly class Claude implements LanguageModel
1515
{
1616
public function __construct(
1717
private ClaudeRuntime $runtime,

src/Anthropic/Runtime/Anthropic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use PhpLlm\LlmChain\Anthropic\ClaudeRuntime;
88
use Symfony\Contracts\HttpClient\HttpClientInterface;
99

10-
final class Anthropic implements ClaudeRuntime
10+
final readonly class Anthropic implements ClaudeRuntime
1111
{
1212
public function __construct(
1313
private HttpClientInterface $httpClient,

src/DocumentEmbedder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use PhpLlm\LlmChain\Document\Document;
88
use PhpLlm\LlmChain\Store\StoreInterface;
99

10-
final class DocumentEmbedder
10+
final readonly class DocumentEmbedder
1111
{
1212
public function __construct(
1313
private EmbeddingModel $embeddings,

src/OpenAI/Model/Embeddings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PhpLlm\LlmChain\OpenAI\Model\Embeddings\Version;
1010
use PhpLlm\LlmChain\OpenAI\Runtime;
1111

12-
final class Embeddings implements EmbeddingModel
12+
final readonly class Embeddings implements EmbeddingModel
1313
{
1414
public function __construct(
1515
private Runtime $runtime,

src/OpenAI/Model/Gpt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use PhpLlm\LlmChain\Response\Response;
1313
use PhpLlm\LlmChain\Response\ToolCall;
1414

15-
final class Gpt implements LanguageModel
15+
final readonly class Gpt implements LanguageModel
1616
{
1717
public function __construct(
1818
private Runtime $runtime,

src/OpenAI/Runtime/Azure.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
final class Azure extends AbstractRuntime implements Runtime
1212
{
1313
public function __construct(
14-
private HttpClientInterface $httpClient,
15-
private string $baseUrl,
16-
private string $deployment,
17-
private string $apiVersion,
18-
private string $key,
14+
private readonly HttpClientInterface $httpClient,
15+
private readonly string $baseUrl,
16+
private readonly string $deployment,
17+
private readonly string $apiVersion,
18+
private readonly string $key,
1919
) {
2020
}
2121

0 commit comments

Comments
 (0)