Skip to content

Commit 1f234d4

Browse files
committedJan 14, 2022
Rename all occurences of annotation to attribute
1 parent a1e79b5 commit 1f234d4

File tree

5 files changed

+14
-15
lines changed

5 files changed

+14
-15
lines changed
 

‎composer-require-checker.json

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"BOMO\\IcalBundle\\Model\\Event",
88
"BOMO\\IcalBundle\\Model\\Timezone",
99
"BOMO\\IcalBundle\\Provider\\IcsProvider",
10-
"Doctrine\\Common\\Annotations\\AnnotationReader",
1110
"Doctrine\\Common\\Collections\\Collection",
1211
"Doctrine\\Common\\EventSubscriber",
1312
"Doctrine\\DBAL\\Platforms\\AbstractPlatform",

‎config/packages/drenso_shared.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ drenso_shared:
3030
enabled: false # Enable the JMS twig integration (automatically true when you specify any of the options below and omit this line)
3131
services:
3232
feature_flags:
33-
enabled: true # Enable the feature flags service and annotations (automatically true when you specify any of the options below and omit this line)
33+
enabled: true # Enable the feature flags service and attributes (automatically true when you specify any of the options below and omit this line)
3434
configuration_file: '' # The JSON file location where your flags are configured, for example '%env(resolve:FEATURES_FILE)%'
3535
configuration_local_file: '' # Not required, but can be used to override flags in the main configuration file outside of version control
3636
gravatar:

‎src/Command/CheckActionSecurityCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9191
// Create ReflectionMethod
9292
$reflectedMethod = new ReflectionMethod($controllerObject, $action);
9393
$attrFlags = ReflectionAttribute::IS_INSTANCEOF;
94-
// Check if Route annotation exists
94+
// Check if Route attribute exists
9595
if ($reflectedMethod->getAttributes(Route::class, $attrFlags)) {
96-
// Check if Security or IsGranted annotation exists, if not raise error
96+
// Check if Security or IsGranted attribute exists, if not raise error
9797
if (!$reflectedMethod->getAttributes(Security::class, $attrFlags) &&
9898
!$reflectedMethod->getAttributes(IsGranted::class, $attrFlags) &&
9999
(!$allowClass || !(new ReflectionClass($controllerObject))->getAttributes(IsGranted::class, $attrFlags))) {
@@ -110,7 +110,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
110110
if (!empty($noSecurity)) {
111111
$error = [];
112112
// Concatenate non-pre-authorized methods
113-
$error[] = 'The following methods do not contain a Security or IsGranted annotation:';
113+
$error[] = 'The following methods do not contain a Security or IsGranted attribute:';
114114
$error = [...$error, ...$noSecurity];
115115

116116
// Feedback error
@@ -120,7 +120,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
120120
}
121121

122122
// No errors occurred!
123-
$io->success('All methods contain a Security or IsGranted annotation!');
123+
$io->success('All methods contain a Security or IsGranted attribute!');
124124

125125
if ($output->isVerbose()) {
126126
$output->writeln("Checked controllers:");

‎src/FeatureFlags/RequireFeatureListener.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ public function onKernelControllerArguments(ControllerArgumentsEvent $event)
2020
{
2121
$request = $event->getRequest();
2222

23-
/** @var $annotations RequireFeature[] */
24-
if (!$annotations = $request->attributes->get('_drenso_require_feature')) {
23+
/** @var $attributes RequireFeature[] */
24+
if (!$attributes = $request->attributes->get('_drenso_require_feature')) {
2525
return;
2626
}
2727

28-
foreach ($annotations as $annotation) {
29-
if (!$this->featureFlags->getFlagValue($annotation->flag)) {
30-
throw new NotFoundHttpException(sprintf('Feature disabled (%s)', $annotation->flag));
28+
foreach ($attributes as $attribute) {
29+
if (!$this->featureFlags->getFlagValue($attribute->flag)) {
30+
throw new NotFoundHttpException(sprintf('Feature disabled (%s)', $attribute->flag));
3131
}
3232
}
3333
}

‎src/LockableController/UseLockListener.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ public function onKernelControllerArguments(ControllerArgumentsEvent $event)
2929
{
3030
$request = $event->getRequest();
3131

32-
/** @var $annotations UseLock[] */
33-
if (!$annotations = $request->attributes->get('_drenso_use_lock')) {
32+
/** @var $attributes UseLock[] */
33+
if (!$attributes = $request->attributes->get('_drenso_use_lock')) {
3434
return;
3535
}
3636

37-
foreach ($annotations as $annotation) {
38-
$lock = $this->lockFactory->createLock($annotation->lockName);
37+
foreach ($attributes as $attribute) {
38+
$lock = $this->lockFactory->createLock($attribute->lockName);
3939
$lock->acquire(true);
4040
$this->locks[] = $lock;
4141
}

0 commit comments

Comments
 (0)
Please sign in to comment.