for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Hechoenlaravel\JarvisFoundation\Flows\Transformers;
use League\Fractal\TransformerAbstract;
use Hechoenlaravel\JarvisFoundation\Flows\Step;
/**
* Class StepTransformer
* @package Hechoenlaravel\JarvisFoundation\Flows\Transformers
*/
class StepTransformer extends TransformerAbstract
{
protected $availableIncludes = ['transitions'];
* @param Step $step
* @return array
public function transform(Step $step)
return [
'id' => (int) $step->id,
'name' => $step->name,
'description' => $step->description,
'total_transitions' => $step->transitions->count()
];
}
public function includeTransitions(Step $step)
if ($step->transitions()->count() === 0) {
return null;
$collection = $this->collection($step->transitions, new TransitionTransformer);
new \Hechoenlaravel\Jarv...TransitionTransformer()
object<Hechoenlaravel\Ja...\TransitionTransformer>
callable
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);
return $collection;
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: