Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -1,27 +1,30 @@
|
||||
<?php
|
||||
namespace GraphQL\Validator\Rules;
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace GraphQL\Validator\Rules;
|
||||
|
||||
use GraphQL\Error\Error;
|
||||
use GraphQL\Validator\ValidationContext;
|
||||
|
||||
class CustomValidationRule extends AbstractValidationRule
|
||||
class CustomValidationRule extends ValidationRule
|
||||
{
|
||||
/** @var callable */
|
||||
private $visitorFn;
|
||||
|
||||
public function __construct($name, callable $visitorFn)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->name = $name;
|
||||
$this->visitorFn = $visitorFn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ValidationContext $context
|
||||
* @return Error[]
|
||||
*/
|
||||
public function getVisitor(ValidationContext $context)
|
||||
{
|
||||
$fn = $this->visitorFn;
|
||||
|
||||
return $fn($context);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user