Skip to content

Commit d5d230f

Browse files
committed
minor #72 chore: remove occurrences of empty() (alexandre-daubois, chr-hertel)
This PR was merged into the main branch. Discussion ---------- chore: remove occurrences of `empty()` | Q | A | ------------- | --- | Bug fix? | no | New feature? |no | Docs? | no | Issues | | License | MIT Cherry picking php-llm/llm-chain#374 Commits ------- c0d688f chore: use [] checks instead of count with zero on array fb3d1a8 chore: use isset instead of bool cast on $_ENV 14c448c chore: remove occurrences of `empty()` (#374)
2 parents 01fddff + 238a880 commit d5d230f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/DependencyInjection/AIExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
271271
if (null !== $version) {
272272
$modelDefinition->setArgument('$name', $version);
273273
}
274-
if (0 !== \count($options)) {
274+
if ([] !== $options) {
275275
$modelDefinition->setArgument('$options', $options);
276276
}
277277
$modelDefinition->addTag('symfony_ai.model.language_model');
@@ -289,7 +289,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
289289
// TOOL & PROCESSOR
290290
if ($config['tools']['enabled']) {
291291
// Create specific toolbox and process if tools are explicitly defined
292-
if (0 !== \count($config['tools']['services'])) {
292+
if ([] !== $config['tools']['services']) {
293293
$memoryFactoryDefinition = new Definition(MemoryToolFactory::class);
294294
$container->setDefinition('symfony_ai.toolbox.'.$name.'.memory_factory', $memoryFactoryDefinition);
295295
$chainFactoryDefinition = new Definition(ChainFactory::class, [
@@ -479,7 +479,7 @@ private function processIndexerConfig(int|string $name, array $config, Container
479479
if (null !== $version) {
480480
$modelDefinition->setArgument('$name', $version);
481481
}
482-
if (0 !== \count($options)) {
482+
if ([] !== $options) {
483483
$modelDefinition->setArgument('$options', $options);
484484
}
485485
$modelDefinition->addTag('symfony_ai.model.embeddings_model');

0 commit comments

Comments
 (0)