Skip to content

Commit 5ff91b8

Browse files
authored
Ensure PHP-Scoper can only be called from the CLI (#220)
1 parent a503f54 commit 5ff91b8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

bin/php-scoper

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ use Isolated\Symfony\Component\Finder\Finder as IsolatedFinder;
1717
use RuntimeException;
1818
use Symfony\Component\Finder\Finder;
1919

20+
if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
21+
echo PHP_EOL.'PHP-Scoper may only be invoked from a command line'.\PHP_EOL;
22+
23+
exit(1);
24+
}
25+
2026
$findAutoload = function () {
2127
if (file_exists($autoload = __DIR__.'/../../../autoload.php')) {
2228
// Is installed via composer

0 commit comments

Comments
 (0)