Skip to content

Commit ad74b1c

Browse files
Neirda24Jean-Beru
authored andcommitted
[FabBot] Apply some patches
1 parent aff6357 commit ad74b1c

File tree

8 files changed

+52
-55
lines changed

8 files changed

+52
-55
lines changed

src/Symfony/Bundle/FeatureToggleBundle/DataCollector/FeatureCheckerDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function __construct(
6464
public function collect(Request $request, Response $response, \Throwable $exception = null): void
6565
{
6666
foreach ($this->featureCollection as $feature) {
67-
$strategy = (\Closure::bind(fn(): StrategyInterface => $this->strategy, $feature, Feature::class))();
68-
$default = (\Closure::bind(fn(): bool => $this->default, $feature, Feature::class))();
67+
$strategy = (\Closure::bind(fn (): StrategyInterface => $this->strategy, $feature, Feature::class))();
68+
$default = (\Closure::bind(fn (): bool => $this->default, $feature, Feature::class))();
6969

7070
$this->data['features'][$feature->getName()] = [
7171
'default' => $default,

src/Symfony/Bundle/FeatureToggleBundle/DependencyInjection/Configuration.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
* strategies: array<string, ConfigurationStrategy>,
2020
* features: array<string, ConfigurationFeature>
2121
* }
22-
*
2322
* @phpstan-type ConfigurationStrategy array{
2423
* name: string,
2524
* type: string,
2625
* with: array<string, mixed>
2726
* }
28-
*
2927
* @phpstan-type ConfigurationFeature array{
3028
* name: string,
3129
* description: string,
@@ -68,7 +66,7 @@ public function getConfigTreeBuilder(): TreeBuilder
6866
->beforeNormalization()
6967
->always()
7068
->then(static function (array $strategy): array {
71-
$defaultWith = match($strategy['type']) {
69+
$defaultWith = match ($strategy['type']) {
7270
'date' => ['from' => null, 'until' => null, 'includeFrom' => false, 'includeUntil' => false],
7371
'not' => ['strategy' => null],
7472
'env', 'native_request_header', 'native_request_query', 'request_attribute' => ['name' => null],
@@ -88,41 +86,41 @@ public function getConfigTreeBuilder(): TreeBuilder
8886
/** @var ConfigurationStrategy $strategy */
8987
$validator = match ($strategy['type']) {
9088
'date' => static function (array $with): void {
91-
if ('' === trim((string)$with['from'] . (string)$with['until'])) {
89+
if ('' === trim((string) $with['from'].(string) $with['until'])) {
9290
throw new \InvalidArgumentException('Either "from" or "until" must be provided.');
9391
}
9492
},
9593
'not' => static function (array $with): void {
96-
if ('' === (string)$with['strategy']) {
94+
if ('' === (string) $with['strategy']) {
9795
throw new \InvalidArgumentException('"strategy" must be provided.');
9896
}
9997
},
10098
'env' => static function (array $with): void {
101-
if ('' === (string)$with['name']) {
99+
if ('' === (string) $with['name']) {
102100
throw new \InvalidArgumentException('"name" must be provided.');
103101
}
104102
},
105103
'native_request_header' => static function (array $with): void {
106-
if ('' === (string)$with['name']) {
104+
if ('' === (string) $with['name']) {
107105
throw new \InvalidArgumentException('"name" must be provided.');
108106
}
109107
},
110108
'native_request_query' => static function (array $with): void {
111-
if ('' === (string)$with['name']) {
109+
if ('' === (string) $with['name']) {
112110
throw new \InvalidArgumentException('"name" must be provided.');
113111
}
114112
},
115113
'request_attribute' => static function (array $with): void {
116-
if ('' === (string)$with['name']) {
114+
if ('' === (string) $with['name']) {
117115
throw new \InvalidArgumentException('"name" must be provided.');
118116
}
119117
},
120118
'priority', 'affirmative' => static function (array $with): void {
121-
if ([] === (array)$with['strategies']) {
119+
if ([] === (array) $with['strategies']) {
122120
throw new \InvalidArgumentException('"strategies" must be provided.');
123121
}
124122
},
125-
default => static fn(): bool => true,
123+
default => static fn (): bool => true,
126124
};
127125

128126
$validator($strategy['with']);

src/Symfony/Bundle/FeatureToggleBundle/DependencyInjection/FeatureToggleExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function load(array $configs, ContainerBuilder $container): void
3434
/** @var ConfigurationType $config */
3535
$config = $this->processConfiguration(new Configuration(), $configs);
3636

37-
$loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__) . '/Resources/config'));
37+
$loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config'));
3838
$loader->load('feature.php');
3939
$loader->load('providers.php');
4040
$loader->load('strategies.php');

src/Symfony/Bundle/FeatureToggleBundle/Resources/config/debug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
$services->set('feature_toggle.data_collector', FeatureCheckerDataCollector::class)
1111
->args([
12-
'$featureCollection' => service('feature_toggle.feature_collection')
12+
'$featureCollection' => service('feature_toggle.feature_collection'),
1313
])
1414
->tag('data_collector', ['template' => '@FeatureToggle/Collector/profiler.html.twig', 'id' => 'feature_toggle'])
1515
;

src/Symfony/Bundle/FeatureToggleBundle/Resources/config/strategies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
$services = $container->services();
1919
$services->set($prefix.'grant', GrantStrategy::class)->abstract();
2020
$services->set($prefix.'not', NotStrategy::class)->abstract()->args([
21-
'$inner' => abstract_arg('Defined in FeatureToggleExtension')
21+
'$inner' => abstract_arg('Defined in FeatureToggleExtension'),
2222
]);
2323
$services->set($prefix.'env', EnvStrategy::class)->abstract()->args([
2424
'$envName' => abstract_arg('Defined in FeatureToggleExtension'),

src/Symfony/Bundle/FeatureToggleBundle/Strategy/RequestStackAttributeStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function compute(): StrategyResult
3535
return StrategyResult::Abstain;
3636
}
3737

38-
if ($currentRequest->attributes->has($this->attributeName) === false) {
38+
if (false === $currentRequest->attributes->has($this->attributeName)) {
3939
return StrategyResult::Abstain;
4040
}
4141

src/Symfony/Bundle/FeatureToggleBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,14 @@ public static function getBundleDefaultConfig(): array
3838
public function testDefaultConfig(): void
3939
{
4040
$processor = new Processor();
41-
$config = $processor->processConfiguration(
41+
$config = $processor->processConfiguration(
4242
new Configuration(),
4343
[],
4444
);
4545

4646
self::assertEquals(self::getBundleDefaultConfig(), $config);
4747
}
4848

49-
5049
public static function provideValidStrategyNameConfigurationTest(): \Generator
5150
{
5251
yield 'simple name' => ['foobar'];
@@ -60,7 +59,7 @@ public static function provideValidStrategyNameConfigurationTest(): \Generator
6059
public function testValidStrategyNameConfiguration(string $strategyName): void
6160
{
6261
$processor = new Processor();
63-
$config = $processor->processConfiguration(
62+
$config = $processor->processConfiguration(
6463
new Configuration(),
6564
[
6665
[
@@ -90,16 +89,16 @@ public static function provideValidFeatureNameConfigurationTest(): \Generator
9089
public function testValidFeatureNameConfiguration(string $featureName): void
9190
{
9291
$processor = new Processor();
93-
$config = $processor->processConfiguration(
92+
$config = $processor->processConfiguration(
9493
new Configuration(),
9594
[
9695
[
9796
'features' => [
9897
[
99-
'name' => $featureName,
98+
'name' => $featureName,
10099
'description' => "This is the description of {$featureName}",
101-
'strategy' => 'fake-strategy',
102-
'default' => false,
100+
'strategy' => 'fake-strategy',
101+
'default' => false,
103102
],
104103
],
105104
],
@@ -121,7 +120,7 @@ public function testFeatureRequiresDescriptionKey(): void
121120
[
122121
'features' => [
123122
[
124-
'name' => 'some-feature',
123+
'name' => 'some-feature',
125124
'strategy' => 'fake-strategy',
126125
],
127126
],
@@ -142,7 +141,7 @@ public function testFeatureRequiresStrategyKey(): void
142141
[
143142
'features' => [
144143
[
145-
'name' => 'some-feature',
144+
'name' => 'some-feature',
146145
'default' => false,
147146
],
148147
],

src/Symfony/Bundle/FeatureToggleBundle/Tests/DependencyInjection/FeatureToggleExtensionTest.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,55 +37,55 @@ public function getConfig(): array
3737
[
3838
'strategies' => [
3939
[
40-
'name' => 'date.feature-strategy',
41-
'type' => 'date',
42-
'with' => ['from' => '-2 days'],
40+
'name' => 'date.feature-strategy',
41+
'type' => 'date',
42+
'with' => ['from' => '-2 days'],
4343
],
4444
[
45-
'name' => 'env.feature-strategy',
46-
'type' => 'env',
47-
'with' => ['name' => 'SOME_ENV'],
45+
'name' => 'env.feature-strategy',
46+
'type' => 'env',
47+
'with' => ['name' => 'SOME_ENV'],
4848
],
4949
[
50-
'name' => 'native_request_header.feature-strategy',
51-
'type' => 'native_request_header',
52-
'with' => ['name' => 'SOME-HEADER-NAME'],
50+
'name' => 'native_request_header.feature-strategy',
51+
'type' => 'native_request_header',
52+
'with' => ['name' => 'SOME-HEADER-NAME'],
5353
],
5454
[
55-
'name' => 'native_request_query.feature-strategy',
56-
'type' => 'native_request_query',
57-
'with' => ['name' => 'some_query_parameter'],
55+
'name' => 'native_request_query.feature-strategy',
56+
'type' => 'native_request_query',
57+
'with' => ['name' => 'some_query_parameter'],
5858
],
5959
[
60-
'name' => 'request_attribute.feature-strategy',
61-
'type' => 'request_attribute',
62-
'with' => ['name' => 'some_request_attribute'],
60+
'name' => 'request_attribute.feature-strategy',
61+
'type' => 'request_attribute',
62+
'with' => ['name' => 'some_request_attribute'],
6363
],
6464
[
65-
'name' => 'priority.feature-strategy',
66-
'type' => 'priority',
67-
'with' => ['strategies' => ['env.feature-strategy', 'grant.feature-strategy']],
65+
'name' => 'priority.feature-strategy',
66+
'type' => 'priority',
67+
'with' => ['strategies' => ['env.feature-strategy', 'grant.feature-strategy']],
6868
],
6969
[
70-
'name' => 'affirmative.feature-strategy',
71-
'type' => 'affirmative',
72-
'with' => ['strategies' => ['env.feature-strategy', 'grant.feature-strategy']],
70+
'name' => 'affirmative.feature-strategy',
71+
'type' => 'affirmative',
72+
'with' => ['strategies' => ['env.feature-strategy', 'grant.feature-strategy']],
7373
],
7474
[
75-
'name' => 'not.feature-strategy',
76-
'type' => 'not',
77-
'with' => ['strategy' => 'grant.feature-strategy'],
75+
'name' => 'not.feature-strategy',
76+
'type' => 'not',
77+
'with' => ['strategy' => 'grant.feature-strategy'],
7878
],
7979
[
80-
'name' => 'grant.feature-strategy',
81-
'type' => 'grant',
80+
'name' => 'grant.feature-strategy',
81+
'type' => 'grant',
8282
],
8383
[
84-
'name' => 'deny.feature-strategy',
85-
'type' => 'deny',
84+
'name' => 'deny.feature-strategy',
85+
'type' => 'deny',
8686
],
8787
],
88-
'features' => [
88+
'features' => [
8989
],
9090
],
9191
];

0 commit comments

Comments
 (0)