Created
June 3, 2018 12:11
-
-
Save guiguiboy/8d040b182c981f3838d2951b5b63efaa to your computer and use it in GitHub Desktop.
Adding declare strict_types=1 at the beginning of your PHP files
This file contains 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 | |
add() | |
{ | |
sed -i '1 s/<?php/<?php\ | |
declare(strict_types=1);/g' $1 | |
} | |
for i in $(find $1 -name \*.php);do | |
if [ `grep -c "declare(strict_types=1)" $i` == 0 ];then | |
add $i | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment