skegel
skegel

Sean Kegel

@skegel

Lead Software Engineer @ Curology

11 Posts 111 Views

  • No matching results...
  • Searching...

/ 255

In response to @skegel

Some examples:

    /**
* @param MyObject[] myArray
*/

public function withArray(array $myArray)
{
//
}

/**
* @param MyObject[] myArray
*/

public function withIterable(iterable $myIterable)
{
// Using iterable will support both arrays or Laravel collections.
// However, you may need to use the spread operator to convert
// back to array if needed.
$array = [...$myIterable];
}

/**
* @param Collection<MyObject> myArray
*/

public function withIterable(Collection $myCollection)
{
// This gives all the power of collections which is great,
// however, it requires Laravel collections so not as useful
// outside a Laravel application.
}

2

430