ConstraintTrait.php 926 B

1234567891011121314151617181920212223242526272829303132333435363738
  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\Bridge\PhpUnit;
  11. use PHPUnit\Framework\Constraint\Constraint;
  12. use ReflectionClass;
  13. $r = new ReflectionClass(Constraint::class);
  14. if (\PHP_VERSION_ID < 70000 || !$r->getMethod('matches')->hasReturnType()) {
  15. trait ConstraintTrait
  16. {
  17. use Legacy\ConstraintTraitForV6;
  18. }
  19. } elseif ($r->getProperty('exporter')->isProtected()) {
  20. trait ConstraintTrait
  21. {
  22. use Legacy\ConstraintTraitForV7;
  23. }
  24. } elseif (\PHP_VERSION < 70100 || !$r->getMethod('evaluate')->hasReturnType()) {
  25. trait ConstraintTrait
  26. {
  27. use Legacy\ConstraintTraitForV8;
  28. }
  29. } else {
  30. trait ConstraintTrait
  31. {
  32. use Legacy\ConstraintTraitForV9;
  33. }
  34. }