All php files in a directory
sed -i '1s/.*/<?php declare(strict_types=1);/' *.php
Recursively replace <?php with <?php declare(strict_types=1);
find . -type f -name ".php" -exec sed -i '1s/./<?php declare(strict_types=1);/g' {} +
All php files in a directory
sed -i '1s/.*/<?php declare(strict_types=1);/' *.php
Recursively replace <?php with <?php declare(strict_types=1);
find . -type f -name ".php" -exec sed -i '1s/./<?php declare(strict_types=1);/g' {} +