Skip to content

Commit 1e436e5

Browse files
VincentLangletchr-hertel
authored andcommitted
Run phpstan on example
1 parent 7b9e334 commit 1e436e5

File tree

13 files changed

+31
-3
lines changed

13 files changed

+31
-3
lines changed

.github/workflows/code-quality.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,7 @@ jobs:
6565
source .github/workflows/.utils.sh
6666
6767
echo "$PACKAGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/{} && $COMPOSER_UP && $PHPSTAN)'"
68+
69+
- name: Run PHPStan on examples
70+
run: |
71+
cd examples/ && $COMPOSER_UP && $PHPSTAN

examples/composer.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,19 @@
3030
"symfony/process": "^6.4 || ^7.0",
3131
"symfony/var-dumper": "^6.4 || ^7.0"
3232
},
33+
"require-dev": {
34+
"phpstan/phpstan": "^2.1"
35+
},
3336
"autoload": {
3437
"psr-4": {
3538
"Symfony\\AI\\Fixtures\\": "../fixtures/"
3639
}
3740
},
41+
"autoload-dev": {
42+
"psr-4": {
43+
"Symfony\\AI\\PHPStan\\": "../.phpstan/"
44+
}
45+
},
3846
"config": {
3947
"allow-plugins": {
4048
"codewithkyrian/platform-package-installer": true,

examples/document/splitting.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
$splitter = new TextSplitTransformer();
1919
$source = dirname(__DIR__, 2).'/fixtures/lorem.txt';
2020

21-
$documents = iterator_to_array($splitter($loader($source)));
21+
$documents = iterator_to_array($splitter->transform($loader->load($source)));
2222

2323
dump($documents);

examples/phpstan.dist.neon

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
includes:
2+
- ../.phpstan/extension.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- ./
8+
excludePaths:
9+
- vendor

examples/rag/cache.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
$store = new CacheStore(new ArrayAdapter());
3535

3636
// create embeddings and documents
37+
$documents = [];
3738
foreach (Movies::all() as $i => $movie) {
3839
$documents[] = new TextDocument(
3940
id: Uuid::v4(),

examples/rag/chromadb.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
$store = new Store(
3535
(new Codewithkyrian\ChromaDB\Factory())
3636
->withHost(env('CHROMADB_HOST'))
37-
->withPort(env('CHROMADB_PORT'))
37+
->withPort((int) env('CHROMADB_PORT'))
3838
->connect(),
3939
'movies',
4040
);

examples/rag/in-memory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
$store = new InMemoryStore();
3434

3535
// create embeddings and documents
36+
$documents = [];
3637
foreach (Movies::all() as $i => $movie) {
3738
$documents[] = new TextDocument(
3839
id: Uuid::v4(),

examples/rag/mariadb-gemini.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
);
4141

4242
// create embeddings and documents
43+
$documents = [];
4344
foreach (Movies::all() as $i => $movie) {
4445
$documents[] = new TextDocument(
4546
id: Uuid::v4(),

examples/rag/mariadb-openai.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
);
4040

4141
// create embeddings and documents
42+
$documents = [];
4243
foreach (Movies::all() as $i => $movie) {
4344
$documents[] = new TextDocument(
4445
id: Uuid::v4(),

examples/rag/mongodb.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
);
4141

4242
// create embeddings and documents
43+
$documents = [];
4344
foreach (Movies::all() as $movie) {
4445
$documents[] = new TextDocument(
4546
id: Uuid::v4(),

0 commit comments

Comments
 (0)