Skip to content

Commit 03b0b58

Browse files
authored
Create force_strict_types_php.sh
1 parent e86fc6c commit 03b0b58

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

force_strict_types_php.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
echo "The affected files will be:"
4+
grep -R --include="*.php" "<?php" . | awk '{print $1 }' FS=":"
5+
6+
7+
# Change to strict types
8+
grep -R --include="*.php" "<?php" . | awk '{print $1 }' FS=":" | xargs sed -i 's/declare(strict_types=1);//g'
9+
grep -R --include="*.php" "<?php" . | awk '{print $1 }' FS=":" | xargs sed -i 's/declare(strict_types = 1);//g'
10+
grep -R --include="*.php" "<?php" . | awk '{print $1 }' FS=":" | xargs sed -i 's/<?php/<?php\n\ndeclare(strict_types=1);/g'
11+
echo "Done"

0 commit comments

Comments
 (0)