NotIdenticalToValidator.php 796 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Validator\Constraints;
  11. /**
  12. * Validates values aren't identical (!==).
  13. *
  14. * @author Daniel Holmes <daniel@danielholmes.org>
  15. * @author Bernhard Schussek <bschussek@gmail.com>
  16. */
  17. class NotIdenticalToValidator extends AbstractComparisonValidator
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. protected function compareValues($value1, $value2)
  23. {
  24. return $value1 !== $value2;
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. protected function getErrorCode()
  30. {
  31. return NotIdenticalTo::IS_IDENTICAL_ERROR;
  32. }
  33. }