Skip to content

Commit aa4ec2d

Browse files
committed
[Agent] Remove unused dev dependencies
The agent tool bridges have their own composer.json with their specific dependencies. The main agent package doesn't need these vendor packages in require-dev since it only tests core functionality. - Removed symfony/cache and symfony/http-foundation from main agent composer.json - Added phpstan.dist.neon to each tool bridge - Added phpstan dependencies to each bridge composer.json - Updated main agent phpstan.dist.neon to exclude Bridge directory - Added CI step to run PHPStan on tool bridges
1 parent 69ed9b6 commit aa4ec2d

25 files changed

+274
-20
lines changed

.github/workflows/code-quality.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,11 @@ jobs:
8181
BRIDGES=$(find src/store/src/Bridge/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort | tr '\n' ' ')
8282
echo "Bridges: $BRIDGES"
8383
echo "$BRIDGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/store/src/Bridge/{} && $COMPOSER_UP && $PHPSTAN)'"
84+
85+
- name: Run PHPStan on tool bridges
86+
run: |
87+
source .github/workflows/.utils.sh
88+
89+
BRIDGES=$(find src/agent/src/Bridge/ -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort | tr '\n' ' ')
90+
echo "Bridges: $BRIDGES"
91+
echo "$BRIDGES" | xargs -n1 | parallel -j +3 "_run_task {} '(cd src/agent/src/Bridge/{} && $COMPOSER_UP && $PHPSTAN)'"

src/agent/composer.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
"phpstan/phpstan-strict-rules": "^2.0",
4242
"phpunit/phpunit": "^11.5.46",
4343
"symfony/ai-store": "@dev",
44-
"symfony/cache": "^7.3|^8.0",
4544
"symfony/event-dispatcher": "^7.3|^8.0",
46-
"symfony/http-foundation": "^7.3|^8.0",
4745
"symfony/translation": "^7.3|^8.0",
4846
"symfony/translation-contracts": "^3.6"
4947
},

