This guide is here to help developers follow best practices when working with Declarative and Serializable Metadata in Sugar. We've identified some common mistakes developers make and put together practical tips on how to avoid them using proven best practices.
Avoid Using $GLOBALS Array
Metadata definitions should directly declare configurations explicitly instead of relying on global variables.
Example:
$GLOBALS["dictionary"]["MyModule"] = [/* ... */];
Recommended Approach: Use the local $dictionary variable directly:
$dictionary["MyModule"] = [/* ... */];