Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Created May 24, 2018 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save james2doyle/a94542b8ef6f07a689f23698424d1763 to your computer and use it in GitHub Desktop.
Save james2doyle/a94542b8ef6f07a689f23698424d1763 to your computer and use it in GitHub Desktop.
Use codemod to refactor isset into array_get
codemod -i -d $PWD --extensions php '\s{0,}\({0,}isset\((\$\w+)\[(\'\w+\')\]\)\){0,}\s{0,}\?\s{0,}\$\w+\[\'\w+\'\]\s{0,}:\s{0,}(.*)([;|,])$' ' array_get(\1, \2, \3)\4'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment