for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace TheCodingMachine\GraphQL\Controllers\Annotations;
/**
* @Annotation
* @Target({"METHOD"})
* @Attributes({
* @Attribute("name", type = "string"),
* })
*/
class Right
{
* @var string
private $name;
* @param array $values
*
* @throws \BadMethodCallException
public function __construct(array $values)
if (!isset($values['value']) && !isset($values['name'])) {
throw new \BadMethodCallException('The @Right annotation must be passed a right name. For instance: "@Right(\'my_right\')"');
}
$this->name = $values['value'] ?? $values['name'];
* @return string
public function getName(): string
return $this->name;