forked from doctrine/annotations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow usage of self:: accessor for constants
ex: @annotation(self::VALUE) Fixes doctrine#269
- Loading branch information
1 parent
2dceb19
commit dc1e9ea
Showing
4 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...ctrine/Tests/Common/Annotations/Fixtures/ClassWithAnnotationWithSelfConstantReference.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Common\Annotations\Fixtures; | ||
|
||
use Doctrine\Tests\Common\Annotations\Fixtures\Traits\TraitWithSelfConstantReferenceTrait; | ||
|
||
/** @AnnotationWithConstants(self::VALUE_FOR_CLASS) */ | ||
class ClassWithAnnotationWithSelfConstantReference | ||
{ | ||
use TraitWithSelfConstantReferenceTrait; | ||
|
||
public const VALUE_FOR_CLASS = 'ClassWithAnnotationWithSelfConstantReference.VALUE_FROM_CLASS'; | ||
public const VALUE_FOR_TRAIT = 'ClassWithAnnotationWithSelfConstantReference.VALUE_FOR_TRAIT'; | ||
|
||
/** | ||
* @var mixed | ||
* @AnnotationWithConstants(self::VALUE_FOR_CLASS) | ||
*/ | ||
private $classProperty; | ||
|
||
/** | ||
* @return mixed | ||
* | ||
* @AnnotationWithConstants(self::VALUE_FOR_CLASS) | ||
*/ | ||
public function classMethod() | ||
{ | ||
return $this->classProperty; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...Doctrine/Tests/Common/Annotations/Fixtures/Traits/TraitWithSelfConstantReferenceTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Common\Annotations\Fixtures\Traits; | ||
|
||
use Doctrine\Tests\Common\Annotations\Fixtures\AnnotationWithConstants; | ||
|
||
trait TraitWithSelfConstantReferenceTrait | ||
{ | ||
/** | ||
* @var mixed | ||
* @AnnotationWithConstants(self::VALUE_FOR_TRAIT) | ||
*/ | ||
private $traitProperty; | ||
|
||
/** @AnnotationWithConstants(self::VALUE_FOR_TRAIT) */ | ||
public function traitMethod(): void | ||
{ | ||
} | ||
} |