Skip to content

Commit c4842ba

Browse files
committed
move to FrameworkBundle (#9)
* move to FrameworkBundle * review * test
1 parent 00bed51 commit c4842ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+744
-978
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"symfony/error-handler": "self.version",
7474
"symfony/event-dispatcher": "self.version",
7575
"symfony/expression-language": "self.version",
76-
"symfony/feature-toggle": "self.version",
76+
"symfony/feature-flags": "self.version",
7777
"symfony/filesystem": "self.version",
7878
"symfony/finder": "self.version",
7979
"symfony/form": "self.version",

src/Symfony/Bundle/FeatureFlagsBundle/Twig/FeatureEnabledExtension.php renamed to src/Symfony/Bridge/Twig/Extension/FeatureFlagsExtension.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,18 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\FeatureFlagsBundle\Twig;
12+
namespace Symfony\Bridge\Twig\Extension;
1313

1414
use Symfony\Component\FeatureFlags\FeatureCheckerInterface;
1515
use Twig\Extension\AbstractExtension;
1616
use Twig\TwigFunction;
1717

18-
final class FeatureEnabledExtension extends AbstractExtension
18+
final class FeatureFlagsExtension extends AbstractExtension
1919
{
20-
public function __construct(
21-
private readonly FeatureCheckerInterface $featureEnabledChecker,
22-
) {
23-
}
24-
2520
public function getFunctions(): array
2621
{
2722
return [
28-
new TwigFunction('is_feature_enabled', $this->featureEnabledChecker->isEnabled(...)),
23+
new TwigFunction('is_feature_enabled', [FeatureFlagsRuntime::class, 'isFeatureEnabled']),
2924
];
3025
}
3126
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Twig\Extension;
13+
14+
use Symfony\Component\FeatureFlags\FeatureCheckerInterface;
15+
16+
final class FeatureFlagsRuntime
17+
{
18+
public function __construct(private readonly ?FeatureCheckerInterface $featureEnabledChecker = null)
19+
{
20+
}
21+
22+
public function isFeatureEnabled(string $featureName): bool
23+
{
24+
if (null === $this->featureEnabledChecker) {
25+
throw new \LogicException(sprintf('An instance of "%s" must be provided to use "%s()".', FeatureCheckerInterface::class, __METHOD__));
26+
}
27+
28+
return $this->featureEnabledChecker->isEnabled($featureName);
29+
}
30+
}

src/Symfony/Bundle/FeatureFlagsBundle/.gitattributes

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/Symfony/Bundle/FeatureFlagsBundle/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

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

Lines changed: 0 additions & 147 deletions
This file was deleted.

src/Symfony/Bundle/FeatureFlagsBundle/DependencyInjection/FeatureFlagsExtension.php

Lines changed: 0 additions & 128 deletions
This file was deleted.

src/Symfony/Bundle/FeatureFlagsBundle/FeatureFlagsBundle.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/Symfony/Bundle/FeatureFlagsBundle/LICENSE

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)