Skip to content

Instantly share code, notes, and snippets.

@guiguiboy
Created June 3, 2018 12:11
Show Gist options
  • Save guiguiboy/8d040b182c981f3838d2951b5b63efaa to your computer and use it in GitHub Desktop.
Save guiguiboy/8d040b182c981f3838d2951b5b63efaa to your computer and use it in GitHub Desktop.
Adding declare strict_types=1 at the beginning of your PHP files
#!/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