for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Consolidation\Filter\Hooks;
use Consolidation\AnnotatedCommand\CommandData;
use Consolidation\Filter\LogicalOpFactory;
use Consolidation\Filter\FilterOutputData;
use Symfony\Component\Yaml\Yaml;
class FilterHooks
{
/**
* @hook alter @filter-output
* @option $filter Filter output based on provided expression
* @default $filter ''
*/
public function filterOutput($result, CommandData $commandData)
$expr = $commandData->input()->getOption('filter');
$default_field = $commandData->annotationData()->get('filter-default-field');
if (!empty($expr)) {
$factory = LogicalOpFactory::get();
$op = $factory->evaluate($expr, $default_field);
$default_field
string
boolean
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$filter = new FilterOutputData();
$result = $this->wrapFilteredResult($filter->filter($result, $op), $result);
}
return $result;
* If the source data was wrapped in a marker class such
* as RowsOfFields, then re-apply the wrapper.
protected function wrapFilteredResult($data, $source)
if (!$source instanceof \ArrayObject) {
return $data;
$sourceClass = get_class($source);
return new $sourceClass($data);
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: