2 namespace Consolidation\OutputFormatters\Validate;
5 * Provides a default implementation of isValidDataType.
7 * Users of this trait are expected to implement ValidDataTypesInterface.
9 trait ValidDataTypesTrait
12 * Return the list of data types acceptable to this formatter
14 * @return \ReflectionClass[]
16 public abstract function validDataTypes();
19 * Return the list of data types acceptable to this formatter
21 public function isValidDataType(\ReflectionClass $dataType)
24 $this->validDataTypes(),
25 function ($carry, $supportedType) use ($dataType) {
28 ($dataType->getName() == $supportedType->getName()) ||
29 ($dataType->isSubclassOf($supportedType->getName()));