mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-21 16:02:23 +02:00
fix function callback in assert callback
This commit is contained in:
parent
b221a16f06
commit
09c926baf2
@ -20,7 +20,7 @@ final class AssertChoiceTagValueNode extends AbstractConstraintTagValueNode
|
||||
public const CLASS_NAME = Choice::class;
|
||||
|
||||
/**
|
||||
* @var mixed[]|null
|
||||
* @var mixed[]|string|null
|
||||
*/
|
||||
private $callback;
|
||||
|
||||
@ -30,9 +30,9 @@ final class AssertChoiceTagValueNode extends AbstractConstraintTagValueNode
|
||||
private $strict;
|
||||
|
||||
/**
|
||||
* @param mixed[]|null $callback
|
||||
* @param mixed[]|string|null $callback
|
||||
*/
|
||||
public function __construct(?array $callback, ?bool $strict, string $annotationContent)
|
||||
public function __construct($callback, ?bool $strict, string $annotationContent)
|
||||
{
|
||||
$this->callback = $callback;
|
||||
$this->strict = $strict;
|
||||
@ -44,7 +44,11 @@ final class AssertChoiceTagValueNode extends AbstractConstraintTagValueNode
|
||||
$contentItems = [];
|
||||
|
||||
if ($this->callback) {
|
||||
$contentItems['callback'] = $this->printArrayItem($this->callback, 'callback');
|
||||
if (is_array($this->callback)) {
|
||||
$contentItems['callback'] = $this->printArrayItem($this->callback, 'callback');
|
||||
} else {
|
||||
$contentItems['callback'] = sprintf('callback="%s"', $this->callback);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->strict !== null) {
|
||||
|
@ -26,6 +26,7 @@ final class CompleteImportForPartialAnnotationRector extends AbstractRector
|
||||
private const DEFAULT_IMPORTS_TO_RESTORE = [
|
||||
['Doctrine\ORM\Mapping', 'ORM'],
|
||||
['Symfony\Component\Validator\Constraints', 'Assert'],
|
||||
['JMS\Serializer\Annotation', 'Serializer'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user