Skip to content

Commit 5fe6d42

Browse files
Guard scripts from being run in non-CLI contexts
1 parent f75d17c commit 5fe6d42

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Resources/bin/extract-tentative-return-types.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
* file that was distributed with this source code.
1111
*/
1212

13+
if ('cli' !== \PHP_SAPI) {
14+
throw new Exception('This script must be run from the command line.');
15+
}
16+
1317
// Run from the root of the php-src repository, this script generates
1418
// a table with all the methods that have a tentative return type.
1519
//

Resources/bin/patch-type-declarations

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
* file that was distributed with this source code.
1111
*/
1212

13+
if ('cli' !== \PHP_SAPI) {
14+
throw new Exception('This script must be run from the command line.');
15+
}
16+
1317
if (\in_array('-h', $argv) || \in_array('--help', $argv)) {
1418
echo implode(PHP_EOL, [
1519
' Patches type declarations based on "@return" PHPDoc and triggers deprecations for',

0 commit comments

Comments
 (0)