2 namespace Consolidation\OutputFormatters\Exception;
4 use Consolidation\OutputFormatters\Formatters\FormatterInterface;
7 * Represents an incompatibility between the output data and selected formatter.
9 class IncompatibleDataException extends AbstractDataFormatException
11 public function __construct(FormatterInterface $formatter, $data, $allowedTypes)
13 $formatterDescription = get_class($formatter);
14 $dataDescription = static::describeDataType($data);
15 $allowedTypesDescription = static::describeAllowedTypes($allowedTypes);
16 $message = "Data provided to $formatterDescription must be $allowedTypesDescription. Instead, $dataDescription was provided.";
17 parent::__construct($message, 1);