After #14437, my understanding is that the preferred way to define feature gates is declaratively in metadata.yaml files. We should document it in the feature gate docs.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.