File tree Expand file tree Collapse file tree 2 files changed +8
-56
lines changed
Expand file tree Collapse file tree 2 files changed +8
-56
lines changed Original file line number Diff line number Diff line change @@ -184,19 +184,17 @@ protected function createComponent(string $name): ?IComponent
184184 */
185185 final public function getComponents (): iterable
186186 {
187+ if (func_get_args ()[0 ] ?? null ) {
188+ throw new DeprecatedException ('Using Container::getComponents() with recursive flag is deprecated. Use getComponentTree() instead. ' );
189+ }
190+
187191 $ filterType = func_get_args ()[1 ] ?? null ;
188- if (func_get_args ()[0 ] ?? null ) { // back compatibility
189- $ iterator = new RecursiveComponentIterator ($ this ->components );
190- $ iterator = new \RecursiveIteratorIterator ($ iterator , \RecursiveIteratorIterator::SELF_FIRST );
191- if ($ filterType ) {
192- $ iterator = new \CallbackFilterIterator ($ iterator , fn ($ item ) => $ item instanceof $ filterType );
193- }
194- return $ iterator ;
192+ if ($ filterType ) {
193+ trigger_error ('Using Container::getComponents() with filter type is deprecated. ' , E_USER_DEPRECATED );
194+ return array_filter ($ this ->components , fn ($ item ) => $ item instanceof $ filterType );
195195 }
196196
197- return $ filterType
198- ? array_filter ($ this ->components , fn ($ item ) => $ item instanceof $ filterType )
199- : $ this ->components ;
197+ return $ this ->components ;
200198 }
201199
202200
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments