Skip to content

Commit

Permalink
Fix @secure and @transactional annotations wrongly requiring attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Mar 24, 2019
1 parent 3056bb4 commit 01bf66f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Annotation/Secure.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
final class Secure extends AbstractAnnotation
{
/**
* @var string
* @var string|null
*/
public $hsts;

Expand All @@ -34,6 +34,6 @@ final class Secure extends AbstractAnnotation
*/
public function __construct(array $values)
{
$this->hsts = $this->getRequiredString($values, 'hsts', true);
$this->hsts = $this->getOptionalString($values, 'hsts', true);
}
}
12 changes: 7 additions & 5 deletions src/Controller/Annotation/Transactional.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ final class Transactional extends AbstractAnnotation
*/
public function __construct(array $values)
{
$isolationLevel = $this->getRequiredString($values, 'isolationLevel', true);
$isolationLevel = $this->getOptionalString($values, 'isolationLevel', true);

if (! isset(self::ISOLATION_LEVELS[$isolationLevel])) {
throw new \LogicException('Invalid transaction isolation level: ' . $isolationLevel);
}
if ($isolationLevel !== null) {
if (! isset(self::ISOLATION_LEVELS[$isolationLevel])) {
throw new \LogicException('Invalid transaction isolation level: ' . $isolationLevel);
}

$this->isolationLevel = self::ISOLATION_LEVELS[$isolationLevel];
$this->isolationLevel = self::ISOLATION_LEVELS[$isolationLevel];
}
}

/**
Expand Down

0 comments on commit 01bf66f

Please sign in to comment.