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 @@ -179,19 +179,17 @@ protected function createComponent(string $name): ?IComponent
179179 */
180180 final public function getComponents (): iterable
181181 {
182+ if (func_get_args ()[0 ] ?? null ) {
183+ throw new Nette \DeprecatedException ('Using Container::getComponents() with recursive flag is deprecated. Use getComponentTree() instead. ' );
184+ }
185+
182186 $ filterType = func_get_args ()[1 ] ?? null ;
183- if (func_get_args ()[0 ] ?? null ) { // back compatibility
184- $ iterator = new RecursiveComponentIterator ($ this ->components );
185- $ iterator = new \RecursiveIteratorIterator ($ iterator , \RecursiveIteratorIterator::SELF_FIRST );
186- if ($ filterType ) {
187- $ iterator = new \CallbackFilterIterator ($ iterator , fn ($ item ) => $ item instanceof $ filterType );
188- }
189- return $ iterator ;
187+ if ($ filterType ) {
188+ trigger_error ('Using Container::getComponents() with filter type is deprecated. ' , E_USER_DEPRECATED );
189+ return array_filter ($ this ->components , fn ($ item ) => $ item instanceof $ filterType );
190190 }
191191
192- return $ filterType
193- ? array_filter ($ this ->components , fn ($ item ) => $ item instanceof $ filterType )
194- : $ this ->components ;
192+ return $ this ->components ;
195193 }
196194
197195
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments