Can't use variable in deployment setting

When working on deployment with below codes

    when:
      event: deployment
+     environment: staging

I update to

    when:
      event: deployment
+     environment: [ ${env} ]

Always get error

yaml: line 24: did not find expected ',' or ']'

Can I use environment variables in deployment environment? I tried with double $, same issue.

I fixed this issue by myself. Add double quotes around the variables.

    when:
      event: deployment
+     environment: [ "${env}" ]