Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [x.x.x]
### Removed
- \#27 Remove deprecated `doctrine/annotations` implementation

## [5.0.0]
### Added
- \#3 Support for PHP8 attributes @axwel13
Expand Down
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"symfony/config": "^4.4 | ^5.0 | ^6.0 | ^7.0",
"symfony/http-kernel": "^4.4 | ^5.0 | ^6.0 | ^7.0",
"twig/twig": "^1.18|^2.0|^3.0",
"doctrine/annotations": "^1.7 | ^2.0",
"flagception/flagception": "^1.5"
},
"require-dev": {
Expand Down
47 changes: 0 additions & 47 deletions docs/annotation.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/attribute.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Attribute
-------------------------
We recommend to use the route attribute solution, because using annotations has performance issues.
We recommend to use the route attribute solution.
A `NotFoundHttpException` will be thrown if you request an action or class with inactive feature flag.


Expand Down
17 changes: 5 additions & 12 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,16 @@ class BlogController extends Controller
}
```

##### Annotation usage
##### Attribute usage
```php
# FooController.php

use Flagception\Bundle\FlagceptionBundle\Annotations\Feature;
use Flagception\Bundle\FlagceptionBundle\Attribute\Feature;

/**
* @Feature("feature_123")
*/
#[Feature("feature_123")]
class FooController
{

/**
* @Feature("feature_789")
*/
#[Feature("feature_789")]
public function barAction()
{
}
Expand All @@ -112,9 +107,7 @@ class FooController
}
```

If you request an action with inactive feature flag, you will get a `NotFoundHttpException`.

Take a look to the detail documentation for [Twig](twig.md), [Route](route.md) or [Annotation](annotation.md) usage.
Take a look to the detail documentation for [Twig](twig.md), [Route](route.md) or [Attribute](attribute.md) usage.

##### Feature names
You can name your features as you like. But we recommend using [snake case](https://en.wikipedia.org/wiki/Snake_case).
Expand Down
20 changes: 0 additions & 20 deletions src/Annotations/Feature.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->end()
->defaultValue([])
->end()
->arrayNode('annotation')
->addDefaultsIfNotSet()
->children()
->booleanNode('enable')
->beforeNormalization()
->ifString()
->then(function ($value) {
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
})
->end()
->defaultFalse()
->end()
->end()
->end()
->arrayNode('routing_metadata')
->addDefaultsIfNotSet()
->children()
Expand Down
5 changes: 0 additions & 5 deletions src/DependencyInjection/FlagceptionExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public function load(array $configs, ContainerBuilder $container): void
$configuration = new Configuration($configurators);
$config = $this->processConfiguration($configuration, $configs);

// Enable / disable annotation subscriber
if ($config['annotation']['enable'] === false) {
$container->removeDefinition('flagception.listener.annotation_subscriber');
}

// Enable / disable routing metadata subscriber
if ($config['routing_metadata']['enable'] === false) {
$container->removeDefinition('flagception.listener.routing_metadata_subscriber');
Expand Down
104 changes: 0 additions & 104 deletions src/Listener/AnnotationSubscriber.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Listener/AttributeSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Symfony\Component\HttpKernel\KernelEvents;

/**
* Class AnnotationSubscriber
* Class AttributeSubscriber
*
* @author Michel Chowanski <michel.chowanski@bestit-online.de>
* @package Flagception\Bundle\FlagceptionBundle\Listener
Expand Down
10 changes: 0 additions & 10 deletions src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ services:
class: Flagception\Decorator\ChainDecorator
public: false

# Maybe removed by your configuration
flagception.listener.annotation_subscriber:
class: Flagception\Bundle\FlagceptionBundle\Listener\AnnotationSubscriber
arguments:
- '@annotations.reader'
- '@flagception.manager.feature_manager'
tags:
- { name: kernel.event_subscriber }
public: true

# Maybe removed by your configuration
flagception.listener.routing_metadata_subscriber:
class: Flagception\Bundle\FlagceptionBundle\Listener\RoutingMetadataSubscriber
Expand Down
59 changes: 0 additions & 59 deletions tests/DependencyInjection/FlagceptionExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,65 +37,6 @@ protected function setUp(): void
$this->container = $container;
}

/**
* Test that annotation subscriber is disabled
*
* @return void
*/
public function testAnnotationSubscriberDisabled()
{
$config = [];

$extension = new FlagceptionExtension();
$extension->load($config, $this->container);

static::assertFalse($this->container->hasDefinition('flagception.listener.annotation_subscriber'));
}

/**
* Test that annotation subscriber is enabled
*
* @return void
*/
public function testAnnotationSubscriberEnabled()
{
$config = [
[
'annotation' => [
'enable' => true
]
]
];

$extension = new FlagceptionExtension();
$extension->load($config, $this->container);

$definition = $this->container->getDefinition('flagception.listener.annotation_subscriber');
static::assertTrue($definition->hasTag('kernel.event_subscriber'));
}

/**
* Test that annotation subscriber is enabled by string
*
* @return void
*/
public function testAnnotationSubscriberEnabledByString()
{
$config = [
[
'annotation' => [
'enable' => 'true'
]
]
];

$extension = new FlagceptionExtension();
$extension->load($config, $this->container);

$definition = $this->container->getDefinition('flagception.listener.annotation_subscriber');
static::assertTrue($definition->hasTag('kernel.event_subscriber'));
}

/**
* Test that routing metadata subscriber is disabled
*
Expand Down
Loading