Skip to content

Commit 5750f66

Browse files
committed
Merge remote-tracking branch 'origin/1.x' into 1-to-2
2 parents b8451d3 + 3fdfecc commit 5750f66

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee
1919

2020
# Version 1
2121

22+
# 1.34.1 - 2024-09-01
23+
24+
- The rate-limiter name in the throttle plugin configuration is required.
25+
2226
# 1.34.0 - 2024-06-17
2327

2428
- Support to configure the throttle plugin.

composer.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@
5252
},
5353
"require-dev": {
5454
"guzzlehttp/psr7": "^1.7 || ^2.0",
55-
"matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0",
55+
"matthiasnoback/symfony-config-test": "^4.3 || ^5.0",
56+
"matthiasnoback/symfony-dependency-injection-test": "^4.3.1 || ^5.0",
5657
"nyholm/nsa": "^1.1",
5758
"nyholm/psr7": "^1.2.1",
5859
"php-http/cache-plugin": "^1.7",
5960
"php-http/throttle-plugin": "^1.1",
6061
"php-http/mock-client": "^1.2",
6162
"php-http/promise": "^1.0",
63+
"phpunit/phpunit": "^9.6",
6264
"symfony/browser-kit": "^5.4 || ^6.0 || ^7.0",
6365
"symfony/cache": "^5.4 || ^6.0 || ^7.0",
6466
"symfony/dom-crawler": "^5.4 || ^6.0 || ^7.0",
@@ -97,7 +99,7 @@
9799
},
98100
"prefer-stable": false,
99101
"scripts": {
100-
"test": "vendor/bin/simple-phpunit",
101-
"test-ci": "vendor/bin/simple-phpunit --coverage-text --coverage-clover=build/coverage.xml"
102+
"test": "vendor/bin/phpunit",
103+
"test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml"
102104
}
103105
}

src/DependencyInjection/Configuration.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ private function addSharedPluginNodes(ArrayNodeDefinition $pluginNode, $disableA
611611
->end();
612612
// End stopwatch plugin
613613

614-
$error = $children->arrayNode('error')
614+
$children->arrayNode('error')
615615
->canBeEnabled()
616616
->addDefaultsIfNotSet()
617617
->children()
@@ -620,11 +620,14 @@ private function addSharedPluginNodes(ArrayNodeDefinition $pluginNode, $disableA
620620
->end();
621621
// End error plugin
622622

623-
$throttle = $children->arrayNode('throttle')
623+
$children->arrayNode('throttle')
624624
->canBeEnabled()
625625
->addDefaultsIfNotSet()
626626
->children()
627-
->scalarNode('name')->end()
627+
->scalarNode('name')
628+
->info('The name of the configured symfony/rate-limiter to use')
629+
->isRequired()
630+
->end()
628631
->scalarNode('key')->defaultNull()->end()
629632
->integerNode('tokens')->defaultValue(1)->end()
630633
->floatNode('max_time')->defaultNull()->end()

src/DependencyInjection/HttplugExtension.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,13 @@ private function configurePluginByName($name, Definition $definition, array $con
291291
throw new InvalidConfigurationException('You need to require the Throttle Plugin to be able to use it: "composer require php-http/throttle-plugin".');
292292
}
293293

294-
$key = $config['name'] ? '.'.$config['name'] : '';
295294
$container
296-
->register($serviceId.$key, LimiterInterface::class)
295+
->register($serviceId.$config['name'], LimiterInterface::class)
297296
->setFactory([new Reference('limiter.'.$config['name']), 'create'])
298297
->addArgument($config['key'])
299298
->setPublic(false);
300299

301-
$definition->replaceArgument(0, new Reference($serviceId.$key));
300+
$definition->replaceArgument(0, new Reference($serviceId.$config['name']));
302301
$definition->setArgument('$tokens', $config['tokens']);
303302
$definition->setArgument('$maxTime', $config['max_time']);
304303

0 commit comments

Comments
 (0)