Ajout des vendor

This commit is contained in:
2022-04-07 13:06:23 +02:00
parent ea47c93aa7
commit 5c116e15b1
1348 changed files with 184572 additions and 1 deletions

View File

@ -0,0 +1,54 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class BasicErrorHandler
{
public static function register(bool $debug): void
{
error_reporting(-1);
if (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
ini_set('display_errors', $debug);
} elseif (!filter_var(ini_get('log_errors'), \FILTER_VALIDATE_BOOLEAN) || ini_get('error_log')) {
// CLI - display errors only if they're not already logged to STDERR
ini_set('display_errors', 1);
}
if (0 <= ini_get('zend.assertions')) {
ini_set('zend.assertions', 1);
ini_set('assert.active', $debug);
ini_set('assert.warning', 0);
ini_set('assert.exception', 1);
}
set_error_handler(new self());
}
public function __invoke(int $type, string $message, string $file, int $line): bool
{
if ((\E_DEPRECATED | \E_USER_DEPRECATED) & $type) {
return true;
}
if ((error_reporting() | \E_ERROR | \E_RECOVERABLE_ERROR | \E_PARSE | \E_CORE_ERROR | \E_COMPILE_ERROR | \E_USER_ERROR) & $type) {
throw new \ErrorException($message, 0, $type, $file, $line);
}
return false;
}
}

View File

@ -0,0 +1,121 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Factory;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\ScriptEvents;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class ComposerPlugin implements PluginInterface, EventSubscriberInterface
{
/**
* @var Composer
*/
private $composer;
/**
* @var IOInterface
*/
private $io;
private static $activated = false;
public function activate(Composer $composer, IOInterface $io): void
{
self::$activated = true;
$this->composer = $composer;
$this->io = $io;
}
public function deactivate(Composer $composer, IOInterface $io): void
{
self::$activated = false;
}
public function uninstall(Composer $composer, IOInterface $io): void
{
@unlink($composer->getConfig()->get('vendor-dir').'/autoload_runtime.php');
}
public function updateAutoloadFile(): void
{
$vendorDir = $this->composer->getConfig()->get('vendor-dir');
if (!is_file($autoloadFile = $vendorDir.'/autoload.php')
|| false === $extra = $this->composer->getPackage()->getExtra()['runtime'] ?? []
) {
return;
}
$fs = new Filesystem();
$projectDir = \dirname(realpath(Factory::getComposerFile()));
if (null === $autoloadTemplate = $extra['autoload_template'] ?? null) {
$autoloadTemplate = __DIR__.'/autoload_runtime.template';
} else {
if (!$fs->isAbsolutePath($autoloadTemplate)) {
$autoloadTemplate = $projectDir.'/'.$autoloadTemplate;
}
if (!is_file($autoloadTemplate)) {
throw new \InvalidArgumentException(sprintf('File "%s" defined under "extra.runtime.autoload_template" in your composer.json file not found.', $this->composer->getPackage()->getExtra()['runtime']['autoload_template']));
}
}
$projectDir = $fs->makePathRelative($projectDir, $vendorDir);
$nestingLevel = 0;
while (0 === strpos($projectDir, '../')) {
++$nestingLevel;
$projectDir = substr($projectDir, 3);
}
if (!$nestingLevel) {
$projectDir = '__'.'DIR__.'.var_export('/'.$projectDir, true);
} else {
$projectDir = 'dirname(__'."DIR__, $nestingLevel)".('' !== $projectDir ? '.'.var_export('/'.$projectDir, true) : '');
}
$runtimeClass = $extra['class'] ?? SymfonyRuntime::class;
unset($extra['class'], $extra['autoload_template']);
$code = strtr(file_get_contents($autoloadTemplate), [
'%project_dir%' => $projectDir,
'%runtime_class%' => var_export($runtimeClass, true),
'%runtime_options%' => '['.substr(var_export($extra, true), 7, -1)." 'project_dir' => {$projectDir},\n]",
]);
file_put_contents(substr_replace($autoloadFile, '_runtime', -4, 0), $code);
}
public static function getSubscribedEvents(): array
{
if (!self::$activated) {
return [];
}
return [
ScriptEvents::POST_AUTOLOAD_DUMP => 'updateAutoloadFile',
];
}
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\Console;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class ApplicationRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\Console\Command;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class CommandRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\Console\Input;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class InputInterfaceRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\Console\Output;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class OutputInterfaceRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\HttpFoundation;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class RequestRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\HttpFoundation;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class ResponseRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,21 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Runtime\Symfony\Component\HttpKernel;
use Symfony\Component\Runtime\SymfonyRuntime;
/**
* @internal
*/
class HttpKernelInterfaceRuntime extends SymfonyRuntime
{
}

View File

@ -0,0 +1,19 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
/**
* @internal class that should be loaded only when symfony/dotenv is not installed
*/
class MissingDotenv
{
}

View File

@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Runtime\Internal;
use Symfony\Component\ErrorHandler\BufferingLogger;
use Symfony\Component\ErrorHandler\DebugClassLoader;
use Symfony\Component\ErrorHandler\ErrorHandler;
/**
* @author Nicolas Grekas <p@tchwork.com>
*
* @internal
*/
class SymfonyErrorHandler
{
public static function register(bool $debug): void
{
BasicErrorHandler::register($debug);
if (class_exists(ErrorHandler::class)) {
DebugClassLoader::enable();
restore_error_handler();
ErrorHandler::register(new ErrorHandler(new BufferingLogger(), $debug));
}
}
}

View File

@ -0,0 +1,34 @@
<?php
// autoload_runtime.php @generated by Symfony Runtime
if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
return;
}
if (PHP_VERSION_ID < 80000 && in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
ob_start();
$app = require $_SERVER['SCRIPT_FILENAME'];
ob_end_clean();
} else {
$app = require $_SERVER['SCRIPT_FILENAME'];
}
if (!is_object($app)) {
throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
}
$runtime = $_SERVER['APP_RUNTIME'] ?? $_ENV['APP_RUNTIME'] ?? %runtime_class%;
$runtime = new $runtime(($_SERVER['APP_RUNTIME_OPTIONS'] ?? $_ENV['APP_RUNTIME_OPTIONS'] ?? []) + %runtime_options%);
[$app, $args] = $runtime
->getResolver($app)
->resolve();
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);