Fix FiltersCollection::getIterator in case of empty collection
This commit is contained in:
		
					parent
					
						
							
								1de948faba
							
						
					
				
			
			
				commit
				
					
						e43da86152
					
				
			
		
					 2 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -47,8 +47,12 @@ class FiltersCollection implements \Countable, \IteratorAggregate
 | 
			
		|||
    public function getIterator()
 | 
			
		||||
    {
 | 
			
		||||
        if (null === $this->sorted) {
 | 
			
		||||
            krsort($this->filters);
 | 
			
		||||
            $this->sorted = call_user_func_array('array_merge', $this->filters);
 | 
			
		||||
            if (0 === count($this->filters)) {
 | 
			
		||||
                $this->sorted = $this->filters;
 | 
			
		||||
            } else {
 | 
			
		||||
                krsort($this->filters);
 | 
			
		||||
                $this->sorted = call_user_func_array('array_merge', $this->filters);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new \ArrayIterator($this->sorted);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue