for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Webmozart JSON package.
*
* (c) Bernhard Schussek <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Webmozart\Json;
/**
* Thrown when a JSON file contains invalid JSON.
* @since 1.0
* @author Bernhard Schussek <[email protected]>
class ValidationFailedException extends \Exception
{
private $errors;
public static function fromErrors(array $errors = array(), $code = 0, \Exception $previous = null)
return new static(sprintf(
"Validation of the JSON data failed:\n%s",
implode("\n", $errors)
), $errors, $code, $previous);
}
public function __construct($message = '', array $errors = array(), $code = 0, \Exception $previous = null)
$this->errors = $errors;
parent::__construct($message, $code, $previous);
* @return array
public function getErrors()
return $this->errors;
string
This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.
@return
public function getErrorsAsString()
return implode("\n", $this->errors);
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.