@@ -201,6 +201,7 @@ public static function parse(Parser $parser, TokensList $list, array $options =
201201 'An opening bracket was expected. ' ,
202202 $ token
203203 );
204+
204205 break ;
205206 }
206207 } elseif ($ state === 1 ) {
@@ -226,11 +227,11 @@ public static function parse(Parser $parser, TokensList $list, array $options =
226227 );
227228
228229 return $ ret ;
229- } else {
230- // Non-reserved keywords are allowed without backquotes
231- $ expr ->name = $ token ->value ;
232- $ state = 2 ;
233230 }
231+
232+ // Non-reserved keywords are allowed without backquotes
233+ $ expr ->name = $ token ->value ;
234+ $ state = 2 ;
234235 } else {
235236 $ parser ->error (
236237 'A symbol name was expected! ' ,
@@ -302,35 +303,35 @@ public static function build($component, array $options = array())
302303 {
303304 if (is_array ($ component )) {
304305 return "( \n " . implode (", \n " , $ component ) . "\n) " ;
305- } else {
306- $ tmp = '' ;
307-
308- if ($ component ->isConstraint ) {
309- $ tmp .= 'CONSTRAINT ' ;
310- }
306+ }
311307
312- if ((isset ($ component ->name )) && ($ component ->name !== '' )) {
313- $ tmp .= Context::escape ($ component ->name ) . ' ' ;
314- }
308+ $ tmp = '' ;
315309
316- if (!empty ($ component ->type )) {
317- $ tmp .= DataType::build (
318- $ component ->type ,
319- array ('lowercase ' => true )
320- ) . ' ' ;
321- }
310+ if ($ component ->isConstraint ) {
311+ $ tmp .= 'CONSTRAINT ' ;
312+ }
322313
323- if (! empty ( $ component ->key )) {
324- $ tmp .= $ component ->key . ' ' ;
325- }
314+ if (( isset ( $ component ->name )) && ( $ component -> name !== '' )) {
315+ $ tmp .= Context:: escape ( $ component ->name ) . ' ' ;
316+ }
326317
327- if (!empty ($ component ->references )) {
328- $ tmp .= 'REFERENCES ' . $ component ->references . ' ' ;
329- }
318+ if (!empty ($ component ->type )) {
319+ $ tmp .= DataType::build (
320+ $ component ->type ,
321+ array ('lowercase ' => true )
322+ ) . ' ' ;
323+ }
330324
331- $ tmp .= $ component ->options ;
325+ if (!empty ($ component ->key )) {
326+ $ tmp .= $ component ->key . ' ' ;
327+ }
332328
333- return trim ($ tmp );
329+ if (!empty ($ component ->references )) {
330+ $ tmp .= 'REFERENCES ' . $ component ->references . ' ' ;
334331 }
332+
333+ $ tmp .= $ component ->options ;
334+
335+ return trim ($ tmp );
335336 }
336337}
0 commit comments