4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Validator\Constraints;
14 use Symfony\Component\Validator\Constraint;
18 * @Target({"CLASS", "PROPERTY", "METHOD", "ANNOTATION"})
20 * @author Bernhard Schussek <bschussek@gmail.com>
22 class Callback extends Constraint
25 * @var string|callable
32 public function __construct($options = null)
34 // Invocation through annotations with an array parameter only
35 if (is_array($options) && 1 === count($options) && isset($options['value'])) {
36 $options = $options['value'];
39 if (is_array($options) && !isset($options['callback']) && !isset($options['groups']) && !isset($options['payload'])) {
40 $options = array('callback' => $options);
43 parent::__construct($options);
49 public function getDefaultOption()
57 public function getTargets()
59 return array(self::CLASS_CONSTRAINT, self::PROPERTY_CONSTRAINT);