src/agent/phpstan.dist.neon

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,18 @@ parameters:
77
- src/
88
- tests/
99
excludePaths:
10-
- src/Bridge/*/vendor/
10+
- src/Bridge/
1111
ignoreErrors:
1212
-
1313
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"
1414
-
1515
identifier: missingType.iterableValue
1616
path: tests/*
1717
reportUnmatched: false
18-
-
19-
identifier: missingType.iterableValue
20-
path: src/Bridge/**/Tests/*
21-
reportUnmatched: false
2218
-
2319
identifier: 'symfonyAi.forbidNativeException'
2420
path: tests/*
2521
reportUnmatched: false
2622
-
27-
identifier: 'symfonyAi.forbidNativeException'
28-
path: src/Bridge/**/Tests/*
23+
identifier: trait.unused
2924
reportUnmatched: false

src/agent/src/Bridge/Brave/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"symfony/http-client": "^7.3|^8.0"
3131
},
3232
"require-dev": {
33+
"phpstan/phpstan": "^2.0",
34+
"phpstan/phpstan-strict-rules": "^2.0",
3335
"phpunit/phpunit": "^11.5.46"
3436
},
3537
"minimum-stability": "dev",
@@ -40,7 +42,8 @@
4042
},
4143
"autoload-dev": {
4244
"psr-4": {
43-
"Symfony\\AI\\Agent\\Bridge\\Brave\\Tests\\": "Tests/"
45+
"Symfony\\AI\\Agent\\Bridge\\Brave\\Tests\\": "Tests/",
46+
"Symfony\\AI\\PHPStan\\": "../../../../../.phpstan/"
4447
}
4548
},
4649
"config": {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
includes:
2+
- ../../../../../.phpstan/extension.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- Brave.php
8+
- Tests/
9+
treatPhpDocTypesAsCertain: false
10+
ignoreErrors:
11+
-
12+
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"
13+
-
14+
identifier: missingType.iterableValue
15+
path: Tests/*
16+
reportUnmatched: false
17+
-
18+
identifier: 'symfonyAi.forbidNativeException'
19+
path: Tests/*
20+
reportUnmatched: false

src/agent/src/Bridge/Clock/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"symfony/clock": "^7.3|^8.0"
3232
},
3333
"require-dev": {
34+
"phpstan/phpstan": "^2.0",
35+
"phpstan/phpstan-strict-rules": "^2.0",
3436
"phpunit/phpunit": "^11.5.46"
3537
},
3638
"minimum-stability": "dev",
@@ -41,7 +43,8 @@
4143
},
4244
"autoload-dev": {
4345
"psr-4": {
44-
"Symfony\\AI\\Agent\\Bridge\\Clock\\Tests\\": "Tests/"
46+
"Symfony\\AI\\Agent\\Bridge\\Clock\\Tests\\": "Tests/",
47+
"Symfony\\AI\\PHPStan\\": "../../../../../.phpstan/"
4548
}
4649
},
4750
"config": {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
includes:
2+
- ../../../../../.phpstan/extension.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- Clock.php
8+
- Tests/
9+
treatPhpDocTypesAsCertain: false
10+
ignoreErrors:
11+
-
12+
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"
13+
-
14+
identifier: missingType.iterableValue
15+
path: Tests/*
16+
reportUnmatched: false
17+
-
18+
identifier: 'symfonyAi.forbidNativeException'
19+
path: Tests/*
20+
reportUnmatched: false

src/agent/src/Bridge/Firecrawl/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"symfony/http-client": "^7.3|^8.0"
3131
},
3232
"require-dev": {
33+
"phpstan/phpstan": "^2.0",
34+
"phpstan/phpstan-strict-rules": "^2.0",
3335
"phpunit/phpunit": "^11.5.46"
3436
},
3537
"minimum-stability": "dev",
@@ -40,7 +42,8 @@
4042
},
4143
"autoload-dev": {
4244
"psr-4": {
43-
"Symfony\\AI\\Agent\\Bridge\\Firecrawl\\Tests\\": "Tests/"
45+
"Symfony\\AI\\Agent\\Bridge\\Firecrawl\\Tests\\": "Tests/",
46+
"Symfony\\AI\\PHPStan\\": "../../../../../.phpstan/"
4447
}
4548
},
4649
"config": {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
includes:
2+
- ../../../../../.phpstan/extension.neon
3+
4+
parameters:
5+
level: 6
6+
paths:
7+
- Firecrawl.php
8+
- Tests/
9+
treatPhpDocTypesAsCertain: false
10+
ignoreErrors:
11+
-
12+
message: "#^Method .*::test.*\\(\\) has no return type specified\\.$#"
13+
-
14+
identifier: missingType.iterableValue
15+
path: Tests/*
16+
reportUnmatched: false
17+
-
18+
identifier: 'symfonyAi.forbidNativeException'
19+
path: Tests/*
20+
reportUnmatched: false

src/agent/src/Bridge/Mapbox/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
"symfony/http-client": "^7.3|^8.0"
2828
},
2929
"require-dev": {
30+
"phpstan/phpstan": "^2.0",
31+
"phpstan/phpstan-strict-rules": "^2.0",
3032
"phpunit/phpunit": "^11.5.46"
3133
},
3234
"minimum-stability": "dev",
@@ -37,7 +39,8 @@
3739
},
3840
"autoload-dev": {
3941
"psr-4": {
40-
"Symfony\\AI\\Agent\\Bridge\\Mapbox\\Tests\\": "Tests/"
42+
"Symfony\\AI\\Agent\\Bridge\\Mapbox\\Tests\\": "Tests/",
43+
"Symfony\\AI\\PHPStan\\": "../../../../../.phpstan/"
4144
}
4245
},
4346
"config": {

0 commit comments

Comments
 (0)