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
16 changes: 7 additions & 9 deletions Neos.Flow/Classes/Annotations/After.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Declares a method as an after advice to be triggered after any
* pointcut matching the given expression.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("METHOD")
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class After
{
/**
* The pointcut expression. (Can be given as anonymous argument.)
* @var string
* @Required
*/
public $pointcutExpression;

/**
* @param array $values
* @throws \InvalidArgumentException
*/
public function __construct(array $values)
public function __construct(string $pointcutExpression)
{
if (!isset($values['value']) && !isset($values['pointcutExpression'])) {
throw new \InvalidArgumentException('An After annotation must specify a pointcut expression.', 1318456620);
}
$this->pointcutExpression = isset($values['pointcutExpression']) ? $values['pointcutExpression'] : $values['value'];
$this->pointcutExpression = $pointcutExpression;
}
}
16 changes: 7 additions & 9 deletions Neos.Flow/Classes/Annotations/AfterReturning.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Declares a method as an after returning advice to be triggered
* after any pointcut matching the given expression returns.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("METHOD")
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class AfterReturning
{
/**
* The pointcut expression. (Can be given as anonymous argument.)
* @var string
* @Required
*/
public $pointcutExpression;

/**
* @param array $values
* @throws \InvalidArgumentException
*/
public function __construct(array $values)
public function __construct(string $pointcutExpression)
{
if (!isset($values['value']) && !isset($values['pointcutExpression'])) {
throw new \InvalidArgumentException('An AfterReturning annotation must specify a pointcut expression.', 1318456618);
}
$this->pointcutExpression = isset($values['pointcutExpression']) ? $values['pointcutExpression'] : $values['value'];
$this->pointcutExpression = $pointcutExpression;
}
}
16 changes: 7 additions & 9 deletions Neos.Flow/Classes/Annotations/AfterThrowing.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Declares a method as an after throwing advice to be triggered
* after any pointcut matching the given expression throws an exception.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("METHOD")
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class AfterThrowing
{
/**
* The pointcut expression. (Can be given as anonymous argument.)
* @var string
* @Required
*/
public $pointcutExpression;

/**
* @param array $values
* @throws \InvalidArgumentException
*/
public function __construct(array $values)
public function __construct(string $pointcutExpression)
{
if (!isset($values['value']) && !isset($values['pointcutExpression'])) {
throw new \InvalidArgumentException('An AfterThrowing annotation must specify a pointcut expression.', 1318456616);
}
$this->pointcutExpression = isset($values['pointcutExpression']) ? $values['pointcutExpression'] : $values['value'];
$this->pointcutExpression = $pointcutExpression;
}
}
16 changes: 7 additions & 9 deletions Neos.Flow/Classes/Annotations/Around.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Declares a method as an around advice to be triggered around any
* pointcut matching the given expression.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("METHOD")
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class Around
{
/**
* The pointcut expression. (Can be given as anonymous argument.)
* @var string
* @Required
*/
public $pointcutExpression;

/**
* @param array $values
* @throws \InvalidArgumentException
*/
public function __construct(array $values)
public function __construct(string $pointcutExpression)
{
if (!isset($values['value']) && !isset($values['pointcutExpression'])) {
throw new \InvalidArgumentException('An Around annotation must specify a pointcut expression.', 1318456614);
}
$this->pointcutExpression = isset($values['pointcutExpression']) ? $values['pointcutExpression'] : $values['value'];
$this->pointcutExpression = $pointcutExpression;
}
}
1 change: 1 addition & 0 deletions Neos.Flow/Classes/Annotations/Aspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
* @Annotation
* @Target("CLASS")
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
final class Aspect
{
}
15 changes: 6 additions & 9 deletions Neos.Flow/Classes/Annotations/Autowiring.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Used to disable autowiring for Dependency Injection on the
* whole class or on the annotated property only.
*
* @Annotation
* @NamedArgumentConstructor
* @Target({"METHOD", "CLASS"})
*/
#[\Attribute(\Attribute::TARGET_METHOD|\Attribute::TARGET_CLASS)]
final class Autowiring
{
/**
Expand All @@ -26,15 +30,8 @@ final class Autowiring
*/
public $enabled = true;

/**
* @param array $values
*/
public function __construct(array $values)
public function __construct(bool $enabled = true)
{
if (isset($values['enabled'])) {
$this->enabled = (boolean)$values['enabled'];
} elseif (isset($values['value'])) {
$this->enabled = (boolean)$values['value'];
}
$this->enabled = $enabled;
}
}
16 changes: 7 additions & 9 deletions Neos.Flow/Classes/Annotations/Before.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,28 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Declares a method as an before advice to be triggered before any
* pointcut matching the given expression.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("METHOD")
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class Before
{
/**
* The pointcut expression. (Can be given as anonymous argument.)
* @var string
* @Required
*/
public $pointcutExpression;

/**
* @param array $values
* @throws \InvalidArgumentException
*/
public function __construct(array $values)
public function __construct(string $pointcutExpression)
{
if (!isset($values['value']) && !isset($values['pointcutExpression'])) {
throw new \InvalidArgumentException('A Before annotation must specify a pointcut expression.', 1318456622);
}
$this->pointcutExpression = isset($values['pointcutExpression']) ? $values['pointcutExpression'] : $values['value'];
$this->pointcutExpression = $pointcutExpression;
}
}
1 change: 1 addition & 0 deletions Neos.Flow/Classes/Annotations/CompileStatic.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* @Annotation
* @DoctrineAnnotation\Target({"METHOD"})
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class CompileStatic
{
}
12 changes: 11 additions & 1 deletion Neos.Flow/Classes/Annotations/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,24 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Marks an object as an entity.
*
* Behaves like \Doctrine\ORM\Mapping\Entity so it is interchangeable
* with that.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("CLASS")
*/
#[\Attribute(\Attribute::TARGET_CLASS)]
final class Entity
{
/**
* Name of the repository class to use for managing the entity.
* @var string
* @var string|null
*/
public $repositoryClass;

Expand All @@ -33,4 +37,10 @@ final class Entity
* @var boolean
*/
public $readOnly = false;

public function __construct(?string $repositoryClass = null, bool $readOnly = false)
{
$this->repositoryClass = $repositoryClass;
$this->readOnly = $readOnly;
}
}
1 change: 1 addition & 0 deletions Neos.Flow/Classes/Annotations/FlushesCaches.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @Annotation
* @Target("METHOD")
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
final class FlushesCaches
{
}
1 change: 1 addition & 0 deletions Neos.Flow/Classes/Annotations/Identity.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @Annotation
* @Target("PROPERTY")
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class Identity
{
}
19 changes: 7 additions & 12 deletions Neos.Flow/Classes/Annotations/IgnoreValidation.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Used to ignore validation on a specific method argument or class property.
*
* By default no validation will be executed for the given argument. To gather validation results for further
* processing, the "evaluate" option can be set to true (while still ignoring any validation error).
*
* @Annotation
* @NamedArgumentConstructor
* @Target({"METHOD", "PROPERTY"})
*/
#[\Attribute(\Attribute::TARGET_METHOD|\Attribute::TARGET_PROPERTY|\Attribute::IS_REPEATABLE)]
final class IgnoreValidation
{
/**
Expand All @@ -34,18 +38,9 @@ final class IgnoreValidation
*/
public $evaluate = false;

/**
* @param array $values
* @throws \InvalidArgumentException
*/
public function __construct(array $values)
public function __construct(string $argumentName, bool $evaluate = false)
{
if (isset($values['value']) || isset($values['argumentName'])) {
$this->argumentName = ltrim(isset($values['argumentName']) ? $values['argumentName'] : $values['value'], '$');
}

if (isset($values['evaluate'])) {
$this->evaluate = (boolean)$values['evaluate'];
}
$this->argumentName = ltrim($argumentName, '$');
$this->evaluate = $evaluate;
}
}
16 changes: 8 additions & 8 deletions Neos.Flow/Classes/Annotations/Inject.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
* source code.
*/

use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* Used to enable property injection.
*
* Flow will build Dependency Injection code for the property and try
* to inject a value as specified by the var annotation.
*
* @Annotation
* @NamedArgumentConstructor
* @Target("PROPERTY")
*/
#[\Attribute(\Attribute::TARGET_PROPERTY)]
final class Inject
{
/**
Expand All @@ -35,20 +39,16 @@ final class Inject
* This is useful if the object name does not match the class name of the object to be injected:
* (at)Inject(name="Some.Package:Some.Virtual.Object")
*
* @var string
* @var string|null
*/
public $name;

/**
* @param array $values
*/
public function __construct(array $values)
public function __construct(?string $name = null, bool $lazy = true)
{
if (isset($values['lazy'])) {
$this->lazy = (boolean)$values['lazy'];
}
if (isset($values['name'])) {
$this->name = $values['name'];
}
$this->lazy = $lazy;
$this->name = $name;
}
}
Loading