Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Application.php

function Application::__construct

Same name in this branch
  1. 11.1.x vendor/symfony/console/Application.php \Symfony\Component\Console\Application::__construct()

Overrides Application::__construct

File

vendor/composer/composer/src/Composer/Console/Application.php, line 86

Class

Application
The console application that handles the commands

Namespace

Composer\Console

Code

public function __construct(string $name = 'Composer', string $version = '') {
    if (method_exists($this, 'setCatchErrors')) {
        $this->setCatchErrors(true);
    }
    static $shutdownRegistered = false;
    if ($version === '') {
        $version = Composer::getVersion();
    }
    if (function_exists('ini_set') && extension_loaded('xdebug')) {
        ini_set('xdebug.show_exception_trace', '0');
        ini_set('xdebug.scream', '0');
    }
    if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
        date_default_timezone_set(Silencer::call('date_default_timezone_get'));
    }
    $this->io = new NullIO();
    if (!$shutdownRegistered) {
        $shutdownRegistered = true;
        register_shutdown_function(static function () : void {
            $lastError = error_get_last();
            if ($lastError && $lastError['message'] && (strpos($lastError['message'], 'Allowed memory') !== false || strpos($lastError['message'], 'exceeded memory') !== false)) {
                echo "\n" . 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
            }
        });
    }
    $this->initialWorkingDirectory = getcwd();
    parent::__construct($name, $version);
}
RSS feed
Powered by Drupal