Skip to content

Commit

Permalink
Fix a regression caused in #39 (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpdude authored Mar 28, 2024
1 parent c321081 commit 2edab6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/Caching/Attribute/Send304IfNotModified.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Attribute;
use Exception;
use InvalidArgumentException;
use Webfactory\Bundle\WfdMetaBundle\Helper\LastmodHelper;
use Webfactory\Bundle\WfdMetaBundle\MetaQueryFactory;

Expand All @@ -28,6 +29,10 @@ public function __construct(...$values)
\E_USER_DEPRECATED
);

if (!$values) {
throw new InvalidArgumentException(sprintf('The %s attribute needs at least one criterion', __CLASS__));
}

$this->lastmodHelper = new LastmodHelper();

foreach ($values as $key => $value) {
Expand Down
2 changes: 1 addition & 1 deletion src/Caching/EventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ protected function findAttribute($callback): ?Attribute\Send304IfNotModified
$attributes = $method->getAttributes(\Webfactory\Bundle\WfdMetaBundle\Caching\Attribute\Send304IfNotModified::class);

if ($attributes) {
return $attributes[0];
return $attributes[0]->newInstance();
}
}

Expand Down

0 comments on commit 2edab6f

Please sign in to comment.