File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 3333namespace SQLParser \Node ;
3434
3535use Doctrine \DBAL \Connection ;
36+ use function is_iterable ;
3637use Mouf \MoufInstanceDescriptor ;
3738use Mouf \MoufManager ;
3839use SQLParser \Node \Traverser \NodeTraverser ;
@@ -263,10 +264,14 @@ public function walk(VisitorInterface $visitor)
263264 */
264265 public function canBeBypassed (array $ parameters ): bool
265266 {
266- foreach ($ this ->subTree as $ node ) {
267- if (!$ node instanceof BypassableInterface || !$ node ->canBeBypassed ($ parameters )) {
268- return false ;
267+ if (is_iterable ($ this ->subTree )) {
268+ foreach ($ this ->subTree as $ node ) {
269+ if (!$ node instanceof BypassableInterface || !$ node ->canBeBypassed ($ parameters )) {
270+ return false ;
271+ }
269272 }
273+ } elseif (!$ this ->subTree instanceof BypassableInterface || !$ this ->subTree ->canBeBypassed ($ parameters )) {
274+ return false ;
270275 }
271276 return true ;
272277 }
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ public function testStandardSelect()
179179 $ this ->assertEquals ('SELECT a FROM users AS u CROSS JOIN users AS u2 ' , self ::simplifySql ($ magicQuery ->build ($ sql )));
180180
181181 $ sql = 'SELECT a FROM users u WHERE status = (CASE WHEN u.id = 1 THEN u.status_1 ELSE u.status_2 END) ' ;
182- $ this ->assertEquals ('foo ' , self ::simplifySql ($ magicQuery ->build ($ sql )));
182+ $ this ->assertEquals ('SELECT a FROM users AS u WHERE status = (CASE WHEN u.id = 1 THEN u.status_1 ELSE u.status_2 END) ' , self ::simplifySql ($ magicQuery ->build ($ sql )));
183183 }
184184
185185 /**
You can’t perform that action at this time.
0 commit comments