3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface ValidatorInterfaceFirst { public function validate($value, $groups = null, $traverse = false, $deep = false); public function validateProperty($containingValue, $property, $groups = null); public function validatePropertyValue($containingValue, $property, $value, $groups = null); public function validateValue($value, $constraints, $groups = null); public function getMetadataFactory(); } interface ValidatorInterfaceSecond { public function validate($value, $constraints = null, $groups = null); public function validateProperty($object, $propertyName, $groups = null); public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null); public function startContext(); public function inContext(ExecutionContextInterface $context); } class RecursiveValidator implements ValidatorInterfaceFirst, ValidatorInterfaceSecond { protected $contextFactory; protected $metadataFactory; protected $validatorFactory; protected $objectInitializers; public function __construct($contextFactory, $metadataFactory, $validatorFactory, array $objectInitializers = array()) { $this->contextFactory = $contextFactory; $this->metadataFactory = $metadataFactory; $this->validatorFactory = $validatorFactory; $this->objectInitializers = $objectInitializers; } public function startContext($root = null) { /* return new RecursiveContextualValidator( $this->contextFactory->createContext($this, $root), $this->metadataFactory, $this->validatorFactory, $this->objectInitializers ); */ } public function inContext($context) { /* return new RecursiveContextualValidator( $context, $this->metadataFactory, $this->validatorFactory, $this->objectInitializers ); */ } public function getMetadataFor($object) { //return $this->metadataFactory->getMetadataFor($object); } public function hasMetadataFor($object) { //return $this->metadataFactory->hasMetadataFor($object); } public function validate($value, $groups = null, $traverse = false, $deep = false) { /* $numArgs = func_num_args(); if (self::testConstraints($groups) && ($numArgs < 3 || 3 === $numArgs && self::testGroups($traverse))) { $constraints = $groups; $groups = $traverse; } else { trigger_error('The Symfony\Component\Validator\ValidatorInterface::validate method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.', E_USER_DEPRECATED); $constraints = new Valid(array('traverse' => $traverse, 'deep' => $deep)); } return $this->startContext($value) ->validate($value, $constraints, $groups) ->getViolations(); */ } public function validateProperty($object, $propertyName, $groups = null) { return $this->startContext($object) ->validateProperty($object, $propertyName, $groups) ->getViolations(); } public function validatePropertyValue($objectOrClass, $propertyName, $value, $groups = null) { return $this->startContext(is_object($objectOrClass) ? $objectOrClass : $value) ->validatePropertyValue($objectOrClass, $propertyName, $value, $groups) ->getViolations(); } public function validateValue($value, $constraints, $groups = null) { trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::validate method instead.'); return $this->validate($value, $constraints, $groups); } public function getMetadataFactory() { trigger_error('The '.__METHOD__.' method is deprecated in version 2.5 and will be removed in version 3.0. Use the Symfony\Component\Validator\Validator\ValidatorInterface::getMetadataFor or Symfony\Component\Validator\Validator\ValidatorInterface::hasMetadataFor method instead.'); return $this->metadataFactory; } private static function testConstraints($constraints) { return null === $constraints || $constraints instanceof Constraint || (is_array($constraints) && current($constraints) instanceof Constraint); } private static function testGroups($groups) { return null === $groups || is_string($groups) || $groups instanceof GroupSequence || (is_array($groups) && (is_string(current($groups)) || current($groups) instanceof GroupSequence)); } } $obj = new RecursiveValidator();
Output for 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ArgumentCountError: Too few arguments to function RecursiveValidator::__construct(), 0 passed in /in/7jBGh on line 113 and at least 3 expected in /in/7jBGh:26 Stack trace: #0 /in/7jBGh(113): RecursiveValidator->__construct() #1 {main} thrown in /in/7jBGh on line 26
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20
Fatal error: Declaration of RecursiveValidator::inContext($context) must be compatible with ValidatorInterfaceSecond::inContext(ExecutionContextInterface $context) in /in/7jBGh on line 20
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Fatal error: Declaration of RecursiveValidator::inContext() must be compatible with ValidatorInterfaceSecond::inContext(ExecutionContextInterface $context) in /in/7jBGh on line 21
Process exited with code 255.
Output for 5.3.9 - 5.3.29
Fatal error: Declaration of RecursiveValidator::inContext() must be compatible with that of ValidatorInterfaceSecond::inContext() in /in/7jBGh on line 21
Process exited with code 255.
Output for 5.3.0 - 5.3.8
Fatal error: Can't inherit abstract function ValidatorInterfaceSecond::validate() (previously declared abstract in ValidatorInterfaceFirst) in /in/7jBGh on line 21
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Fatal error: Can't inherit abstract function ValidatorInterfaceSecond::validate() (previously declared abstract in ValidatorInterfaceFirst) in /in/7jBGh on line 20
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/7jBGh on line 26
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/7jBGh on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/7jBGh on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/7jBGh on line 2
Process exited with code 255.

preferences:
224.78 ms | 401 KiB | 313 Q