Upgrade to 3.1.4

This commit is contained in:
Bastian Allgeier
2019-05-21 12:16:05 +02:00
parent 066913cb6e
commit 9e18cf635d
42 changed files with 215 additions and 109 deletions

View File

@@ -3,6 +3,7 @@
namespace Kirby\Cms;
use Closure;
use Exception;
use Kirby\Exception\InvalidArgumentException;
use Kirby\Toolkit\Collection as BaseCollection;
use Kirby\Toolkit\Str;
@@ -125,8 +126,12 @@ class Collection extends BaseCollection
* @param bool $i (ignore upper/lowercase for group names)
* @return Collection A collection with an item for each group and a Collection for each group
*/
public function groupBy(string $field, bool $i = true)
public function groupBy($field, bool $i = true)
{
if (is_string($field) === false) {
throw new Exception('Cannot group by non-string values. Did you mean to call group()?');
}
$groups = new Collection([], $this->parent());
foreach ($this->data as $key => $item) {