1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This software package is licensed under AGPL, Commercial license. |
5
|
|
|
* |
6
|
|
|
* @package maslosoft/addendum |
7
|
|
|
* @licence AGPL, Commercial |
8
|
|
|
* @copyright Copyright (c) Piotr Masełkowski <[email protected]> (Meta container, further improvements, bugfixes) |
9
|
|
|
* @copyright Copyright (c) Maslosoft (Meta container, further improvements, bugfixes) |
10
|
|
|
* @copyright Copyright (c) Jan Suchal (Original version, builder, parser) |
11
|
|
|
* @link https://maslosoft.com/addendum/ - maslosoft addendum |
12
|
|
|
* @link https://code.google.com/p/addendum/ - original addendum project |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
namespace Maslosoft\Addendum\Annotations; |
16
|
|
|
|
17
|
|
|
use Maslosoft\Addendum\Collections\MetaAnnotation; |
18
|
|
|
use Maslosoft\Addendum\Interfaces\AnnotationInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Disallow annotation if some other annotation exists. This is to avoid using conflicting annotations. |
22
|
|
|
* |
23
|
|
|
* This annotation can only be used on other annotation classes. |
24
|
|
|
* Only annotation name should be used here, *not* annotation class name. |
25
|
|
|
* |
26
|
|
|
* Do not use class literals here. Only annotation name as string is recommended. |
27
|
|
|
* |
28
|
|
|
* Assume we are defining `MyAnnotation` annotation, and want to forbid |
29
|
|
|
* using this annotation with `CombinedAnnotation`. |
30
|
|
|
* To achieve this use `Conflicts` annotation: |
31
|
|
|
* |
32
|
|
|
* ``` |
33
|
|
|
* @Conflicts('Combined') |
34
|
|
|
* ``` |
35
|
|
|
* @Target(\Maslosoft\Addendum\Interfaces\AnnotationInterface) |
36
|
|
|
* @template Conflicts('${annotation}') |
37
|
|
|
* @see AnnotationInterface |
38
|
|
|
*/ |
39
|
|
|
class ConflictsAnnotation extends MetaAnnotation |
40
|
|
|
{ |
41
|
|
|
|
42
|
|
|
public $value; |
43
|
|
|
|
44
|
|
|
public function init() |
45
|
|
|
{ |
46
|
|
|
// Init not required, $value is directly used |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
} |
50
|
|
|
|