Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForUnsupportedTypeForIdenticalValuesCheck PHP Method

createForUnsupportedTypeForIdenticalValuesCheck() public static method

public static createForUnsupportedTypeForIdenticalValuesCheck ( $value ) : InvalidArgumentException
return InvalidArgumentException
    public static function createForUnsupportedTypeForIdenticalValuesCheck($value) : \InvalidArgumentException
    {
        return new \InvalidArgumentException(sprintf('Unsupported type "%s": cannot determine if two values of this type are identical.', gettype($value)));
    }

Usage Example

Example #1
0
 private function isIdentical($val1, $val2) : bool
 {
     if (gettype($val1) !== gettype($val2)) {
         return false;
     }
     if (is_object($val1)) {
         return $val1 == $val2;
     }
     if (is_scalar($val1) || null === $val1) {
         return $val1 === $val2;
     }
     if (false === is_array($val1)) {
         throw InvalidArgumentExceptionFactory::createForUnsupportedTypeForIdenticalValuesCheck($val1);
     }
     foreach ($val1 as $key => $item) {
         if (is_string($key)) {
             if (false === $this->isIdentical($item, $val2[$key])) {
                 return false;
             }
             continue;
         }
         if (false === $this->arrayHasValue($item, $val2)) {
             return false;
         }
     }
     return true;
 }
All Usage Examples Of Nelmio\Alice\Throwable\Exception\InvalidArgumentExceptionFactory::createForUnsupportedTypeForIdenticalValuesCheck