updated composer
This commit is contained in:
10
vendor/symfony/console/Application.php
vendored
10
vendor/symfony/console/Application.php
vendored
@@ -860,11 +860,11 @@ class Application implements ResetInterface
|
||||
]);
|
||||
|
||||
for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
|
||||
$class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
|
||||
$type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
|
||||
$function = isset($trace[$i]['function']) ? $trace[$i]['function'] : '';
|
||||
$file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
|
||||
$line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
|
||||
$class = $trace[$i]['class'] ?? '';
|
||||
$type = $trace[$i]['type'] ?? '';
|
||||
$function = $trace[$i]['function'] ?? '';
|
||||
$file = $trace[$i]['file'] ?? 'n/a';
|
||||
$line = $trace[$i]['line'] ?? 'n/a';
|
||||
|
||||
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
|
||||
}
|
||||
|
||||
16
vendor/symfony/console/Command/Command.php
vendored
16
vendor/symfony/console/Command/Command.php
vendored
@@ -29,6 +29,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
*/
|
||||
class Command
|
||||
{
|
||||
// see https://tldp.org/LDP/abs/html/exitcodes.html
|
||||
public const SUCCESS = 0;
|
||||
public const FAILURE = 1;
|
||||
|
||||
@@ -281,7 +282,14 @@ class Command
|
||||
if ($code instanceof \Closure) {
|
||||
$r = new \ReflectionFunction($code);
|
||||
if (null === $r->getClosureThis()) {
|
||||
$code = \Closure::bind($code, $this);
|
||||
set_error_handler(static function () {});
|
||||
try {
|
||||
if ($c = \Closure::bind($code, $this)) {
|
||||
$code = $c;
|
||||
}
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,9 +395,9 @@ class Command
|
||||
/**
|
||||
* Adds an option.
|
||||
*
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
|
||||
* @param string|string[]|bool|null $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*
|
||||
|
||||
@@ -40,7 +40,7 @@ class HelpCommand extends Command
|
||||
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
|
||||
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
|
||||
])
|
||||
->setDescription('Displays help for a command')
|
||||
->setDescription('Display help for a command')
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command displays help for a given command:
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class ListCommand extends Command
|
||||
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
|
||||
new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
|
||||
])
|
||||
->setDescription('Lists commands')
|
||||
->setDescription('List commands')
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lists all commands:
|
||||
|
||||
|
||||
2
vendor/symfony/console/ConsoleEvents.php
vendored
2
vendor/symfony/console/ConsoleEvents.php
vendored
@@ -26,7 +26,7 @@ final class ConsoleEvents
|
||||
/**
|
||||
* The COMMAND event allows you to attach listeners before any command is
|
||||
* executed by the console. It also allows you to modify the command, input and output
|
||||
* before they are handled to the command.
|
||||
* before they are handed to the command.
|
||||
*
|
||||
* @Event("Symfony\Component\Console\Event\ConsoleCommandEvent")
|
||||
*/
|
||||
|
||||
@@ -80,7 +80,7 @@ class ApplicationDescription
|
||||
throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
|
||||
return $this->commands[$name] ?? $this->aliases[$name];
|
||||
}
|
||||
|
||||
private function inspectApplication()
|
||||
|
||||
10
vendor/symfony/console/Descriptor/Descriptor.php
vendored
10
vendor/symfony/console/Descriptor/Descriptor.php
vendored
@@ -69,36 +69,26 @@ abstract class Descriptor implements DescriptorInterface
|
||||
|
||||
/**
|
||||
* Describes an InputArgument instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeInputArgument(InputArgument $argument, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes an InputOption instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeInputOption(InputOption $option, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes an InputDefinition instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeInputDefinition(InputDefinition $definition, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes a Command instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeCommand(Command $command, array $options = []);
|
||||
|
||||
/**
|
||||
* Describes an Application instance.
|
||||
*
|
||||
* @return string|mixed
|
||||
*/
|
||||
abstract protected function describeApplication(Application $application, array $options = []);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class JsonDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$describedNamespace = $options['namespace'] ?? null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace, true);
|
||||
$commands = [];
|
||||
|
||||
@@ -95,7 +95,7 @@ class JsonDescriptor extends Descriptor
|
||||
*/
|
||||
private function writeData(array $data, array $options)
|
||||
{
|
||||
$flags = isset($options['json_encoding']) ? $options['json_encoding'] : 0;
|
||||
$flags = $options['json_encoding'] ?? 0;
|
||||
|
||||
$this->write(json_encode($data, $flags));
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$describedNamespace = $options['namespace'] ?? null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
$title = $this->getApplicationTitle($application);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class TextDescriptor extends Descriptor
|
||||
$default = '';
|
||||
}
|
||||
|
||||
$totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
|
||||
$totalWidth = $options['total_width'] ?? Helper::strlen($argument->getName());
|
||||
$spacingWidth = $totalWidth - \strlen($argument->getName());
|
||||
|
||||
$this->writeText(sprintf(' <info>%s</info> %s%s%s',
|
||||
@@ -71,7 +71,7 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
}
|
||||
|
||||
$totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions([$option]);
|
||||
$totalWidth = $options['total_width'] ?? $this->calculateTotalWidthForOptions([$option]);
|
||||
$synopsis = sprintf('%s%s',
|
||||
$option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
|
||||
sprintf('--%s%s', $option->getName(), $value)
|
||||
@@ -117,7 +117,7 @@ class TextDescriptor extends Descriptor
|
||||
|
||||
$this->writeText('<comment>Options:</comment>', $options);
|
||||
foreach ($definition->getOptions() as $option) {
|
||||
if (\strlen($option->getShortcut()) > 1) {
|
||||
if (\strlen($option->getShortcut() ?? '') > 1) {
|
||||
$laterOptions[] = $option;
|
||||
continue;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ class TextDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
|
||||
$describedNamespace = $options['namespace'] ?? null;
|
||||
$description = new ApplicationDescription($application, $describedNamespace);
|
||||
|
||||
if (isset($options['raw_text']) && $options['raw_text']) {
|
||||
@@ -296,7 +296,7 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param (Command|string)[] $commands
|
||||
* @param array<Command|string> $commands
|
||||
*/
|
||||
private function getColumnWidth(array $commands): int
|
||||
{
|
||||
|
||||
@@ -151,7 +151,7 @@ class XmlDescriptor extends Descriptor
|
||||
*/
|
||||
protected function describeApplication(Application $application, array $options = [])
|
||||
{
|
||||
$this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
|
||||
$this->writeDocument($this->getApplicationDocument($application, $options['namespace'] ?? null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +200,7 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
$dom->appendChild($objectXML = $dom->createElement('option'));
|
||||
$objectXML->setAttribute('name', '--'.$option->getName());
|
||||
$pos = strpos($option->getShortcut(), '|');
|
||||
$pos = strpos($option->getShortcut() ?? '', '|');
|
||||
if (false !== $pos) {
|
||||
$objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
|
||||
$objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
|
||||
|
||||
@@ -40,12 +40,12 @@ class ErrorListener implements EventSubscriberInterface
|
||||
$error = $event->getError();
|
||||
|
||||
if (!$inputString = $this->getInputString($event)) {
|
||||
$this->logger->error('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
|
||||
$this->logger->critical('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => $error->getMessage()]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->logger->error('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
|
||||
$this->logger->critical('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => $inputString, 'message' => $error->getMessage()]);
|
||||
}
|
||||
|
||||
public function onConsoleTerminate(ConsoleTerminateEvent $event)
|
||||
|
||||
@@ -21,10 +21,10 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
|
||||
private $alternatives;
|
||||
|
||||
/**
|
||||
* @param string $message Exception message to throw
|
||||
* @param array $alternatives List of similar defined names
|
||||
* @param int $code Exception code
|
||||
* @param \Throwable $previous Previous exception used for the exception chaining
|
||||
* @param string $message Exception message to throw
|
||||
* @param string[] $alternatives List of similar defined names
|
||||
* @param int $code Exception code
|
||||
* @param \Throwable|null $previous Previous exception used for the exception chaining
|
||||
*/
|
||||
public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
|
||||
{
|
||||
@@ -34,7 +34,7 @@ class CommandNotFoundException extends \InvalidArgumentException implements Exce
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array A list of similar defined names
|
||||
* @return string[] A list of similar defined names
|
||||
*/
|
||||
public function getAlternatives()
|
||||
{
|
||||
|
||||
@@ -161,7 +161,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
if ($open = '/' != $text[1]) {
|
||||
$tag = $matches[1][$i][0];
|
||||
} else {
|
||||
$tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
|
||||
$tag = $matches[3][$i][0] ?? '';
|
||||
}
|
||||
|
||||
if (!$open && !$tag) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class OutputFormatterStyleStack implements ResetInterface
|
||||
|
||||
public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
|
||||
{
|
||||
$this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
|
||||
$this->emptyStyle = $emptyStyle ?? new OutputFormatterStyle();
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
|
||||
51
vendor/symfony/console/Helper/Helper.php
vendored
51
vendor/symfony/console/Helper/Helper.php
vendored
@@ -12,6 +12,7 @@
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
use Symfony\Component\String\UnicodeString;
|
||||
|
||||
/**
|
||||
* Helper is the base class for all helper classes.
|
||||
@@ -45,6 +46,23 @@ abstract class Helper implements HelperInterface
|
||||
*/
|
||||
public static function strlen(?string $string)
|
||||
{
|
||||
return self::width($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width of a string, using mb_strwidth if it is available.
|
||||
* The width is how many characters positions the string will use.
|
||||
*
|
||||
* @internal in Symfony 5.2
|
||||
*/
|
||||
public static function width(?string $string): int
|
||||
{
|
||||
$string ?? $string = '';
|
||||
|
||||
if (preg_match('//u', $string)) {
|
||||
return (new UnicodeString($string))->width(false);
|
||||
}
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string, null, true)) {
|
||||
return \strlen($string);
|
||||
}
|
||||
@@ -52,13 +70,36 @@ abstract class Helper implements HelperInterface
|
||||
return mb_strwidth($string, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of a string, using mb_strlen if it is available.
|
||||
* The length is related to how many bytes the string will use.
|
||||
*
|
||||
* @internal in Symfony 5.2
|
||||
*/
|
||||
public static function length(?string $string): int
|
||||
{
|
||||
$string ?? $string = '';
|
||||
|
||||
if (preg_match('//u', $string)) {
|
||||
return (new UnicodeString($string))->length();
|
||||
}
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string, null, true)) {
|
||||
return \strlen($string);
|
||||
}
|
||||
|
||||
return mb_strlen($string, $encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the subset of a string, using mb_substr if it is available.
|
||||
*
|
||||
* @return string The string subset
|
||||
*/
|
||||
public static function substr(string $string, int $from, int $length = null)
|
||||
public static function substr(?string $string, int $from, int $length = null)
|
||||
{
|
||||
$string ?? $string = '';
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string, null, true)) {
|
||||
return substr($string, $from, $length);
|
||||
}
|
||||
@@ -112,17 +153,17 @@ abstract class Helper implements HelperInterface
|
||||
return sprintf('%d B', $memory);
|
||||
}
|
||||
|
||||
public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
|
||||
public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, ?string $string)
|
||||
{
|
||||
return self::strlen(self::removeDecoration($formatter, $string));
|
||||
return self::width(self::removeDecoration($formatter, $string));
|
||||
}
|
||||
|
||||
public static function removeDecoration(OutputFormatterInterface $formatter, $string)
|
||||
public static function removeDecoration(OutputFormatterInterface $formatter, ?string $string)
|
||||
{
|
||||
$isDecorated = $formatter->isDecorated();
|
||||
$formatter->setDecorated(false);
|
||||
// remove <...> formatting
|
||||
$string = $formatter->format($string);
|
||||
$string = $formatter->format($string ?? '');
|
||||
// remove already formatted characters
|
||||
$string = preg_replace("/\033\[[^m]*m/", '', $string);
|
||||
$formatter->setDecorated($isDecorated);
|
||||
|
||||
17
vendor/symfony/console/Helper/ProgressBar.php
vendored
17
vendor/symfony/console/Helper/ProgressBar.php
vendored
@@ -113,7 +113,7 @@ final class ProgressBar
|
||||
self::$formatters = self::initPlaceholderFormatters();
|
||||
}
|
||||
|
||||
return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
|
||||
return self::$formatters[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +146,7 @@ final class ProgressBar
|
||||
self::$formats = self::initFormats();
|
||||
}
|
||||
|
||||
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
|
||||
return self::$formats[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -462,8 +462,15 @@ final class ProgressBar
|
||||
if ($this->overwrite) {
|
||||
if (null !== $this->previousMessage) {
|
||||
if ($this->output instanceof ConsoleSectionOutput) {
|
||||
$lines = floor(Helper::strlen($message) / $this->terminal->getWidth()) + $this->formatLineCount + 1;
|
||||
$this->output->clear($lines);
|
||||
$messageLines = explode("\n", $message);
|
||||
$lineCount = \count($messageLines);
|
||||
foreach ($messageLines as $messageLine) {
|
||||
$messageLineLength = Helper::strlenWithoutDecoration($this->output->getFormatter(), $messageLine);
|
||||
if ($messageLineLength > $this->terminal->getWidth()) {
|
||||
$lineCount += floor($messageLineLength / $this->terminal->getWidth());
|
||||
}
|
||||
}
|
||||
$this->output->clear($lineCount);
|
||||
} else {
|
||||
if ($this->formatLineCount > 0) {
|
||||
$this->cursor->moveUp($this->formatLineCount);
|
||||
@@ -506,7 +513,7 @@ final class ProgressBar
|
||||
$completeBars = $bar->getBarOffset();
|
||||
$display = str_repeat($bar->getBarCharacter(), $completeBars);
|
||||
if ($completeBars < $bar->getBarWidth()) {
|
||||
$emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
|
||||
$emptyBars = $bar->getBarWidth() - $completeBars - Helper::length(Helper::removeDecoration($output->getFormatter(), $bar->getProgressCharacter()));
|
||||
$display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
|
||||
}
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ class ProgressIndicator
|
||||
self::$formats = self::initFormats();
|
||||
}
|
||||
|
||||
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
|
||||
return self::$formats[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +170,7 @@ class ProgressIndicator
|
||||
self::$formatters = self::initPlaceholderFormatters();
|
||||
}
|
||||
|
||||
return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
|
||||
return self::$formatters[$name] ?? null;
|
||||
}
|
||||
|
||||
private function display()
|
||||
@@ -185,7 +185,7 @@ class ProgressIndicator
|
||||
}
|
||||
|
||||
return $matches[0];
|
||||
}, $this->format));
|
||||
}, $this->format ?? ''));
|
||||
}
|
||||
|
||||
private function determineBestFormat(): string
|
||||
|
||||
60
vendor/symfony/console/Helper/QuestionHelper.php
vendored
60
vendor/symfony/console/Helper/QuestionHelper.php
vendored
@@ -99,7 +99,7 @@ class QuestionHelper extends Helper
|
||||
/**
|
||||
* Asks the question to the user.
|
||||
*
|
||||
* @return bool|mixed|string|null
|
||||
* @return mixed
|
||||
*
|
||||
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
|
||||
*/
|
||||
@@ -110,11 +110,6 @@ class QuestionHelper extends Helper
|
||||
$inputStream = $this->inputStream ?: \STDIN;
|
||||
$autocomplete = $question->getAutocompleterCallback();
|
||||
|
||||
if (\function_exists('sapi_windows_cp_set')) {
|
||||
// Codepage used by cmd.exe on Windows to allow special characters (éàüñ).
|
||||
@sapi_windows_cp_set(1252);
|
||||
}
|
||||
|
||||
if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
|
||||
$ret = false;
|
||||
if ($question->isHidden()) {
|
||||
@@ -172,13 +167,13 @@ class QuestionHelper extends Helper
|
||||
$choices = $question->getChoices();
|
||||
|
||||
if (!$question->isMultiselect()) {
|
||||
return isset($choices[$default]) ? $choices[$default] : $default;
|
||||
return $choices[$default] ?? $default;
|
||||
}
|
||||
|
||||
$default = explode(',', $default);
|
||||
foreach ($default as $k => $v) {
|
||||
$v = $question->isTrimmable() ? trim($v) : $v;
|
||||
$default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
|
||||
$default[$k] = $choices[$v] ?? $v;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +306,7 @@ class QuestionHelper extends Helper
|
||||
$remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
|
||||
$output->write($remainingCharacters);
|
||||
$fullChoice .= $remainingCharacters;
|
||||
$i = self::strlen($fullChoice);
|
||||
$i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
|
||||
|
||||
$matches = array_filter(
|
||||
$autocomplete($ret),
|
||||
@@ -411,7 +406,7 @@ class QuestionHelper extends Helper
|
||||
$exe = $tmpExe;
|
||||
}
|
||||
|
||||
$sExec = shell_exec($exe);
|
||||
$sExec = shell_exec('"'.$exe.'"');
|
||||
$value = $trimmable ? rtrim($sExec) : $sExec;
|
||||
$output->writeln('');
|
||||
|
||||
@@ -514,7 +509,10 @@ class QuestionHelper extends Helper
|
||||
private function readInput($inputStream, Question $question)
|
||||
{
|
||||
if (!$question->isMultiline()) {
|
||||
return fgets($inputStream, 4096);
|
||||
$cp = $this->setIOCodepage();
|
||||
$ret = fgets($inputStream, 4096);
|
||||
|
||||
return $this->resetIOCodepage($cp, $ret);
|
||||
}
|
||||
|
||||
$multiLineStreamReader = $this->cloneInputStream($inputStream);
|
||||
@@ -523,6 +521,7 @@ class QuestionHelper extends Helper
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
$cp = $this->setIOCodepage();
|
||||
while (false !== ($char = fgetc($multiLineStreamReader))) {
|
||||
if (\PHP_EOL === "{$ret}{$char}") {
|
||||
break;
|
||||
@@ -530,7 +529,44 @@ class QuestionHelper extends Helper
|
||||
$ret .= $char;
|
||||
}
|
||||
|
||||
return $ret;
|
||||
return $this->resetIOCodepage($cp, $ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets console I/O to the host code page.
|
||||
*
|
||||
* @return int Previous code page in IBM/EBCDIC format
|
||||
*/
|
||||
private function setIOCodepage(): int
|
||||
{
|
||||
if (\function_exists('sapi_windows_cp_set')) {
|
||||
$cp = sapi_windows_cp_get();
|
||||
sapi_windows_cp_set(sapi_windows_cp_get('oem'));
|
||||
|
||||
return $cp;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets console I/O to the specified code page and converts the user input.
|
||||
*
|
||||
* @param string|false $input
|
||||
*
|
||||
* @return string|false
|
||||
*/
|
||||
private function resetIOCodepage(int $cp, $input)
|
||||
{
|
||||
if (0 !== $cp) {
|
||||
sapi_windows_cp_set($cp);
|
||||
|
||||
if (false !== $input && '' !== $input) {
|
||||
$input = sapi_windows_cp_conv(sapi_windows_cp_get('oem'), $cp, $input);
|
||||
}
|
||||
}
|
||||
|
||||
return $input;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ class SymfonyQuestionHelper extends QuestionHelper
|
||||
|
||||
case $question instanceof ChoiceQuestion:
|
||||
$choices = $question->getChoices();
|
||||
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
|
||||
$text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($choices[$default] ?? $default));
|
||||
|
||||
break;
|
||||
|
||||
|
||||
10
vendor/symfony/console/Helper/Table.php
vendored
10
vendor/symfony/console/Helper/Table.php
vendored
@@ -491,7 +491,7 @@ class Table
|
||||
*/
|
||||
private function renderCell(array $row, int $column, string $cellFormat): string
|
||||
{
|
||||
$cell = isset($row[$column]) ? $row[$column] : '';
|
||||
$cell = $row[$column] ?? '';
|
||||
$width = $this->effectiveColumnWidths[$column];
|
||||
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
|
||||
// add the width of the following columns(numbers of colspan).
|
||||
@@ -511,7 +511,7 @@ class Table
|
||||
return sprintf($style->getBorderFormat(), str_repeat($style->getBorderChars()[2], $width));
|
||||
}
|
||||
|
||||
$width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
||||
$width += Helper::length($cell) - Helper::length(Helper::removeDecoration($this->output->getFormatter(), $cell));
|
||||
$content = sprintf($style->getCellRowContentFormat(), $cell);
|
||||
|
||||
$padType = $style->getPadType();
|
||||
@@ -572,7 +572,7 @@ class Table
|
||||
if (isset($this->columnMaxWidths[$column]) && Helper::strlenWithoutDecoration($formatter, $cell) > $this->columnMaxWidths[$column]) {
|
||||
$cell = $formatter->formatAndWrap($cell, $this->columnMaxWidths[$column] * $colspan);
|
||||
}
|
||||
if (!strstr($cell, "\n")) {
|
||||
if (!strstr($cell ?? '', "\n")) {
|
||||
continue;
|
||||
}
|
||||
$escaped = implode("\n", array_map([OutputFormatter::class, 'escapeTrailingBackslash'], explode("\n", $cell)));
|
||||
@@ -648,7 +648,7 @@ class Table
|
||||
// create a two dimensional array (rowspan x colspan)
|
||||
$unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, []), $unmergedRows);
|
||||
foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
|
||||
$value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
|
||||
$value = $lines[$unmergedRowKey - $line] ?? '';
|
||||
$unmergedRows[$unmergedRowKey][$column] = new TableCell($value, ['colspan' => $cell->getColspan(), 'style' => $cell->getStyle()]);
|
||||
if ($nbLines === $unmergedRowKey - $line) {
|
||||
break;
|
||||
@@ -786,7 +786,7 @@ class Table
|
||||
$cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
|
||||
}
|
||||
|
||||
$columnWidth = isset($this->columnWidths[$column]) ? $this->columnWidths[$column] : 0;
|
||||
$columnWidth = $this->columnWidths[$column] ?? 0;
|
||||
$cellWidth = max($cellWidth, $columnWidth);
|
||||
|
||||
return isset($this->columnMaxWidths[$column]) ? min($this->columnMaxWidths[$column], $cellWidth) : $cellWidth;
|
||||
|
||||
5
vendor/symfony/console/Input/ArrayInput.php
vendored
5
vendor/symfony/console/Input/ArrayInput.php
vendored
@@ -108,12 +108,13 @@ class ArrayInput extends Input
|
||||
$params = [];
|
||||
foreach ($this->parameters as $param => $val) {
|
||||
if ($param && \is_string($param) && '-' === $param[0]) {
|
||||
$glue = ('-' === $param[1]) ? '=' : ' ';
|
||||
if (\is_array($val)) {
|
||||
foreach ($val as $v) {
|
||||
$params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
|
||||
$params[] = $param.('' != $v ? $glue.$this->escapeToken($v) : '');
|
||||
}
|
||||
} else {
|
||||
$params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
|
||||
$params[] = $param.('' != $val ? $glue.$this->escapeToken($val) : '');
|
||||
}
|
||||
} else {
|
||||
$params[] = \is_array($val) ? implode(' ', array_map([$this, 'escapeToken'], $val)) : $this->escapeToken($val);
|
||||
|
||||
2
vendor/symfony/console/Input/Input.php
vendored
2
vendor/symfony/console/Input/Input.php
vendored
@@ -110,7 +110,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||
}
|
||||
|
||||
return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
|
||||
return $this->arguments[$name] ?? $this->definition->getArgument($name)->getDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
29
vendor/symfony/console/Input/InputOption.php
vendored
29
vendor/symfony/console/Input/InputOption.php
vendored
@@ -21,9 +21,24 @@ use Symfony\Component\Console\Exception\LogicException;
|
||||
*/
|
||||
class InputOption
|
||||
{
|
||||
/**
|
||||
* Do not accept input for the option (e.g. --yell). This is the default behavior of options.
|
||||
*/
|
||||
public const VALUE_NONE = 1;
|
||||
|
||||
/**
|
||||
* A value must be passed when the option is used (e.g. --iterations=5 or -i5).
|
||||
*/
|
||||
public const VALUE_REQUIRED = 2;
|
||||
|
||||
/**
|
||||
* The option may or may not have a value (e.g. --yell or --yell=loud).
|
||||
*/
|
||||
public const VALUE_OPTIONAL = 4;
|
||||
|
||||
/**
|
||||
* The option accepts multiple values (e.g. --dir=/foo --dir=/bar).
|
||||
*/
|
||||
public const VALUE_IS_ARRAY = 8;
|
||||
|
||||
private $name;
|
||||
@@ -33,11 +48,11 @@ class InputOption
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @param string $name The option name
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE)
|
||||
* @param string $name The option name
|
||||
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
|
||||
* @param int|null $mode The option mode: One of the VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*/
|
||||
@@ -149,7 +164,7 @@ class InputOption
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param string|string[]|int|bool|null $default The default value
|
||||
* @param string|string[]|bool|null $default The default value
|
||||
*
|
||||
* @throws LogicException When incorrect default value is given
|
||||
*/
|
||||
@@ -173,7 +188,7 @@ class InputOption
|
||||
/**
|
||||
* Returns the default value.
|
||||
*
|
||||
* @return string|string[]|int|bool|null The default value
|
||||
* @return string|string[]|bool|null The default value
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
|
||||
8
vendor/symfony/console/Input/StringInput.php
vendored
8
vendor/symfony/console/Input/StringInput.php
vendored
@@ -48,12 +48,12 @@ class StringInput extends ArgvInput
|
||||
$length = \strlen($input);
|
||||
$cursor = 0;
|
||||
while ($cursor < $length) {
|
||||
if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
|
||||
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
|
||||
if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
|
||||
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
|
||||
$tokens[] = $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, \strlen($match[3]) - 2)));
|
||||
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
|
||||
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
|
||||
$tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
|
||||
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
|
||||
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $cursor)) {
|
||||
$tokens[] = stripcslashes($match[1]);
|
||||
} else {
|
||||
// should never happen
|
||||
|
||||
2
vendor/symfony/console/LICENSE
vendored
2
vendor/symfony/console/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2020 Fabien Potencier
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
2
vendor/symfony/console/Output/Output.php
vendored
2
vendor/symfony/console/Output/Output.php
vendored
@@ -40,7 +40,7 @@ abstract class Output implements OutputInterface
|
||||
public function __construct(?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
|
||||
{
|
||||
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
|
||||
$this->formatter = $formatter ?: new OutputFormatter();
|
||||
$this->formatter = $formatter ?? new OutputFormatter();
|
||||
$this->formatter->setDecorated($decorated);
|
||||
}
|
||||
|
||||
|
||||
11
vendor/symfony/console/Style/SymfonyStyle.php
vendored
11
vendor/symfony/console/Style/SymfonyStyle.php
vendored
@@ -300,7 +300,7 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
if (null !== $default) {
|
||||
$values = array_flip($choices);
|
||||
$default = isset($values[$default]) ? $values[$default] : $default;
|
||||
$default = $values[$default] ?? $default;
|
||||
}
|
||||
|
||||
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
|
||||
@@ -476,7 +476,12 @@ class SymfonyStyle extends OutputStyle
|
||||
$message = OutputFormatter::escape($message);
|
||||
}
|
||||
|
||||
$lines = array_merge($lines, explode(\PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, \PHP_EOL, true)));
|
||||
$decorationLength = Helper::strlen($message) - Helper::strlenWithoutDecoration($this->getFormatter(), $message);
|
||||
$messageLineLength = min($this->lineLength - $prefixLength - $indentLength + $decorationLength, $this->lineLength);
|
||||
$messageLines = explode(\PHP_EOL, wordwrap($message, $messageLineLength, \PHP_EOL, true));
|
||||
foreach ($messageLines as $messageLine) {
|
||||
$lines[] = $messageLine;
|
||||
}
|
||||
|
||||
if (\count($messages) > 1 && $key < \count($messages) - 1) {
|
||||
$lines[] = '';
|
||||
@@ -496,7 +501,7 @@ class SymfonyStyle extends OutputStyle
|
||||
}
|
||||
|
||||
$line = $prefix.$line;
|
||||
$line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
|
||||
$line .= str_repeat(' ', max($this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line), 0));
|
||||
|
||||
if ($style) {
|
||||
$line = sprintf('<%s>%s</>', $style, $line);
|
||||
|
||||
@@ -147,8 +147,8 @@ trait TesterTrait
|
||||
}
|
||||
} else {
|
||||
$this->output = new ConsoleOutput(
|
||||
isset($options['verbosity']) ? $options['verbosity'] : ConsoleOutput::VERBOSITY_NORMAL,
|
||||
isset($options['decorated']) ? $options['decorated'] : null
|
||||
$options['verbosity'] ?? ConsoleOutput::VERBOSITY_NORMAL,
|
||||
$options['decorated'] ?? null
|
||||
);
|
||||
|
||||
$errorOutput = new StreamOutput(fopen('php://memory', 'w', false));
|
||||
|
||||
2
vendor/symfony/console/composer.json
vendored
2
vendor/symfony/console/composer.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"type": "library",
|
||||
"description": "Symfony Console Component",
|
||||
"description": "Eases the creation of beautiful and testable command line interfaces",
|
||||
"keywords": ["console", "cli", "command line", "terminal"],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
|
||||
2
vendor/symfony/css-selector/LICENSE
vendored
2
vendor/symfony/css-selector/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2020 Fabien Potencier
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -31,7 +31,7 @@ class Parser implements ParserInterface
|
||||
|
||||
public function __construct(Tokenizer $tokenizer = null)
|
||||
{
|
||||
$this->tokenizer = $tokenizer ?: new Tokenizer();
|
||||
$this->tokenizer = $tokenizer ?? new Tokenizer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ class Parser implements ParserInterface
|
||||
}
|
||||
|
||||
$split = explode('n', $joined);
|
||||
$first = isset($split[0]) ? $split[0] : null;
|
||||
$first = $split[0] ?? null;
|
||||
|
||||
return [
|
||||
$first ? ('-' === $first || '+' === $first ? $int($first.'1') : $int($first)) : 1,
|
||||
|
||||
@@ -50,7 +50,7 @@ class Translator implements TranslatorInterface
|
||||
|
||||
public function __construct(ParserInterface $parser = null)
|
||||
{
|
||||
$this->mainParser = $parser ?: new Parser();
|
||||
$this->mainParser = $parser ?? new Parser();
|
||||
|
||||
$this
|
||||
->registerExtension(new Extension\NodeExtension())
|
||||
|
||||
2
vendor/symfony/css-selector/composer.json
vendored
2
vendor/symfony/css-selector/composer.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "symfony/css-selector",
|
||||
"type": "library",
|
||||
"description": "Symfony CssSelector Component",
|
||||
"description": "Converts CSS selectors to XPath expressions",
|
||||
"keywords": [],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -2,4 +2,4 @@ CHANGELOG
|
||||
=========
|
||||
|
||||
The changelog is maintained for all Symfony contracts at the following URL:
|
||||
https://github.com/symfony/contracts/blob/master/CHANGELOG.md
|
||||
https://github.com/symfony/contracts/blob/main/CHANGELOG.md
|
||||
|
||||
2
vendor/symfony/deprecation-contracts/LICENSE
vendored
2
vendor/symfony/deprecation-contracts/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2020 Fabien Potencier
|
||||
Copyright (c) 2020-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev"
|
||||
"dev-main": "2.4-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
||||
10
vendor/symfony/error-handler/BufferingLogger.php
vendored
10
vendor/symfony/error-handler/BufferingLogger.php
vendored
@@ -35,6 +35,16 @@ class BufferingLogger extends AbstractLogger
|
||||
return $logs;
|
||||
}
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot serialize '.__CLASS__);
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
foreach ($this->logs as [$level, $message, $context]) {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\ErrorHandler;
|
||||
|
||||
use Composer\InstalledVersions;
|
||||
use Doctrine\Common\Persistence\Proxy as LegacyProxy;
|
||||
use Doctrine\Persistence\Proxy;
|
||||
use Mockery\MockInterface;
|
||||
@@ -67,10 +68,11 @@ class DebugClassLoader
|
||||
'string' => 'string',
|
||||
'self' => 'self',
|
||||
'parent' => 'parent',
|
||||
'mixed' => 'mixed',
|
||||
] + (\PHP_VERSION_ID >= 80000 ? [
|
||||
'static' => 'static',
|
||||
'$this' => 'static',
|
||||
] : [
|
||||
'mixed' => 'mixed',
|
||||
'static' => 'object',
|
||||
'$this' => 'object',
|
||||
]);
|
||||
@@ -231,8 +233,8 @@ class DebugClassLoader
|
||||
public static function enable(): void
|
||||
{
|
||||
// Ensures we don't hit https://bugs.php.net/42098
|
||||
class_exists('Symfony\Component\ErrorHandler\ErrorHandler');
|
||||
class_exists('Psr\Log\LogLevel');
|
||||
class_exists(\Symfony\Component\ErrorHandler\ErrorHandler::class);
|
||||
class_exists(\Psr\Log\LogLevel::class);
|
||||
|
||||
if (!\is_array($functions = spl_autoload_functions())) {
|
||||
return;
|
||||
@@ -490,6 +492,14 @@ class DebugClassLoader
|
||||
self::$method[$class] = self::$method[$use];
|
||||
}
|
||||
} elseif (!$refl->isInterface()) {
|
||||
if (!strncmp($vendor, str_replace('_', '\\', $use), $vendorLen)
|
||||
&& 0 === strpos($className, 'Symfony\\')
|
||||
&& (!class_exists(InstalledVersions::class)
|
||||
|| 'symfony/symfony' !== InstalledVersions::getRootPackage()['name'])
|
||||
) {
|
||||
// skip "same vendor" @method deprecations for Symfony\* classes unless symfony/symfony is being tested
|
||||
continue;
|
||||
}
|
||||
$hasCall = $refl->hasMethod('__call');
|
||||
$hasStaticCall = $refl->hasMethod('__callStatic');
|
||||
foreach (self::$method[$use] as $method) {
|
||||
@@ -533,7 +543,7 @@ class DebugClassLoader
|
||||
if (null !== (self::INTERNAL_TYPES[$use] ?? null)) {
|
||||
foreach (self::INTERNAL_TYPES[$use] as $method => $returnType) {
|
||||
if ('void' !== $returnType) {
|
||||
self::$returnTypes[$class] += [$method => [$returnType, $returnType, $class, '']];
|
||||
self::$returnTypes[$class] += [$method => [$returnType, $returnType, $use, '']];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -610,7 +620,7 @@ class DebugClassLoader
|
||||
$this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
|
||||
}
|
||||
|
||||
if (strncmp($ns, $declaringClass, $len)) {
|
||||
if (false === strpos($doc, '* @deprecated') && strncmp($ns, $declaringClass, $len)) {
|
||||
if ($canAddReturnType && 'docblock' === $this->patchTypes['force'] && false === strpos($method->getFileName(), \DIRECTORY_SEPARATOR.'vendor'.\DIRECTORY_SEPARATOR)) {
|
||||
$this->patchMethod($method, $returnType, $declaringFile, $normalizedType);
|
||||
} elseif ('' !== $declaringClass && $this->patchTypes['deprecations']) {
|
||||
|
||||
@@ -33,8 +33,7 @@ class FatalError extends \Error
|
||||
}
|
||||
}
|
||||
} elseif (null !== $traceOffset) {
|
||||
if (\function_exists('xdebug_get_function_stack')) {
|
||||
$trace = xdebug_get_function_stack();
|
||||
if (\function_exists('xdebug_get_function_stack') && $trace = @xdebug_get_function_stack()) {
|
||||
if (0 < $traceOffset) {
|
||||
array_splice($trace, -$traceOffset);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class UndefinedMethodErrorEnhancer implements ErrorEnhancerInterface
|
||||
|
||||
$message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
|
||||
|
||||
if (!class_exists($className) || null === $methods = get_class_methods($className)) {
|
||||
if ('' === $methodName || !class_exists($className) || null === $methods = get_class_methods($className)) {
|
||||
// failed to get the class or its methods on which an unknown method was called (for example on an anonymous class)
|
||||
return new UndefinedMethodError($message, $error);
|
||||
}
|
||||
|
||||
27
vendor/symfony/error-handler/ErrorHandler.php
vendored
27
vendor/symfony/error-handler/ErrorHandler.php
vendored
@@ -187,7 +187,7 @@ class ErrorHandler
|
||||
$this->bootstrappingLogger = $bootstrappingLogger;
|
||||
$this->setDefaultLogger($bootstrappingLogger);
|
||||
}
|
||||
$traceReflector = new \ReflectionProperty('Exception', 'trace');
|
||||
$traceReflector = new \ReflectionProperty(\Exception::class, 'trace');
|
||||
$traceReflector->setAccessible(true);
|
||||
$this->configureException = \Closure::bind(static function ($e, $trace, $file = null, $line = null) use ($traceReflector) {
|
||||
$traceReflector->setValue($e, $trace);
|
||||
@@ -428,11 +428,7 @@ class ErrorHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
if (false !== strpos($message, "@anonymous\0")) {
|
||||
$logMessage = $this->parseAnonymousClass($message);
|
||||
} else {
|
||||
$logMessage = $this->levels[$type].': '.$message;
|
||||
}
|
||||
$logMessage = $this->levels[$type].': '.$message;
|
||||
|
||||
if (null !== self::$toStringException) {
|
||||
$errorAsException = self::$toStringException;
|
||||
@@ -461,6 +457,23 @@ class ErrorHandler
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (false !== strpos($message, '@anonymous')) {
|
||||
$backtrace = debug_backtrace(false, 5);
|
||||
|
||||
for ($i = 1; isset($backtrace[$i]); ++$i) {
|
||||
if (isset($backtrace[$i]['function'], $backtrace[$i]['args'][0])
|
||||
&& ('trigger_error' === $backtrace[$i]['function'] || 'user_error' === $backtrace[$i]['function'])
|
||||
) {
|
||||
if ($backtrace[$i]['args'][0] !== $message) {
|
||||
$message = $this->parseAnonymousClass($backtrace[$i]['args'][0]);
|
||||
$logMessage = $this->levels[$type].': '.$message;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$errorAsException = new \ErrorException($logMessage, 0, $type, $file, $line);
|
||||
|
||||
if ($throw || $this->tracedErrors & $type) {
|
||||
@@ -665,7 +678,7 @@ class ErrorHandler
|
||||
if ($error && $error['type'] &= \E_PARSE | \E_ERROR | \E_CORE_ERROR | \E_COMPILE_ERROR) {
|
||||
// Let's not throw anymore but keep logging
|
||||
$handler->throwAt(0, true);
|
||||
$trace = isset($error['backtrace']) ? $error['backtrace'] : null;
|
||||
$trace = $error['backtrace'] ?? null;
|
||||
|
||||
if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
|
||||
$fatalError = new OutOfMemoryError($handler->levels[$error['type']].': '.$error['message'], 0, $error, 2, false, $trace);
|
||||
|
||||
@@ -352,7 +352,7 @@ class HtmlErrorRenderer implements ErrorRendererInterface
|
||||
extract($context, \EXTR_SKIP);
|
||||
ob_start();
|
||||
|
||||
include file_exists($name) ? $name : __DIR__.'/../Resources/'.$name;
|
||||
include is_file(\dirname(__DIR__).'/Resources/'.$name) ? \dirname(__DIR__).'/Resources/'.$name : $name;
|
||||
|
||||
return trim(ob_get_clean());
|
||||
}
|
||||
|
||||
@@ -24,17 +24,40 @@ use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
|
||||
*/
|
||||
class FlattenException
|
||||
{
|
||||
/** @var string */
|
||||
private $message;
|
||||
|
||||
/** @var int|string */
|
||||
private $code;
|
||||
|
||||
/** @var self|null */
|
||||
private $previous;
|
||||
|
||||
/** @var array */
|
||||
private $trace;
|
||||
|
||||
/** @var string */
|
||||
private $traceAsString;
|
||||
|
||||
/** @var string */
|
||||
private $class;
|
||||
|
||||
/** @var int */
|
||||
private $statusCode;
|
||||
|
||||
/** @var string */
|
||||
private $statusText;
|
||||
|
||||
/** @var array */
|
||||
private $headers;
|
||||
|
||||
/** @var string */
|
||||
private $file;
|
||||
|
||||
/** @var int */
|
||||
private $line;
|
||||
|
||||
/** @var string|null */
|
||||
private $asString;
|
||||
|
||||
/**
|
||||
@@ -108,6 +131,8 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $code
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStatusCode($code): self
|
||||
@@ -138,6 +163,8 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $class
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setClass($class): self
|
||||
@@ -153,6 +180,8 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFile($file): self
|
||||
@@ -168,6 +197,8 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $line
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLine($line): self
|
||||
@@ -195,6 +226,8 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $message
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMessage($message): self
|
||||
@@ -219,6 +252,8 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|string $code
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCode($code): self
|
||||
@@ -273,6 +308,10 @@ class FlattenException
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $trace
|
||||
* @param string|null $file
|
||||
* @param int|null $line
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTrace($trace, $file, $line): self
|
||||
@@ -300,11 +339,11 @@ class FlattenException
|
||||
$this->trace[] = [
|
||||
'namespace' => $namespace,
|
||||
'short_class' => $class,
|
||||
'class' => isset($entry['class']) ? $entry['class'] : '',
|
||||
'type' => isset($entry['type']) ? $entry['type'] : '',
|
||||
'function' => isset($entry['function']) ? $entry['function'] : null,
|
||||
'file' => isset($entry['file']) ? $entry['file'] : null,
|
||||
'line' => isset($entry['line']) ? $entry['line'] : null,
|
||||
'class' => $entry['class'] ?? '',
|
||||
'type' => $entry['type'] ?? '',
|
||||
'function' => $entry['function'] ?? null,
|
||||
'file' => $entry['file'] ?? null,
|
||||
'line' => $entry['line'] ?? null,
|
||||
'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : [],
|
||||
];
|
||||
}
|
||||
@@ -320,7 +359,6 @@ class FlattenException
|
||||
return ['array', '*SKIPPED over 10000 entries*'];
|
||||
}
|
||||
if ($value instanceof \__PHP_Incomplete_Class) {
|
||||
// is_object() returns false on PHP<=7.1
|
||||
$result[$key] = ['incomplete-object', $this->getClassNameFromIncomplete($value)];
|
||||
} elseif (\is_object($value)) {
|
||||
$result[$key] = ['object', \get_class($value)];
|
||||
|
||||
2
vendor/symfony/error-handler/LICENSE
vendored
2
vendor/symfony/error-handler/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2019-2020 Fabien Potencier
|
||||
Copyright (c) 2019-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
);
|
||||
</script>
|
||||
|
||||
<?php if (class_exists('Symfony\Component\HttpKernel\Kernel')) { ?>
|
||||
<?php if (class_exists(\Symfony\Component\HttpKernel\Kernel::class)) { ?>
|
||||
<header>
|
||||
<div class="container">
|
||||
<h1 class="logo"><?= $this->include('assets/images/symfony-logo.svg'); ?> Symfony Exception</h1>
|
||||
|
||||
2
vendor/symfony/error-handler/composer.json
vendored
2
vendor/symfony/error-handler/composer.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "symfony/error-handler",
|
||||
"type": "library",
|
||||
"description": "Symfony ErrorHandler Component",
|
||||
"description": "Provides tools to manage errors and ease debugging PHP code",
|
||||
"keywords": [],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -2,4 +2,4 @@ CHANGELOG
|
||||
=========
|
||||
|
||||
The changelog is maintained for all Symfony contracts at the following URL:
|
||||
https://github.com/symfony/contracts/blob/master/CHANGELOG.md
|
||||
https://github.com/symfony/contracts/blob/main/CHANGELOG.md
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -6,4 +6,4 @@ A set of abstractions extracted out of the Symfony components.
|
||||
Can be used to build on semantics that the Symfony components proved useful - and
|
||||
that already have battle tested implementations.
|
||||
|
||||
See https://github.com/symfony/contracts/blob/master/README.md for more information.
|
||||
See https://github.com/symfony/contracts/blob/main/README.md for more information.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2-dev"
|
||||
"dev-main": "2.4-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
||||
@@ -83,7 +83,7 @@ class RegisterListenersPass implements CompilerPassInterface
|
||||
$noPreload = 0;
|
||||
|
||||
foreach ($events as $event) {
|
||||
$priority = isset($event['priority']) ? $event['priority'] : 0;
|
||||
$priority = $event['priority'] ?? 0;
|
||||
|
||||
if (!isset($event['event'])) {
|
||||
if ($container->getDefinition($id)->hasTag($this->subscriberTag)) {
|
||||
@@ -149,7 +149,7 @@ class RegisterListenersPass implements CompilerPassInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
$dispatcherDefinitions[] = $container->getDefinition($attributes['dispatcher']);
|
||||
$dispatcherDefinitions[$attributes['dispatcher']] = $container->getDefinition($attributes['dispatcher']);
|
||||
}
|
||||
|
||||
if (!$dispatcherDefinitions) {
|
||||
|
||||
@@ -184,10 +184,10 @@ class EventDispatcher implements EventDispatcherInterface
|
||||
if (\is_string($params)) {
|
||||
$this->addListener($eventName, [$subscriber, $params]);
|
||||
} elseif (\is_string($params[0])) {
|
||||
$this->addListener($eventName, [$subscriber, $params[0]], isset($params[1]) ? $params[1] : 0);
|
||||
$this->addListener($eventName, [$subscriber, $params[0]], $params[1] ?? 0);
|
||||
} else {
|
||||
foreach ($params as $listener) {
|
||||
$this->addListener($eventName, [$subscriber, $listener[0]], isset($listener[1]) ? $listener[1] : 0);
|
||||
$this->addListener($eventName, [$subscriber, $listener[0]], $listener[1] ?? 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/symfony/event-dispatcher/LICENSE
vendored
2
vendor/symfony/event-dispatcher/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2020 Fabien Potencier
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"type": "library",
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
|
||||
"keywords": [],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -36,7 +36,7 @@ class DateComparator extends Comparator
|
||||
throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
|
||||
}
|
||||
|
||||
$operator = isset($matches[1]) ? $matches[1] : '==';
|
||||
$operator = $matches[1] ?? '==';
|
||||
if ('since' === $operator || 'after' === $operator) {
|
||||
$operator = '>';
|
||||
}
|
||||
|
||||
@@ -74,6 +74,6 @@ class NumberComparator extends Comparator
|
||||
}
|
||||
|
||||
$this->setTarget($target);
|
||||
$this->setOperator(isset($matches[1]) ? $matches[1] : '==');
|
||||
$this->setOperator($matches[1] ?? '==');
|
||||
}
|
||||
}
|
||||
|
||||
25
vendor/symfony/finder/Finder.php
vendored
25
vendor/symfony/finder/Finder.php
vendored
@@ -20,6 +20,7 @@ use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
|
||||
use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
|
||||
use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
|
||||
use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
|
||||
use Symfony\Component\Finder\Iterator\LazyIterator;
|
||||
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
|
||||
use Symfony\Component\Finder\Iterator\SortableIterator;
|
||||
|
||||
@@ -611,18 +612,30 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
}
|
||||
|
||||
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
|
||||
return $this->searchInDirectory($this->dirs[0]);
|
||||
$iterator = $this->searchInDirectory($this->dirs[0]);
|
||||
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
|
||||
}
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
$iterator = new \AppendIterator();
|
||||
foreach ($this->dirs as $dir) {
|
||||
$iterator->append($this->searchInDirectory($dir));
|
||||
$iterator->append(new \IteratorIterator(new LazyIterator(function () use ($dir) {
|
||||
return $this->searchInDirectory($dir);
|
||||
})));
|
||||
}
|
||||
|
||||
foreach ($this->iterators as $it) {
|
||||
$iterator->append($it);
|
||||
}
|
||||
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iterator = (new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting))->getIterator();
|
||||
}
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
@@ -644,7 +657,8 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
} elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
|
||||
$it = new \ArrayIterator();
|
||||
foreach ($iterator as $file) {
|
||||
$it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
|
||||
$file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
|
||||
$it[$file->getPathname()] = $file;
|
||||
}
|
||||
$this->iterators[] = $it;
|
||||
} else {
|
||||
@@ -767,11 +781,6 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
$iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $notPaths);
|
||||
}
|
||||
|
||||
if ($this->sort || $this->reverseSorting) {
|
||||
$iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort, $this->reverseSorting);
|
||||
$iterator = $iteratorAggregate->getIterator();
|
||||
}
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
|
||||
132
vendor/symfony/finder/Gitignore.php
vendored
132
vendor/symfony/finder/Gitignore.php
vendored
@@ -14,6 +14,7 @@ namespace Symfony\Component\Finder;
|
||||
/**
|
||||
* Gitignore matches against text.
|
||||
*
|
||||
* @author Michael Voříšek <vorismi3@fel.cvut.cz>
|
||||
* @author Ahmed Abdou <mail@ahmd.io>
|
||||
*/
|
||||
class Gitignore
|
||||
@@ -21,113 +22,66 @@ class Gitignore
|
||||
/**
|
||||
* Returns a regexp which is the equivalent of the gitignore pattern.
|
||||
*
|
||||
* @return string The regexp
|
||||
* Format specification: https://git-scm.com/docs/gitignore#_pattern_format
|
||||
*/
|
||||
public static function toRegex(string $gitignoreFileContent): string
|
||||
{
|
||||
$gitignoreFileContent = preg_replace('/^[^\\\r\n]*#.*/m', '', $gitignoreFileContent);
|
||||
$gitignoreLines = preg_split('/\r\n|\r|\n/', $gitignoreFileContent);
|
||||
$gitignoreFileContent = preg_replace('~(?<!\\\\)#[^\n\r]*~', '', $gitignoreFileContent);
|
||||
$gitignoreLines = preg_split('~\r\n?|\n~', $gitignoreFileContent);
|
||||
|
||||
$positives = [];
|
||||
$negatives = [];
|
||||
$res = self::lineToRegex('');
|
||||
foreach ($gitignoreLines as $i => $line) {
|
||||
$line = trim($line);
|
||||
if ('' === $line) {
|
||||
continue;
|
||||
$line = preg_replace('~(?<!\\\\)[ \t]+$~', '', $line);
|
||||
|
||||
if ('!' === substr($line, 0, 1)) {
|
||||
$line = substr($line, 1);
|
||||
$isNegative = true;
|
||||
} else {
|
||||
$isNegative = false;
|
||||
}
|
||||
|
||||
if (1 === preg_match('/^!/', $line)) {
|
||||
$positives[$i] = null;
|
||||
$negatives[$i] = self::getRegexFromGitignore(preg_replace('/^!(.*)/', '${1}', $line), true);
|
||||
|
||||
continue;
|
||||
if ('' !== $line) {
|
||||
if ($isNegative) {
|
||||
$res = '(?!'.self::lineToRegex($line).'$)'.$res;
|
||||
} else {
|
||||
$res = '(?:'.$res.'|'.self::lineToRegex($line).')';
|
||||
}
|
||||
}
|
||||
$negatives[$i] = null;
|
||||
$positives[$i] = self::getRegexFromGitignore($line);
|
||||
}
|
||||
|
||||
$index = 0;
|
||||
$patterns = [];
|
||||
foreach ($positives as $pattern) {
|
||||
if (null === $pattern) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$negativesAfter = array_filter(\array_slice($negatives, ++$index));
|
||||
if ([] !== $negativesAfter) {
|
||||
$pattern .= sprintf('(?<!%s)', implode('|', $negativesAfter));
|
||||
}
|
||||
|
||||
$patterns[] = $pattern;
|
||||
}
|
||||
|
||||
return sprintf('/^((%s))$/', implode(')|(', $patterns));
|
||||
return '~^(?:'.$res.')~s';
|
||||
}
|
||||
|
||||
private static function getRegexFromGitignore(string $gitignorePattern, bool $negative = false): string
|
||||
private static function lineToRegex(string $gitignoreLine): string
|
||||
{
|
||||
$regex = '';
|
||||
$isRelativePath = false;
|
||||
// If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore file itself
|
||||
$slashPosition = strpos($gitignorePattern, '/');
|
||||
if (false !== $slashPosition && \strlen($gitignorePattern) - 1 !== $slashPosition) {
|
||||
if (0 === $slashPosition) {
|
||||
$gitignorePattern = substr($gitignorePattern, 1);
|
||||
}
|
||||
|
||||
$isRelativePath = true;
|
||||
$regex .= '^';
|
||||
if ('' === $gitignoreLine) {
|
||||
return '$f'; // always false
|
||||
}
|
||||
|
||||
if ('/' === $gitignorePattern[\strlen($gitignorePattern) - 1]) {
|
||||
$gitignorePattern = substr($gitignorePattern, 0, -1);
|
||||
$slashPos = strpos($gitignoreLine, '/');
|
||||
if (false !== $slashPos && \strlen($gitignoreLine) - 1 !== $slashPos) {
|
||||
if (0 === $slashPos) {
|
||||
$gitignoreLine = substr($gitignoreLine, 1);
|
||||
}
|
||||
$isAbsolute = true;
|
||||
} else {
|
||||
$isAbsolute = false;
|
||||
}
|
||||
|
||||
$iMax = \strlen($gitignorePattern);
|
||||
for ($i = 0; $i < $iMax; ++$i) {
|
||||
$tripleChars = substr($gitignorePattern, $i, 3);
|
||||
if ('**/' === $tripleChars || '/**' === $tripleChars) {
|
||||
$regex .= '.*';
|
||||
$i += 2;
|
||||
continue;
|
||||
}
|
||||
$parts = array_map(function (string $v): string {
|
||||
$v = preg_quote(str_replace('\\', '', $v), '~');
|
||||
$v = preg_replace_callback('~\\\\\[([^\[\]]*)\\\\\]~', function (array $matches): string {
|
||||
return '['.str_replace('\\-', '-', $matches[1]).']';
|
||||
}, $v);
|
||||
$v = preg_replace('~\\\\\*\\\\\*~', '[^/]+(?:/[^/]+)*', $v);
|
||||
$v = preg_replace('~\\\\\*~', '[^/]*', $v);
|
||||
$v = preg_replace('~\\\\\?~', '[^/]', $v);
|
||||
|
||||
$doubleChars = substr($gitignorePattern, $i, 2);
|
||||
if ('**' === $doubleChars) {
|
||||
$regex .= '.*';
|
||||
++$i;
|
||||
continue;
|
||||
}
|
||||
if ('*/' === $doubleChars) {
|
||||
$regex .= '[^\/]*\/?[^\/]*';
|
||||
++$i;
|
||||
continue;
|
||||
}
|
||||
return $v;
|
||||
}, explode('/', $gitignoreLine));
|
||||
|
||||
$c = $gitignorePattern[$i];
|
||||
switch ($c) {
|
||||
case '*':
|
||||
$regex .= $isRelativePath ? '[^\/]*' : '[^\/]*\/?[^\/]*';
|
||||
break;
|
||||
case '/':
|
||||
case '.':
|
||||
case ':':
|
||||
case '(':
|
||||
case ')':
|
||||
case '{':
|
||||
case '}':
|
||||
$regex .= '\\'.$c;
|
||||
break;
|
||||
default:
|
||||
$regex .= $c;
|
||||
}
|
||||
}
|
||||
|
||||
if ($negative) {
|
||||
// a lookbehind assertion has to be a fixed width (it can not have nested '|' statements)
|
||||
return sprintf('%s$|%s\/$', $regex, $regex);
|
||||
}
|
||||
|
||||
return '(?>'.$regex.'($|\/.*))';
|
||||
return ($isAbsolute ? '' : '(?:[^/]+/)*')
|
||||
.implode('/', $parts)
|
||||
.('' !== end($parts) ? '(?:$|/)' : '');
|
||||
}
|
||||
}
|
||||
|
||||
32
vendor/symfony/finder/Iterator/LazyIterator.php
vendored
Normal file
32
vendor/symfony/finder/Iterator/LazyIterator.php
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
<?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\Finder\Iterator;
|
||||
|
||||
/**
|
||||
* @author Jérémy Derussé <jeremy@derusse.com>
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
class LazyIterator implements \IteratorAggregate
|
||||
{
|
||||
private $iteratorFactory;
|
||||
|
||||
public function __construct(callable $iteratorFactory)
|
||||
{
|
||||
$this->iteratorFactory = $iteratorFactory;
|
||||
}
|
||||
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
yield from ($this->iteratorFactory)();
|
||||
}
|
||||
}
|
||||
2
vendor/symfony/finder/LICENSE
vendored
2
vendor/symfony/finder/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2020 Fabien Potencier
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
2
vendor/symfony/finder/composer.json
vendored
2
vendor/symfony/finder/composer.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"type": "library",
|
||||
"description": "Symfony Finder Component",
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"keywords": [],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -2,4 +2,4 @@ CHANGELOG
|
||||
=========
|
||||
|
||||
The changelog is maintained for all Symfony contracts at the following URL:
|
||||
https://github.com/symfony/contracts/blob/master/CHANGELOG.md
|
||||
https://github.com/symfony/contracts/blob/main/CHANGELOG.md
|
||||
|
||||
@@ -19,6 +19,8 @@ use Symfony\Contracts\HttpClient\Test\HttpClientTestCase;
|
||||
*
|
||||
* @see HttpClientTestCase for a reference test suite
|
||||
*
|
||||
* @method static withOptions(array $options) Returns a new instance of the client with new default options
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*/
|
||||
interface HttpClientInterface
|
||||
|
||||
2
vendor/symfony/http-client-contracts/LICENSE
vendored
2
vendor/symfony/http-client-contracts/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2018-2020 Fabien Potencier
|
||||
Copyright (c) 2018-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -6,4 +6,4 @@ A set of abstractions extracted out of the Symfony components.
|
||||
Can be used to build on semantics that the Symfony components proved useful - and
|
||||
that already have battle tested implementations.
|
||||
|
||||
See https://github.com/symfony/contracts/blob/master/README.md for more information.
|
||||
See https://github.com/symfony/contracts/blob/main/README.md for more information.
|
||||
|
||||
@@ -95,15 +95,15 @@ interface ResponseInterface
|
||||
* - response_headers (array) - an array modelled after the special $http_response_header variable
|
||||
* - start_time (float) - the time when the request was sent or 0.0 when it's pending
|
||||
* - url (string) - the last effective URL of the request
|
||||
* - user_data (mixed|null) - the value of the "user_data" request option, null if not set
|
||||
* - user_data (mixed) - the value of the "user_data" request option, null if not set
|
||||
*
|
||||
* When the "capture_peer_cert_chain" option is true, the "peer_certificate_chain"
|
||||
* attribute SHOULD list the peer certificates as an array of OpenSSL X.509 resources.
|
||||
*
|
||||
* Other info SHOULD be named after curl_getinfo()'s associative return value.
|
||||
*
|
||||
* @return array|mixed|null An array of all available info, or one of them when $type is
|
||||
* provided, or null when an unsupported type is requested
|
||||
* @return mixed An array of all available info, or one of them when $type is
|
||||
* provided, or null when an unsupported type is requested
|
||||
*/
|
||||
public function getInfo(string $type = null);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ foreach ($_SERVER as $k => $v) {
|
||||
}
|
||||
}
|
||||
|
||||
$json = json_encode($vars, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
$json = json_encode($vars, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
|
||||
|
||||
switch ($vars['REQUEST_URI']) {
|
||||
default:
|
||||
@@ -111,7 +111,7 @@ switch ($vars['REQUEST_URI']) {
|
||||
break;
|
||||
|
||||
case '/post':
|
||||
$output = json_encode($_POST + ['REQUEST_METHOD' => $vars['REQUEST_METHOD']], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
||||
$output = json_encode($_POST + ['REQUEST_METHOD' => $vars['REQUEST_METHOD']], \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
|
||||
header('Content-Type: application/json', true);
|
||||
header('Content-Length: '.strlen($output));
|
||||
echo $output;
|
||||
|
||||
@@ -1038,4 +1038,20 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$this->assertLessThan(10, $duration);
|
||||
}
|
||||
|
||||
public function testWithOptions()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
if (!method_exists($client, 'withOptions')) {
|
||||
$this->markTestSkipped(sprintf('Not implementing "%s::withOptions()" is deprecated.', get_debug_type($client)));
|
||||
}
|
||||
|
||||
$client2 = $client->withOptions(['base_uri' => 'http://localhost:8057/']);
|
||||
|
||||
$this->assertNotSame($client, $client2);
|
||||
$this->assertSame(\get_class($client), \get_class($client2));
|
||||
|
||||
$response = $client2->request('GET', '/');
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-version": "2.3",
|
||||
"branch-alias": {
|
||||
"dev-main": "2.3-dev"
|
||||
"dev-main": "2.4-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
|
||||
@@ -146,7 +146,7 @@ class AcceptHeaderItem
|
||||
*/
|
||||
public function getAttribute(string $name, $default = null)
|
||||
{
|
||||
return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
|
||||
return $this->attributes[$name] ?? $default;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -301,8 +301,8 @@ class BinaryFileResponse extends Response
|
||||
return $this;
|
||||
}
|
||||
|
||||
$out = fopen('php://output', 'wb');
|
||||
$file = fopen($this->file->getPathname(), 'rb');
|
||||
$out = fopen('php://output', 'w');
|
||||
$file = fopen($this->file->getPathname(), 'r');
|
||||
|
||||
stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);
|
||||
|
||||
|
||||
6
vendor/symfony/http-foundation/Cookie.php
vendored
6
vendor/symfony/http-foundation/Cookie.php
vendored
@@ -35,8 +35,8 @@ class Cookie
|
||||
private $secureDefault = false;
|
||||
|
||||
private static $reservedCharsList = "=,; \t\r\n\v\f";
|
||||
private static $reservedCharsFrom = ['=', ',', ';', ' ', "\t", "\r", "\n", "\v", "\f"];
|
||||
private static $reservedCharsTo = ['%3D', '%2C', '%3B', '%20', '%09', '%0D', '%0A', '%0B', '%0C'];
|
||||
private const RESERVED_CHARS_FROM = ['=', ',', ';', ' ', "\t", "\r", "\n", "\v", "\f"];
|
||||
private const RESERVED_CHARS_TO = ['%3D', '%2C', '%3B', '%20', '%09', '%0D', '%0A', '%0B', '%0C'];
|
||||
|
||||
/**
|
||||
* Creates cookie from raw header string.
|
||||
@@ -264,7 +264,7 @@ class Cookie
|
||||
if ($this->isRaw()) {
|
||||
$str = $this->getName();
|
||||
} else {
|
||||
$str = str_replace(self::$reservedCharsFrom, self::$reservedCharsTo, $this->getName());
|
||||
$str = str_replace(self::RESERVED_CHARS_FROM, self::RESERVED_CHARS_TO, $this->getName());
|
||||
}
|
||||
|
||||
$str .= '=';
|
||||
|
||||
@@ -216,7 +216,7 @@ class UploadedFile extends File
|
||||
/**
|
||||
* Returns the maximum size of an uploaded file as configured in php.ini.
|
||||
*
|
||||
* @return int The maximum size of an uploaded file in bytes
|
||||
* @return int|float The maximum size of an uploaded file in bytes (returns float if size > PHP_INT_MAX)
|
||||
*/
|
||||
public static function getMaxFilesize()
|
||||
{
|
||||
@@ -228,8 +228,10 @@ class UploadedFile extends File
|
||||
|
||||
/**
|
||||
* Returns the given size from an ini value in bytes.
|
||||
*
|
||||
* @return int|float Returns float if size > PHP_INT_MAX
|
||||
*/
|
||||
private static function parseFilesize($size): int
|
||||
private static function parseFilesize($size)
|
||||
{
|
||||
if ('' === $size) {
|
||||
return 0;
|
||||
@@ -278,7 +280,7 @@ class UploadedFile extends File
|
||||
|
||||
$errorCode = $this->error;
|
||||
$maxFilesize = \UPLOAD_ERR_INI_SIZE === $errorCode ? self::getMaxFilesize() / 1024 : 0;
|
||||
$message = isset($errors[$errorCode]) ? $errors[$errorCode] : 'The file "%s" was not uploaded due to an unknown error.';
|
||||
$message = $errors[$errorCode] ?? 'The file "%s" was not uploaded due to an unknown error.';
|
||||
|
||||
return sprintf($message, $this->getClientOriginalName(), $maxFilesize);
|
||||
}
|
||||
|
||||
8
vendor/symfony/http-foundation/FileBag.php
vendored
8
vendor/symfony/http-foundation/FileBag.php
vendored
@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
*/
|
||||
class FileBag extends ParameterBag
|
||||
{
|
||||
private static $fileKeys = ['error', 'name', 'size', 'tmp_name', 'type'];
|
||||
private const FILE_KEYS = ['error', 'name', 'size', 'tmp_name', 'type'];
|
||||
|
||||
/**
|
||||
* @param array|UploadedFile[] $parameters An array of HTTP files
|
||||
@@ -80,7 +80,7 @@ class FileBag extends ParameterBag
|
||||
$keys = array_keys($file);
|
||||
sort($keys);
|
||||
|
||||
if ($keys == self::$fileKeys) {
|
||||
if (self::FILE_KEYS == $keys) {
|
||||
if (\UPLOAD_ERR_NO_FILE == $file['error']) {
|
||||
$file = null;
|
||||
} else {
|
||||
@@ -118,12 +118,12 @@ class FileBag extends ParameterBag
|
||||
$keys = array_keys($data);
|
||||
sort($keys);
|
||||
|
||||
if (self::$fileKeys != $keys || !isset($data['name']) || !\is_array($data['name'])) {
|
||||
if (self::FILE_KEYS != $keys || !isset($data['name']) || !\is_array($data['name'])) {
|
||||
return $data;
|
||||
}
|
||||
|
||||
$files = $data;
|
||||
foreach (self::$fileKeys as $k) {
|
||||
foreach (self::FILE_KEYS as $k) {
|
||||
unset($files[$k]);
|
||||
}
|
||||
|
||||
|
||||
2
vendor/symfony/http-foundation/HeaderBag.php
vendored
2
vendor/symfony/http-foundation/HeaderBag.php
vendored
@@ -230,7 +230,7 @@ class HeaderBag implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Returns a Cache-Control directive value by name.
|
||||
*
|
||||
* @return mixed|null The directive value if defined, null otherwise
|
||||
* @return mixed The directive value if defined, null otherwise
|
||||
*/
|
||||
public function getCacheControlDirective(string $key)
|
||||
{
|
||||
|
||||
21
vendor/symfony/http-foundation/HeaderUtils.php
vendored
21
vendor/symfony/http-foundation/HeaderUtils.php
vendored
@@ -146,7 +146,7 @@ class HeaderUtils
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a HTTP Content-Disposition field-value.
|
||||
* Generates an HTTP Content-Disposition field-value.
|
||||
*
|
||||
* @param string $disposition One of "inline" or "attachment"
|
||||
* @param string $filename A unicode string
|
||||
@@ -251,17 +251,23 @@ class HeaderUtils
|
||||
return $query;
|
||||
}
|
||||
|
||||
private static function groupParts(array $matches, string $separators): array
|
||||
private static function groupParts(array $matches, string $separators, bool $first = true): array
|
||||
{
|
||||
$separator = $separators[0];
|
||||
$partSeparators = substr($separators, 1);
|
||||
|
||||
$i = 0;
|
||||
$partMatches = [];
|
||||
$previousMatchWasSeparator = false;
|
||||
foreach ($matches as $match) {
|
||||
if (isset($match['separator']) && $match['separator'] === $separator) {
|
||||
if (!$first && $previousMatchWasSeparator && isset($match['separator']) && $match['separator'] === $separator) {
|
||||
$previousMatchWasSeparator = true;
|
||||
$partMatches[$i][] = $match;
|
||||
} elseif (isset($match['separator']) && $match['separator'] === $separator) {
|
||||
$previousMatchWasSeparator = true;
|
||||
++$i;
|
||||
} else {
|
||||
$previousMatchWasSeparator = false;
|
||||
$partMatches[$i][] = $match;
|
||||
}
|
||||
}
|
||||
@@ -269,12 +275,19 @@ class HeaderUtils
|
||||
$parts = [];
|
||||
if ($partSeparators) {
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = self::groupParts($matches, $partSeparators);
|
||||
$parts[] = self::groupParts($matches, $partSeparators, false);
|
||||
}
|
||||
} else {
|
||||
foreach ($partMatches as $matches) {
|
||||
$parts[] = self::unquote($matches[0][0]);
|
||||
}
|
||||
|
||||
if (!$first && 2 < \count($parts)) {
|
||||
$parts = [
|
||||
$parts[0],
|
||||
implode($separator, \array_slice($parts, 1)),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $parts;
|
||||
|
||||
@@ -72,7 +72,7 @@ class JsonResponse extends Response
|
||||
*/
|
||||
public static function create($data = null, int $status = 200, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($data, $status, $headers);
|
||||
}
|
||||
|
||||
2
vendor/symfony/http-foundation/LICENSE
vendored
2
vendor/symfony/http-foundation/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2020 Fabien Potencier
|
||||
Copyright (c) 2004-2021 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -58,7 +58,7 @@ class RedirectResponse extends Response
|
||||
*/
|
||||
public static function create($url = '', int $status = 302, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($url, $status, $headers);
|
||||
}
|
||||
|
||||
65
vendor/symfony/http-foundation/Request.php
vendored
65
vendor/symfony/http-foundation/Request.php
vendored
@@ -220,7 +220,7 @@ class Request
|
||||
|
||||
private static $trustedHeaderSet = -1;
|
||||
|
||||
private static $forwardedParams = [
|
||||
private const FORWARDED_PARAMS = [
|
||||
self::HEADER_X_FORWARDED_FOR => 'for',
|
||||
self::HEADER_X_FORWARDED_HOST => 'host',
|
||||
self::HEADER_X_FORWARDED_PROTO => 'proto',
|
||||
@@ -236,7 +236,7 @@ class Request
|
||||
* The other headers are non-standard, but widely used
|
||||
* by popular reverse proxies (like Apache mod_proxy or Amazon EC2).
|
||||
*/
|
||||
private static $trustedHeaders = [
|
||||
private const TRUSTED_HEADERS = [
|
||||
self::HEADER_FORWARDED => 'FORWARDED',
|
||||
self::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR',
|
||||
self::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST',
|
||||
@@ -306,7 +306,7 @@ class Request
|
||||
|
||||
if ($_POST) {
|
||||
$request->request = new InputBag($_POST);
|
||||
} elseif (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded')
|
||||
} elseif (0 === strpos($request->headers->get('CONTENT_TYPE', ''), 'application/x-www-form-urlencoded')
|
||||
&& \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), ['PUT', 'DELETE', 'PATCH'])
|
||||
) {
|
||||
parse_str($request->getContent(), $data);
|
||||
@@ -347,6 +347,7 @@ class Request
|
||||
'SCRIPT_FILENAME' => '',
|
||||
'SERVER_PROTOCOL' => 'HTTP/1.1',
|
||||
'REQUEST_TIME' => time(),
|
||||
'REQUEST_TIME_FLOAT' => microtime(true),
|
||||
], $server);
|
||||
|
||||
$server['PATH_INFO'] = '';
|
||||
@@ -698,7 +699,7 @@ class Request
|
||||
* flexibility in controllers, it is better to explicitly get request parameters from the appropriate
|
||||
* public property instead (attributes, query, request).
|
||||
*
|
||||
* Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY
|
||||
* Order of precedence: PATH (routing placeholders or custom attributes), GET, POST
|
||||
*
|
||||
* @param mixed $default The default value if the parameter key does not exist
|
||||
*
|
||||
@@ -1322,7 +1323,7 @@ class Request
|
||||
static::initializeFormats();
|
||||
}
|
||||
|
||||
return isset(static::$formats[$format]) ? static::$formats[$format] : [];
|
||||
return static::$formats[$format] ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1404,7 +1405,7 @@ class Request
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->getFormat($this->headers->get('CONTENT_TYPE'));
|
||||
return $this->getFormat($this->headers->get('CONTENT_TYPE', ''));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1502,7 +1503,7 @@ class Request
|
||||
* if the proxy is trusted (see "setTrustedProxies()"), otherwise it returns
|
||||
* the latter (from the "SERVER_PROTOCOL" server parameter).
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getProtocolVersion()
|
||||
{
|
||||
@@ -1546,7 +1547,7 @@ class Request
|
||||
|
||||
$this->content = false;
|
||||
|
||||
return fopen('php://input', 'rb');
|
||||
return fopen('php://input', 'r');
|
||||
}
|
||||
|
||||
if ($currentContentIsResource) {
|
||||
@@ -1572,7 +1573,7 @@ class Request
|
||||
public function toArray()
|
||||
{
|
||||
if ('' === $content = $this->getContent()) {
|
||||
throw new JsonException('Response body is empty.');
|
||||
throw new JsonException('Request body is empty.');
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1599,7 +1600,7 @@ class Request
|
||||
*/
|
||||
public function getETags()
|
||||
{
|
||||
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match'), null, \PREG_SPLIT_NO_EMPTY);
|
||||
return preg_split('/\s*,\s*/', $this->headers->get('if_none_match', ''), -1, \PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1645,7 +1646,7 @@ class Request
|
||||
$preferredLanguages = $this->getLanguages();
|
||||
|
||||
if (empty($locales)) {
|
||||
return isset($preferredLanguages[0]) ? $preferredLanguages[0] : null;
|
||||
return $preferredLanguages[0] ?? null;
|
||||
}
|
||||
|
||||
if (!$preferredLanguages) {
|
||||
@@ -1665,7 +1666,7 @@ class Request
|
||||
|
||||
$preferredLanguages = array_values(array_intersect($extendedPreferredLanguages, $locales));
|
||||
|
||||
return isset($preferredLanguages[0]) ? $preferredLanguages[0] : $locales[0];
|
||||
return $preferredLanguages[0] ?? $locales[0];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1751,7 +1752,7 @@ class Request
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the request is a XMLHttpRequest.
|
||||
* Returns true if the request is an XMLHttpRequest.
|
||||
*
|
||||
* It works if your JavaScript library sets an X-Requested-With HTTP header.
|
||||
* It is known to work with common JavaScript frameworks:
|
||||
@@ -1848,13 +1849,13 @@ class Request
|
||||
*/
|
||||
protected function prepareBaseUrl()
|
||||
{
|
||||
$filename = basename($this->server->get('SCRIPT_FILENAME'));
|
||||
$filename = basename($this->server->get('SCRIPT_FILENAME', ''));
|
||||
|
||||
if (basename($this->server->get('SCRIPT_NAME')) === $filename) {
|
||||
if (basename($this->server->get('SCRIPT_NAME', '')) === $filename) {
|
||||
$baseUrl = $this->server->get('SCRIPT_NAME');
|
||||
} elseif (basename($this->server->get('PHP_SELF')) === $filename) {
|
||||
} elseif (basename($this->server->get('PHP_SELF', '')) === $filename) {
|
||||
$baseUrl = $this->server->get('PHP_SELF');
|
||||
} elseif (basename($this->server->get('ORIG_SCRIPT_NAME')) === $filename) {
|
||||
} elseif (basename($this->server->get('ORIG_SCRIPT_NAME', '')) === $filename) {
|
||||
$baseUrl = $this->server->get('ORIG_SCRIPT_NAME'); // 1and1 shared hosting compatibility
|
||||
} else {
|
||||
// Backtrack up the script_filename to find the portion matching
|
||||
@@ -1894,16 +1895,10 @@ class Request
|
||||
$truncatedRequestUri = substr($requestUri, 0, $pos);
|
||||
}
|
||||
|
||||
$basename = basename($baseUrl);
|
||||
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri).'/', '/'.$basename.'/')) {
|
||||
// strip autoindex filename, for virtualhost based on URL path
|
||||
$baseUrl = \dirname($baseUrl).'/';
|
||||
|
||||
$basename = basename($baseUrl);
|
||||
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri).'/', '/'.$basename.'/')) {
|
||||
// no match whatsoever; set it blank
|
||||
return '';
|
||||
}
|
||||
$basename = basename($baseUrl ?? '');
|
||||
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) {
|
||||
// no match whatsoever; set it blank
|
||||
return '';
|
||||
}
|
||||
|
||||
// If using mod_rewrite or ISAPI_Rewrite strip the script filename
|
||||
@@ -2000,7 +1995,7 @@ class Request
|
||||
// setting the default locale, the intl module is not installed, and
|
||||
// the call can be ignored:
|
||||
try {
|
||||
if (class_exists('Locale', false)) {
|
||||
if (class_exists(\Locale::class, false)) {
|
||||
\Locale::setDefault($locale);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -2051,7 +2046,7 @@ class Request
|
||||
*/
|
||||
public function isFromTrustedProxy()
|
||||
{
|
||||
return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies);
|
||||
return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR', ''), self::$trustedProxies);
|
||||
}
|
||||
|
||||
private function getTrustedValues(int $type, string $ip = null): array
|
||||
@@ -2059,17 +2054,17 @@ class Request
|
||||
$clientValues = [];
|
||||
$forwardedValues = [];
|
||||
|
||||
if ((self::$trustedHeaderSet & $type) && $this->headers->has(self::$trustedHeaders[$type])) {
|
||||
foreach (explode(',', $this->headers->get(self::$trustedHeaders[$type])) as $v) {
|
||||
if ((self::$trustedHeaderSet & $type) && $this->headers->has(self::TRUSTED_HEADERS[$type])) {
|
||||
foreach (explode(',', $this->headers->get(self::TRUSTED_HEADERS[$type])) as $v) {
|
||||
$clientValues[] = (self::HEADER_X_FORWARDED_PORT === $type ? '0.0.0.0:' : '').trim($v);
|
||||
}
|
||||
}
|
||||
|
||||
if ((self::$trustedHeaderSet & self::HEADER_FORWARDED) && (isset(self::$forwardedParams[$type])) && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) {
|
||||
$forwarded = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]);
|
||||
if ((self::$trustedHeaderSet & self::HEADER_FORWARDED) && (isset(self::FORWARDED_PARAMS[$type])) && $this->headers->has(self::TRUSTED_HEADERS[self::HEADER_FORWARDED])) {
|
||||
$forwarded = $this->headers->get(self::TRUSTED_HEADERS[self::HEADER_FORWARDED]);
|
||||
$parts = HeaderUtils::split($forwarded, ',;=');
|
||||
$forwardedValues = [];
|
||||
$param = self::$forwardedParams[$type];
|
||||
$param = self::FORWARDED_PARAMS[$type];
|
||||
foreach ($parts as $subParts) {
|
||||
if (null === $v = HeaderUtils::combine($subParts)[$param] ?? null) {
|
||||
continue;
|
||||
@@ -2102,7 +2097,7 @@ class Request
|
||||
}
|
||||
$this->isForwardedValid = false;
|
||||
|
||||
throw new ConflictingHeadersException(sprintf('The request has both a trusted "%s" header and a trusted "%s" header, conflicting with each other. You should either configure your proxy to remove one of them, or configure your project to distrust the offending one.', self::$trustedHeaders[self::HEADER_FORWARDED], self::$trustedHeaders[$type]));
|
||||
throw new ConflictingHeadersException(sprintf('The request has both a trusted "%s" header and a trusted "%s" header, conflicting with each other. You should either configure your proxy to remove one of them, or configure your project to distrust the offending one.', self::TRUSTED_HEADERS[self::HEADER_FORWARDED], self::TRUSTED_HEADERS[$type]));
|
||||
}
|
||||
|
||||
private function normalizeAndFilterClientIps(array $clientIps, string $ip): array
|
||||
|
||||
@@ -164,7 +164,11 @@ class RequestMatcher implements RequestMatcherInterface
|
||||
}
|
||||
|
||||
foreach ($this->attributes as $key => $pattern) {
|
||||
if (!preg_match('{'.$pattern.'}', $request->attributes->get($key))) {
|
||||
$requestAttribute = $request->attributes->get($key);
|
||||
if (!\is_string($requestAttribute)) {
|
||||
return false;
|
||||
}
|
||||
if (!preg_match('{'.$pattern.'}', $requestAttribute)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
6
vendor/symfony/http-foundation/Response.php
vendored
6
vendor/symfony/http-foundation/Response.php
vendored
@@ -234,7 +234,7 @@ class Response
|
||||
*/
|
||||
public static function create(?string $content = '', int $status = 200, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($content, $status, $headers);
|
||||
}
|
||||
@@ -470,7 +470,7 @@ class Response
|
||||
}
|
||||
|
||||
if (null === $text) {
|
||||
$this->statusText = isset(self::$statusTexts[$code]) ? self::$statusTexts[$code] : 'unknown status';
|
||||
$this->statusText = self::$statusTexts[$code] ?? 'unknown status';
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -1264,7 +1264,7 @@ class Response
|
||||
*/
|
||||
protected function ensureIEOverSSLCompatibility(Request $request): void
|
||||
{
|
||||
if (false !== stripos($this->headers->get('Content-Disposition'), 'attachment') && 1 == preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT'), $match) && true === $request->isSecure()) {
|
||||
if (false !== stripos($this->headers->get('Content-Disposition') ?? '', 'attachment') && 1 == preg_match('/MSIE (.*?);/i', $request->server->get('HTTP_USER_AGENT') ?? '', $match) && true === $request->isSecure()) {
|
||||
if ((int) preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) {
|
||||
$this->headers->remove('Cache-Control');
|
||||
}
|
||||
|
||||
2
vendor/symfony/http-foundation/ServerBag.php
vendored
2
vendor/symfony/http-foundation/ServerBag.php
vendored
@@ -38,7 +38,7 @@ class ServerBag extends ParameterBag
|
||||
|
||||
if (isset($this->parameters['PHP_AUTH_USER'])) {
|
||||
$headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER'];
|
||||
$headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : '';
|
||||
$headers['PHP_AUTH_PW'] = $this->parameters['PHP_AUTH_PW'] ?? '';
|
||||
} else {
|
||||
/*
|
||||
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
|
||||
|
||||
@@ -39,14 +39,14 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable
|
||||
|
||||
public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null, callable $usageReporter = null)
|
||||
{
|
||||
$this->storage = $storage ?: new NativeSessionStorage();
|
||||
$this->storage = $storage ?? new NativeSessionStorage();
|
||||
$this->usageReporter = $usageReporter;
|
||||
|
||||
$attributes = $attributes ?: new AttributeBag();
|
||||
$attributes = $attributes ?? new AttributeBag();
|
||||
$this->attributeName = $attributes->getName();
|
||||
$this->registerBag($attributes);
|
||||
|
||||
$flashes = $flashes ?: new FlashBag();
|
||||
$flashes = $flashes ?? new FlashBag();
|
||||
$this->flashName = $flashes->getName();
|
||||
$this->registerBag($flashes);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function open($savePath, $name)
|
||||
{
|
||||
@@ -36,7 +36,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
@@ -44,7 +44,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy($sessionId)
|
||||
{
|
||||
@@ -52,7 +52,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function gc($maxlifetime)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return string
|
||||
*/
|
||||
public function read($sessionId)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function write($sessionId, $data)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function validateId($sessionId)
|
||||
{
|
||||
@@ -91,7 +91,7 @@ class MarshallingSessionHandler implements \SessionHandlerInterface, \SessionUpd
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
* @return bool
|
||||
*/
|
||||
public function updateTimestamp($sessionId, $data)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ class MemcachedSessionHandler extends AbstractSessionHandler
|
||||
}
|
||||
|
||||
$this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400;
|
||||
$this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s';
|
||||
$this->prefix = $options['prefix'] ?? 'sf2s';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -185,15 +185,15 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
$this->dsn = $pdoOrDsn;
|
||||
}
|
||||
|
||||
$this->table = isset($options['db_table']) ? $options['db_table'] : $this->table;
|
||||
$this->idCol = isset($options['db_id_col']) ? $options['db_id_col'] : $this->idCol;
|
||||
$this->dataCol = isset($options['db_data_col']) ? $options['db_data_col'] : $this->dataCol;
|
||||
$this->lifetimeCol = isset($options['db_lifetime_col']) ? $options['db_lifetime_col'] : $this->lifetimeCol;
|
||||
$this->timeCol = isset($options['db_time_col']) ? $options['db_time_col'] : $this->timeCol;
|
||||
$this->username = isset($options['db_username']) ? $options['db_username'] : $this->username;
|
||||
$this->password = isset($options['db_password']) ? $options['db_password'] : $this->password;
|
||||
$this->connectionOptions = isset($options['db_connection_options']) ? $options['db_connection_options'] : $this->connectionOptions;
|
||||
$this->lockMode = isset($options['lock_mode']) ? $options['lock_mode'] : $this->lockMode;
|
||||
$this->table = $options['db_table'] ?? $this->table;
|
||||
$this->idCol = $options['db_id_col'] ?? $this->idCol;
|
||||
$this->dataCol = $options['db_data_col'] ?? $this->dataCol;
|
||||
$this->lifetimeCol = $options['db_lifetime_col'] ?? $this->lifetimeCol;
|
||||
$this->timeCol = $options['db_time_col'] ?? $this->timeCol;
|
||||
$this->username = $options['db_username'] ?? $this->username;
|
||||
$this->password = $options['db_password'] ?? $this->password;
|
||||
$this->connectionOptions = $options['db_connection_options'] ?? $this->connectionOptions;
|
||||
$this->lockMode = $options['lock_mode'] ?? $this->lockMode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,7 +479,7 @@ class PdoSessionHandler extends AbstractSessionHandler
|
||||
'sqlite3' => 'sqlite',
|
||||
];
|
||||
|
||||
$driver = isset($driverAliasMap[$params['scheme']]) ? $driverAliasMap[$params['scheme']] : $params['scheme'];
|
||||
$driver = $driverAliasMap[$params['scheme']] ?? $params['scheme'];
|
||||
|
||||
// Doctrine DBAL supports passing its internal pdo_* driver names directly too (allowing both dashes and underscores). This allows supporting the same here.
|
||||
if (0 === strpos($driver, 'pdo_') || 0 === strpos($driver, 'pdo-')) {
|
||||
|
||||
@@ -242,7 +242,7 @@ class MockArraySessionStorage implements SessionStorageInterface
|
||||
|
||||
foreach ($bags as $bag) {
|
||||
$key = $bag->getStorageKey();
|
||||
$this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : [];
|
||||
$this->data[$key] = $this->data[$key] ?? [];
|
||||
$bag->initialize($this->data[$key]);
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,10 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
||||
|
||||
try {
|
||||
if ($data) {
|
||||
file_put_contents($this->getFilePath(), serialize($data));
|
||||
$path = $this->getFilePath();
|
||||
$tmp = $path.bin2hex(random_bytes(6));
|
||||
file_put_contents($tmp, serialize($data));
|
||||
rename($tmp, $path);
|
||||
} else {
|
||||
$this->destroy();
|
||||
}
|
||||
@@ -110,9 +113,8 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
// this is needed for Silex, where the session object is re-used across requests
|
||||
// in functional tests. In Symfony, the container is rebooted, so we don't have
|
||||
// this issue
|
||||
// this is needed when the session object is re-used across multiple requests
|
||||
// in functional tests.
|
||||
$this->started = false;
|
||||
}
|
||||
|
||||
@@ -122,8 +124,11 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
||||
*/
|
||||
private function destroy(): void
|
||||
{
|
||||
if (is_file($this->getFilePath())) {
|
||||
set_error_handler(static function () {});
|
||||
try {
|
||||
unlink($this->getFilePath());
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,8 +145,14 @@ class MockFileSessionStorage extends MockArraySessionStorage
|
||||
*/
|
||||
private function read(): void
|
||||
{
|
||||
$filePath = $this->getFilePath();
|
||||
$this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : [];
|
||||
set_error_handler(static function () {});
|
||||
try {
|
||||
$data = file_get_contents($this->getFilePath());
|
||||
} finally {
|
||||
restore_error_handler();
|
||||
}
|
||||
|
||||
$this->data = $data ? unserialize($data) : [];
|
||||
|
||||
$this->loadSession();
|
||||
}
|
||||
|
||||
@@ -389,6 +389,9 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||
$this->emulateSameSite = $value;
|
||||
continue;
|
||||
}
|
||||
if ('cookie_secure' === $key && 'auto' === $value) {
|
||||
continue;
|
||||
}
|
||||
ini_set('url_rewriter.tags' !== $key ? 'session.'.$key : $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class StreamedResponse extends Response
|
||||
*/
|
||||
public static function create($callback = null, int $status = 200, array $headers = [])
|
||||
{
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, \get_called_class());
|
||||
trigger_deprecation('symfony/http-foundation', '5.1', 'The "%s()" method is deprecated, use "new %s()" instead.', __METHOD__, static::class);
|
||||
|
||||
return new static($callback, $status, $headers);
|
||||
}
|
||||
|
||||
2
vendor/symfony/http-foundation/composer.json
vendored
2
vendor/symfony/http-foundation/composer.json
vendored
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "symfony/http-foundation",
|
||||
"type": "library",
|
||||
"description": "Symfony HttpFoundation Component",
|
||||
"description": "Defines an object-oriented layer for the HTTP specification",
|
||||
"keywords": [],
|
||||
"homepage": "https://symfony.com",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -36,7 +36,7 @@ final class ArgumentResolver implements ArgumentResolverInterface
|
||||
|
||||
public function __construct(ArgumentMetadataFactoryInterface $argumentMetadataFactory = null, iterable $argumentValueResolvers = [])
|
||||
{
|
||||
$this->argumentMetadataFactory = $argumentMetadataFactory ?: new ArgumentMetadataFactory();
|
||||
$this->argumentMetadataFactory = $argumentMetadataFactory ?? new ArgumentMetadataFactory();
|
||||
$this->argumentValueResolvers = $argumentValueResolvers ?: self::getDefaultArgumentValueResolvers();
|
||||
}
|
||||
|
||||
|
||||
@@ -42,15 +42,22 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null)
|
||||
{
|
||||
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
|
||||
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
|
||||
|
||||
$this->data = [
|
||||
'token' => $response->headers->get('X-Debug-Token'),
|
||||
'symfony_version' => Kernel::VERSION,
|
||||
'symfony_state' => 'unknown',
|
||||
'symfony_minor_version' => sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION),
|
||||
'symfony_lts' => 4 === Kernel::MINOR_VERSION,
|
||||
'symfony_state' => $this->determineSymfonyState(),
|
||||
'symfony_eom' => $eom->format('F Y'),
|
||||
'symfony_eol' => $eol->format('F Y'),
|
||||
'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
|
||||
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
|
||||
'php_version' => \PHP_VERSION,
|
||||
'php_architecture' => \PHP_INT_SIZE * 8,
|
||||
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
|
||||
'php_intl_locale' => class_exists(\Locale::class, false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
|
||||
'php_timezone' => date_default_timezone_get(),
|
||||
'xdebug_enabled' => \extension_loaded('xdebug'),
|
||||
'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), \FILTER_VALIDATE_BOOLEAN),
|
||||
@@ -63,14 +70,6 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
foreach ($this->kernel->getBundles() as $name => $bundle) {
|
||||
$this->data['bundles'][$name] = new ClassStub(\get_class($bundle));
|
||||
}
|
||||
|
||||
$this->data['symfony_state'] = $this->determineSymfonyState();
|
||||
$this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION);
|
||||
$this->data['symfony_lts'] = 4 === Kernel::MINOR_VERSION;
|
||||
$eom = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_MAINTENANCE);
|
||||
$eol = \DateTime::createFromFormat('d/m/Y', '01/'.Kernel::END_OF_LIFE);
|
||||
$this->data['symfony_eom'] = $eom->format('F Y');
|
||||
$this->data['symfony_eol'] = $eol->format('F Y');
|
||||
}
|
||||
|
||||
if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
|
||||
@@ -180,7 +179,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
*/
|
||||
public function getPhpVersionExtra()
|
||||
{
|
||||
return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null;
|
||||
return $this->data['php_version_extra'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,7 +219,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
/**
|
||||
* Returns true if the debug is enabled.
|
||||
*
|
||||
* @return bool true if debug is enabled, false otherwise
|
||||
* @return bool|string true if debug is enabled, false otherwise or a string if no kernel was set
|
||||
*/
|
||||
public function isDebug()
|
||||
{
|
||||
|
||||
@@ -178,8 +178,13 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
$charset = array_pop($this->data);
|
||||
$fileLinkFormat = array_pop($this->data);
|
||||
$this->dataCount = \count($this->data);
|
||||
foreach ($this->data as $dump) {
|
||||
if (!\is_string($dump['name']) || !\is_string($dump['file']) || !\is_int($dump['line'])) {
|
||||
throw new \BadMethodCallException('Cannot unserialize '.__CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
self::__construct($this->stopwatch, $fileLinkFormat, $charset);
|
||||
self::__construct($this->stopwatch, \is_string($fileLinkFormat) || $fileLinkFormat instanceof FileLinkFormatter ? $fileLinkFormat : null, \is_string($charset) ? $charset : null);
|
||||
}
|
||||
|
||||
public function getDumpsCount(): int
|
||||
@@ -189,7 +194,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
|
||||
public function getDumps($format, $maxDepthLimit = -1, $maxItemsPerDepth = -1): array
|
||||
{
|
||||
$data = fopen('php://memory', 'r+b');
|
||||
$data = fopen('php://memory', 'r+');
|
||||
|
||||
if ('html' === $format) {
|
||||
$dumper = new HtmlDumper($data, $this->charset);
|
||||
@@ -252,7 +257,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
||||
}
|
||||
}
|
||||
|
||||
private function doDump(DataDumperInterface $dumper, $data, string $name, string $file, int $line)
|
||||
private function doDump(DataDumperInterface $dumper, Data $data, string $name, string $file, int $line)
|
||||
{
|
||||
if ($dumper instanceof CliDumper) {
|
||||
$contextDumper = function ($name, $file, $line, $fmt) {
|
||||
|
||||
@@ -79,32 +79,32 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
|
||||
|
||||
public function getLogs()
|
||||
{
|
||||
return isset($this->data['logs']) ? $this->data['logs'] : [];
|
||||
return $this->data['logs'] ?? [];
|
||||
}
|
||||
|
||||
public function getPriorities()
|
||||
{
|
||||
return isset($this->data['priorities']) ? $this->data['priorities'] : [];
|
||||
return $this->data['priorities'] ?? [];
|
||||
}
|
||||
|
||||
public function countErrors()
|
||||
{
|
||||
return isset($this->data['error_count']) ? $this->data['error_count'] : 0;
|
||||
return $this->data['error_count'] ?? 0;
|
||||
}
|
||||
|
||||
public function countDeprecations()
|
||||
{
|
||||
return isset($this->data['deprecation_count']) ? $this->data['deprecation_count'] : 0;
|
||||
return $this->data['deprecation_count'] ?? 0;
|
||||
}
|
||||
|
||||
public function countWarnings()
|
||||
{
|
||||
return isset($this->data['warning_count']) ? $this->data['warning_count'] : 0;
|
||||
return $this->data['warning_count'] ?? 0;
|
||||
}
|
||||
|
||||
public function countScreams()
|
||||
{
|
||||
return isset($this->data['scream_count']) ? $this->data['scream_count'] : 0;
|
||||
return $this->data['scream_count'] ?? 0;
|
||||
}
|
||||
|
||||
public function getCompilerLogs()
|
||||
|
||||
@@ -91,7 +91,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
'method' => $request->getMethod(),
|
||||
'format' => $request->getRequestFormat(),
|
||||
'content_type' => $response->headers->get('Content-Type', 'text/html'),
|
||||
'status_text' => isset(Response::$statusTexts[$statusCode]) ? Response::$statusTexts[$statusCode] : '',
|
||||
'status_text' => Response::$statusTexts[$statusCode] ?? '',
|
||||
'status_code' => $statusCode,
|
||||
'request_query' => $request->query->all(),
|
||||
'request_request' => $request->request->all(),
|
||||
@@ -359,12 +359,12 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
*/
|
||||
public function getRedirect()
|
||||
{
|
||||
return isset($this->data['redirect']) ? $this->data['redirect'] : false;
|
||||
return $this->data['redirect'] ?? false;
|
||||
}
|
||||
|
||||
public function getForwardToken()
|
||||
{
|
||||
return isset($this->data['forward_token']) ? $this->data['forward_token'] : null;
|
||||
return $this->data['forward_token'] ?? null;
|
||||
}
|
||||
|
||||
public function onKernelController(ControllerEvent $event)
|
||||
|
||||
@@ -56,14 +56,13 @@ abstract class AbstractSessionListener implements EventSubscriberInterface
|
||||
return;
|
||||
}
|
||||
|
||||
$session = null;
|
||||
$request = $event->getRequest();
|
||||
if (!$request->hasSession()) {
|
||||
$sess = null;
|
||||
$request->setSessionFactory(function () use (&$sess) { return $sess ?? $sess = $this->getSession(); });
|
||||
}
|
||||
|
||||
$session = $session ?? ($this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null);
|
||||
$session = $this->container && $this->container->has('initialized_session') ? $this->container->get('initialized_session') : null;
|
||||
$this->sessionUsageStack[] = $session instanceof Session ? $session->getUsageIndex() : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
|
||||
*/
|
||||
class DebugHandlersListener implements EventSubscriberInterface
|
||||
{
|
||||
private $earlyHandler;
|
||||
private $exceptionHandler;
|
||||
private $logger;
|
||||
private $deprecationLogger;
|
||||
@@ -51,6 +52,10 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
*/
|
||||
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
|
||||
{
|
||||
$handler = set_exception_handler('var_dump');
|
||||
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
|
||||
restore_exception_handler();
|
||||
|
||||
$this->exceptionHandler = $exceptionHandler;
|
||||
$this->logger = $logger;
|
||||
$this->levels = null === $levels ? \E_ALL : $levels;
|
||||
@@ -78,6 +83,10 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||
$handler = \is_array($handler) ? $handler[0] : null;
|
||||
restore_exception_handler();
|
||||
|
||||
if (!$handler instanceof ErrorHandler) {
|
||||
$handler = $this->earlyHandler;
|
||||
}
|
||||
|
||||
if ($handler instanceof ErrorHandler) {
|
||||
if ($this->logger || $this->deprecationLogger) {
|
||||
$this->setDefaultLoggers($handler);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user