8000 Guard scripts from being run in non-CLI contexts by nicolas-grekas · Pull Request #47778 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Guard scripts from being run in non-CLI contexts #47778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to l 10000 oad comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Guard scripts from being run in non-CLI contexts
  • Loading branch information
nicolas-grekas committed Oct 3, 2022
commit 9335c81f77e3d0e14e99ab88e763750d4cb3838a
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* file that was distributed with this source code.
*/

if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}

// Run from the root of the php-src repository, this script generates
// a table with all the methods that have a tentative return type.
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* file that was distributed with this source code.
*/

if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}

if (\in_array('-h', $argv) || \in_array('--help', $argv)) {
echo implode(PHP_EOL, [
' Patches type declarations based on "@return" PHPDoc and triggers deprecations for',
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/String/Resources/bin/update-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

use Symfony\Component\String\Resources\WcswidthDataGenerator;

if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}

error_reporting(\E_ALL);

set_error_handler(static function (int $type, string $msg, string $file, int $line): void {
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Yaml/Resources/bin/yaml-lint
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* file that was distributed with this source code.
*/

if ('cli' !== \PHP_SAPI) {
throw new Exception('This script must be run from the command line.');
}

/**
* Runs the Yaml lint command.
*
Expand Down
0