Skip to content

Commit

Permalink
Attributes function
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed May 2, 2024
1 parent 3129ef1 commit 5ab5d44
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
use Tempest\Container\GenericContainer;
use Tempest\Events\EventBus;
use Tempest\Support\Reflection\Attributes;

/**
* @template TClassName
Expand All @@ -25,4 +26,14 @@ function event(object $event): void

$eventBus->dispatch($event);
}

/**
* @template T of object
* @param class-string<T> $attributeName
* @return \Tempest\Support\Reflection\Attributes<T>
*/
function attribute(string $attributeName): Attributes
{
return Attributes::find($attributeName);
}
}

0 comments on commit 5ab5d44

Please sign in to comment.