Last active
October 25, 2021 02:33
-
-
Save DQNEO/5471032715ada025dee51be0b6568932 to your computer and use it in GitHub Desktop.
add void to setUp and tearDown to PHP test code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # a tool to apply return type declarations to "setUp" and "tearDown" for PHPUnit7 | |
| # list target files by using GNU grep | |
| grep --files-with-matches -i -w -e setup -e teardown -r tests > /tmp/files | |
| # do substitution | |
| cat /tmp/files | xargs perl -pi -e 's/setUp\(\)$/setUp(): void/g' | |
| cat /tmp/files | xargs perl -pi -e 's/tearDown\(\)$/tearDown(): void/g' | |
| cat /tmp/files | xargs perl -pi -e 's/public function runBare() *$/public function runBare(): void/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment