for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the Cubiche package.
*
* Copyright (c) Cubiche
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cubiche\Core\Collections\Exception;
use InvalidArgumentException;
use Exception;
* InvalidKeyException class.
* @author Ivannis Suárez Jerez <[email protected]>
class InvalidKeyException extends InvalidArgumentException
{
* Creates an exception for an invalid key.
* @param mixed $key
* @param string $message
* @param Exception|null $cause
* @return InvalidKeyException
public static function forKey(
$key,
$message = 'Expected a key of type integer or string. Got: %s',
Exception $cause = null
) {
return new static(sprintf(
$message,
is_object($key) ? get_class($key) : gettype($key)
), 0, $cause);
}