PHP 8 Compatibility
This commit is contained in:
28
vendor/christian-riesen/base32/README.md
vendored
28
vendor/christian-riesen/base32/README.md
vendored
@@ -3,14 +3,19 @@ base32
|
||||
|
||||
Base32 Encoder/Decoder for PHP according to [RFC 4648](https://tools.ietf.org/html/rfc4648).
|
||||
|
||||
[](http://travis-ci.org/ChristianRiesen/base32)
|
||||
[](http://hhvm.h4cc.de/package/christian-riesen/base32)
|
||||

|
||||
|
||||
[](https://packagist.org/packages/christian-riesen/base32) [](https://packagist.org/packages/christian-riesen/base32) [](https://packagist.org/packages/christian-riesen/base32) [](https://packagist.org/packages/christian-riesen/base32)
|
||||
|
||||
Do you like this? Flattr it:
|
||||
|
||||
[](http://flattr.com/thing/720563/ChristianRiesenbase32-on-GitHub)
|
||||
Installation
|
||||
-----
|
||||
|
||||
Use composer:
|
||||
|
||||
```bash
|
||||
composer require christian-riesen/base32
|
||||
```
|
||||
|
||||
Usage
|
||||
-----
|
||||
@@ -23,20 +28,19 @@ use Base32\Base32;
|
||||
|
||||
$string = 'fooba';
|
||||
|
||||
$encoded = Base32::encode($string);
|
||||
// $encoded contains now 'MZXW6YTB'
|
||||
$encoded = Base32::encode($string);
|
||||
|
||||
$decoded = Base32::decode($encoded);
|
||||
// $decoded is again 'fooba'
|
||||
$decoded = Base32::decode($encoded);
|
||||
```
|
||||
|
||||
You can also use the extended hex alphabet by using the `Base32Hex` class instead.
|
||||
|
||||
About
|
||||
=====
|
||||
|
||||
Use
|
||||
---
|
||||
|
||||
Initially created to work with the [one time password project](https://github.com/ChristianRiesen/otp), yet it can stand alone just as well as [Jordi Boggiano](http://seld.be/) kindly pointed out. It's the only Base32 implementation I could make work that passes the test vectors (and contains unit tests).
|
||||
Initially created to work with the [one time password project](https://github.com/ChristianRiesen/otp), yet it can stand alone just as well as [Jordi Boggiano](http://seld.be/) kindly pointed out. It's the only Base32 implementation that passes the test vectors and contains unit tests as well.
|
||||
|
||||
Goal
|
||||
----
|
||||
@@ -45,9 +49,9 @@ Have a RFC compliant Base32 encoder and decoder. The implementation could be imp
|
||||
Requirements
|
||||
------------
|
||||
|
||||
PHP 5.3 to 5.6 or 7.0+
|
||||
Works on PHP 7.2 and later, including PHP 8.0.
|
||||
|
||||
If you want to run the tests, PHPUnit 5.0+ or up is required. Tests require PHP 5.6 or 7.0+.
|
||||
Tests run on PHPUnit 9.5, with PHP 7.3 and later. For PHP 7.2, tests use an older PHPUnit version.
|
||||
|
||||
Author
|
||||
------
|
||||
|
||||
194
vendor/christian-riesen/base32/src/Base32.php
vendored
194
vendor/christian-riesen/base32/src/Base32.php
vendored
@@ -1,146 +1,168 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Base32;
|
||||
|
||||
/**
|
||||
* Base32 encoder and decoder
|
||||
*
|
||||
* Last update: 2012-06-20
|
||||
* Base32 encoder and decoder.
|
||||
*
|
||||
* RFC 4648 compliant
|
||||
* @link http://www.ietf.org/rfc/rfc4648.txt
|
||||
*
|
||||
* @see http://www.ietf.org/rfc/rfc4648.txt
|
||||
* Some groundwork based on this class
|
||||
* https://github.com/NTICompass/PHP-Base32
|
||||
*
|
||||
* @author Christian Riesen <chris.riesen@gmail.com>
|
||||
* @link http://christianriesen.com
|
||||
* @author Christian Riesen <chris.riesen@gmail.com>
|
||||
* @author Sam Williams <sam@badcow.co>
|
||||
*
|
||||
* @see http://christianriesen.com
|
||||
*
|
||||
* @license MIT License see LICENSE file
|
||||
*/
|
||||
class Base32
|
||||
{
|
||||
/**
|
||||
* Alphabet for encoding and decoding base32
|
||||
* Alphabet for encoding and decoding base32.
|
||||
*
|
||||
* @var array
|
||||
* @var string
|
||||
*/
|
||||
private static $alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=';
|
||||
protected const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=';
|
||||
|
||||
protected const BASE32HEX_PATTERN = '/[^A-Z2-7]/';
|
||||
|
||||
/**
|
||||
* Creates an array from a binary string into a given chunk size
|
||||
*
|
||||
* @param string $binaryString String to chunk
|
||||
* @param integer $bits Number of bits per chunk
|
||||
* @return array
|
||||
* Maps the Base32 character to its corresponding bit value.
|
||||
*/
|
||||
private static function chunk($binaryString, $bits)
|
||||
{
|
||||
$binaryString = chunk_split($binaryString, $bits, ' ');
|
||||
|
||||
if (substr($binaryString, (strlen($binaryString)) - 1) == ' ') {
|
||||
$binaryString = substr($binaryString, 0, strlen($binaryString)-1);
|
||||
}
|
||||
|
||||
return explode(' ', $binaryString);
|
||||
}
|
||||
protected const MAPPING = [
|
||||
'=' => 0b00000,
|
||||
'A' => 0b00000,
|
||||
'B' => 0b00001,
|
||||
'C' => 0b00010,
|
||||
'D' => 0b00011,
|
||||
'E' => 0b00100,
|
||||
'F' => 0b00101,
|
||||
'G' => 0b00110,
|
||||
'H' => 0b00111,
|
||||
'I' => 0b01000,
|
||||
'J' => 0b01001,
|
||||
'K' => 0b01010,
|
||||
'L' => 0b01011,
|
||||
'M' => 0b01100,
|
||||
'N' => 0b01101,
|
||||
'O' => 0b01110,
|
||||
'P' => 0b01111,
|
||||
'Q' => 0b10000,
|
||||
'R' => 0b10001,
|
||||
'S' => 0b10010,
|
||||
'T' => 0b10011,
|
||||
'U' => 0b10100,
|
||||
'V' => 0b10101,
|
||||
'W' => 0b10110,
|
||||
'X' => 0b10111,
|
||||
'Y' => 0b11000,
|
||||
'Z' => 0b11001,
|
||||
'2' => 0b11010,
|
||||
'3' => 0b11011,
|
||||
'4' => 0b11100,
|
||||
'5' => 0b11101,
|
||||
'6' => 0b11110,
|
||||
'7' => 0b11111,
|
||||
];
|
||||
|
||||
/**
|
||||
* Encodes into base32
|
||||
* Encodes into base32.
|
||||
*
|
||||
* @param string $string Clear text string
|
||||
*
|
||||
* @return string Base32 encoded string
|
||||
*/
|
||||
public static function encode($string)
|
||||
public static function encode(string $string): string
|
||||
{
|
||||
if (strlen($string) == 0) {
|
||||
// Gives an empty string
|
||||
|
||||
// Empty string results in empty string
|
||||
if ('' === $string) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Convert string to binary
|
||||
$binaryString = '';
|
||||
$encoded = '';
|
||||
|
||||
foreach (str_split($string) as $s) {
|
||||
// Return each character as an 8-bit binary string
|
||||
$binaryString .= sprintf('%08b', ord($s));
|
||||
}
|
||||
//Set the initial values
|
||||
$n = $bitLen = $val = 0;
|
||||
$len = \strlen($string);
|
||||
|
||||
// Break into 5-bit chunks, then break that into an array
|
||||
$binaryArray = self::chunk($binaryString, 5);
|
||||
//Pad the end of the string - this ensures that there are enough zeros
|
||||
$string .= \str_repeat(\chr(0), 4);
|
||||
|
||||
// Pad array to be divisible by 8
|
||||
while (count($binaryArray) % 8 !== 0) {
|
||||
$binaryArray[] = null;
|
||||
}
|
||||
//Explode string into integers
|
||||
$chars = (array) \unpack('C*', $string, 0);
|
||||
|
||||
$base32String = '';
|
||||
|
||||
// Encode in base32
|
||||
foreach ($binaryArray as $bin) {
|
||||
$char = 32;
|
||||
|
||||
if (!is_null($bin)) {
|
||||
// Pad the binary strings
|
||||
$bin = str_pad($bin, 5, 0, STR_PAD_RIGHT);
|
||||
$char = bindec($bin);
|
||||
while ($n < $len || 0 !== $bitLen) {
|
||||
//If the bit length has fallen below 5, shift left 8 and add the next character.
|
||||
if ($bitLen < 5) {
|
||||
$val = $val << 8;
|
||||
$bitLen += 8;
|
||||
$n++;
|
||||
$val += $chars[$n];
|
||||
}
|
||||
|
||||
// Base32 character
|
||||
$base32String .= self::$alphabet[$char];
|
||||
$shift = $bitLen - 5;
|
||||
$encoded .= ($n - (int)($bitLen > 8) > $len && 0 == $val) ? '=' : static::ALPHABET[$val >> $shift];
|
||||
$val = $val & ((1 << $shift) - 1);
|
||||
$bitLen -= 5;
|
||||
}
|
||||
|
||||
return $base32String;
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes base32
|
||||
* Decodes base32.
|
||||
*
|
||||
* @param string $base32String Base32 encoded string
|
||||
*
|
||||
* @return string Clear text string
|
||||
*/
|
||||
public static function decode($base32String)
|
||||
public static function decode(string $base32String): string
|
||||
{
|
||||
// Only work in upper cases
|
||||
$base32String = strtoupper($base32String);
|
||||
$base32String = \strtoupper($base32String);
|
||||
|
||||
// Remove anything that is not base32 alphabet
|
||||
$pattern = '/[^A-Z2-7]/';
|
||||
$base32String = \preg_replace(static::BASE32HEX_PATTERN, '', $base32String);
|
||||
|
||||
$base32String = preg_replace($pattern, '', $base32String);
|
||||
|
||||
if (strlen($base32String) == 0) {
|
||||
// Gives an empty string
|
||||
// Empty string results in empty string
|
||||
if ('' === $base32String || null === $base32String) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$base32Array = str_split($base32String);
|
||||
$decoded = '';
|
||||
|
||||
$string = '';
|
||||
//Set the initial values
|
||||
$len = \strlen($base32String);
|
||||
$n = 0;
|
||||
$bitLen = 5;
|
||||
$val = static::MAPPING[$base32String[0]];
|
||||
|
||||
foreach ($base32Array as $str) {
|
||||
$char = strpos(self::$alphabet, $str);
|
||||
while ($n < $len) {
|
||||
//If the bit length has fallen below 8, shift left 5 and add the next pentet.
|
||||
if ($bitLen < 8) {
|
||||
$val = $val << 5;
|
||||
$bitLen += 5;
|
||||
$n++;
|
||||
$pentet = $base32String[$n] ?? '=';
|
||||
|
||||
// Ignore the padding character
|
||||
if ($char !== 32) {
|
||||
$string .= sprintf('%05b', $char);
|
||||
//If the new pentet is padding, make this the last iteration.
|
||||
if ('=' === $pentet) {
|
||||
$n = $len;
|
||||
}
|
||||
$val += static::MAPPING[$pentet];
|
||||
continue;
|
||||
}
|
||||
$shift = $bitLen - 8;
|
||||
|
||||
$decoded .= \chr($val >> $shift);
|
||||
$val = $val & ((1 << $shift) - 1);
|
||||
$bitLen -= 8;
|
||||
}
|
||||
|
||||
while (strlen($string) %8 !== 0) {
|
||||
$string = substr($string, 0, strlen($string)-1);
|
||||
}
|
||||
|
||||
$binaryArray = self::chunk($string, 8);
|
||||
|
||||
$realString = '';
|
||||
|
||||
foreach ($binaryArray as $bin) {
|
||||
// Pad each value to 8 bits
|
||||
$bin = str_pad($bin, 8, 0, STR_PAD_RIGHT);
|
||||
// Convert binary strings to ASCII
|
||||
$realString .= chr(bindec($bin));
|
||||
}
|
||||
|
||||
return $realString;
|
||||
return $decoded;
|
||||
}
|
||||
}
|
||||
|
||||
68
vendor/christian-riesen/base32/src/Base32Hex.php
vendored
Normal file
68
vendor/christian-riesen/base32/src/Base32Hex.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Base32;
|
||||
|
||||
/**
|
||||
* Base32Hex encoder and decoder.
|
||||
*
|
||||
* RFC 4648 compliant
|
||||
* @see http://www.ietf.org/rfc/rfc4648.txt
|
||||
*
|
||||
* @author Sam Williams <sam@badcow.co>
|
||||
*
|
||||
* @see http://christianriesen.com
|
||||
*
|
||||
* @license MIT License see LICENSE file
|
||||
*/
|
||||
class Base32Hex extends Base32
|
||||
{
|
||||
/**
|
||||
* Alphabet for encoding and decoding base32 extended hex.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected const ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUV=';
|
||||
|
||||
protected const BASE32HEX_PATTERN = '/[^0-9A-V]/';
|
||||
|
||||
/**
|
||||
* Maps the Base32 character to its corresponding bit value.
|
||||
*/
|
||||
protected const MAPPING = [
|
||||
'=' => 0b00000,
|
||||
'0' => 0b00000,
|
||||
'1' => 0b00001,
|
||||
'2' => 0b00010,
|
||||
'3' => 0b00011,
|
||||
'4' => 0b00100,
|
||||
'5' => 0b00101,
|
||||
'6' => 0b00110,
|
||||
'7' => 0b00111,
|
||||
'8' => 0b01000,
|
||||
'9' => 0b01001,
|
||||
'A' => 0b01010,
|
||||
'B' => 0b01011,
|
||||
'C' => 0b01100,
|
||||
'D' => 0b01101,
|
||||
'E' => 0b01110,
|
||||
'F' => 0b01111,
|
||||
'G' => 0b10000,
|
||||
'H' => 0b10001,
|
||||
'I' => 0b10010,
|
||||
'J' => 0b10011,
|
||||
'K' => 0b10100,
|
||||
'L' => 0b10101,
|
||||
'M' => 0b10110,
|
||||
'N' => 0b10111,
|
||||
'O' => 0b11000,
|
||||
'P' => 0b11001,
|
||||
'Q' => 0b11010,
|
||||
'R' => 0b11011,
|
||||
'S' => 0b11100,
|
||||
'T' => 0b11101,
|
||||
'U' => 0b11110,
|
||||
'V' => 0b11111,
|
||||
];
|
||||
}
|
||||
59
vendor/composer/autoload_classmap.php
vendored
59
vendor/composer/autoload_classmap.php
vendored
@@ -6,7 +6,9 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'Base32\\Base32' => $vendorDir . '/christian-riesen/base32/src/Base32.php',
|
||||
'Base32\\Base32Hex' => $vendorDir . '/christian-riesen/base32/src/Base32Hex.php',
|
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||
'Eluceo\\iCal\\Component' => $vendorDir . '/eluceo/ical/src/Component.php',
|
||||
'Eluceo\\iCal\\Component\\Alarm' => $vendorDir . '/eluceo/ical/src/Component/Alarm.php',
|
||||
@@ -36,6 +38,7 @@ return array(
|
||||
'Gregwar\\Captcha\\ImageFileHandler' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/ImageFileHandler.php',
|
||||
'Gregwar\\Captcha\\PhraseBuilder' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php',
|
||||
'Gregwar\\Captcha\\PhraseBuilderInterface' => $vendorDir . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php',
|
||||
'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
|
||||
'JsonRPC\\Client' => $baseDir . '/libs/jsonrpc/src/JsonRPC/Client.php',
|
||||
'JsonRPC\\Exception\\AccessDeniedException' => $baseDir . '/libs/jsonrpc/src/JsonRPC/Exception/AccessDeniedException.php',
|
||||
'JsonRPC\\Exception\\AuthenticationFailureException' => $baseDir . '/libs/jsonrpc/src/JsonRPC/Exception/AuthenticationFailureException.php',
|
||||
@@ -82,6 +85,7 @@ return array(
|
||||
'Kanboard\\Action\\TaskAssignCurrentUser' => $baseDir . '/app/Action/TaskAssignCurrentUser.php',
|
||||
'Kanboard\\Action\\TaskAssignCurrentUserColumn' => $baseDir . '/app/Action/TaskAssignCurrentUserColumn.php',
|
||||
'Kanboard\\Action\\TaskAssignDueDateOnCreation' => $baseDir . '/app/Action/TaskAssignDueDateOnCreation.php',
|
||||
'Kanboard\\Action\\TaskAssignDueDateOnMoveColumn' => $baseDir . '/app/Action/TaskAssignDueDateOnMoveColumn.php',
|
||||
'Kanboard\\Action\\TaskAssignPrioritySwimlane' => $baseDir . '/app/Action/TaskAssignPrioritySwimlane.php',
|
||||
'Kanboard\\Action\\TaskAssignSpecificUser' => $baseDir . '/app/Action/TaskAssignSpecificUser.php',
|
||||
'Kanboard\\Action\\TaskAssignUser' => $baseDir . '/app/Action/TaskAssignUser.php',
|
||||
@@ -802,6 +806,7 @@ return array(
|
||||
'SimpleValidator\\Validators\\Range' => $baseDir . '/libs/SimpleValidator/Validators/Range.php',
|
||||
'SimpleValidator\\Validators\\Required' => $baseDir . '/libs/SimpleValidator/Validators/Required.php',
|
||||
'SimpleValidator\\Validators\\Unique' => $baseDir . '/libs/SimpleValidator/Validators/Unique.php',
|
||||
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
|
||||
@@ -829,6 +834,7 @@ return array(
|
||||
'Symfony\\Component\\Console\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/console/Exception/InvalidArgumentException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\InvalidOptionException' => $vendorDir . '/symfony/console/Exception/InvalidOptionException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\LogicException' => $vendorDir . '/symfony/console/Exception/LogicException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\MissingInputException' => $vendorDir . '/symfony/console/Exception/MissingInputException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException' => $vendorDir . '/symfony/console/Exception/NamespaceNotFoundException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\RuntimeException' => $vendorDir . '/symfony/console/Exception/RuntimeException.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => $vendorDir . '/symfony/console/Formatter/OutputFormatter.php',
|
||||
@@ -839,6 +845,7 @@ return array(
|
||||
'Symfony\\Component\\Console\\Formatter\\WrappableOutputFormatterInterface' => $vendorDir . '/symfony/console/Formatter/WrappableOutputFormatterInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => $vendorDir . '/symfony/console/Helper/DebugFormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Helper/DescriptorHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Dumper' => $vendorDir . '/symfony/console/Helper/Dumper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Helper/FormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Helper' => $vendorDir . '/symfony/console/Helper/Helper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Helper/HelperInterface.php',
|
||||
@@ -873,6 +880,7 @@ return array(
|
||||
'Symfony\\Component\\Console\\Output\\Output' => $vendorDir . '/symfony/console/Output/Output.php',
|
||||
'Symfony\\Component\\Console\\Output\\OutputInterface' => $vendorDir . '/symfony/console/Output/OutputInterface.php',
|
||||
'Symfony\\Component\\Console\\Output\\StreamOutput' => $vendorDir . '/symfony/console/Output/StreamOutput.php',
|
||||
'Symfony\\Component\\Console\\Output\\TrimmedBufferOutput' => $vendorDir . '/symfony/console/Output/TrimmedBufferOutput.php',
|
||||
'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Question/ChoiceQuestion.php',
|
||||
'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Question/ConfirmationQuestion.php',
|
||||
'Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Question/Question.php',
|
||||
@@ -883,10 +891,10 @@ return array(
|
||||
'Symfony\\Component\\Console\\Tester\\ApplicationTester' => $vendorDir . '/symfony/console/Tester/ApplicationTester.php',
|
||||
'Symfony\\Component\\Console\\Tester\\CommandTester' => $vendorDir . '/symfony/console/Tester/CommandTester.php',
|
||||
'Symfony\\Component\\Console\\Tester\\TesterTrait' => $vendorDir . '/symfony/console/Tester/TesterTrait.php',
|
||||
'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ContainerAwareEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => $vendorDir . '/symfony/event-dispatcher/Debug/WrappedListener.php',
|
||||
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\AddEventAliasesPass' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php',
|
||||
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher/Event.php',
|
||||
'Symfony\\Component\\EventDispatcher\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/EventDispatcher.php',
|
||||
@@ -894,6 +902,8 @@ return array(
|
||||
'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => $vendorDir . '/symfony/event-dispatcher/EventSubscriberInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\GenericEvent' => $vendorDir . '/symfony/event-dispatcher/GenericEvent.php',
|
||||
'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ImmutableEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy' => $vendorDir . '/symfony/event-dispatcher/LegacyEventDispatcherProxy.php',
|
||||
'Symfony\\Component\\EventDispatcher\\LegacyEventProxy' => $vendorDir . '/symfony/event-dispatcher/LegacyEventProxy.php',
|
||||
'Symfony\\Component\\Finder\\Comparator\\Comparator' => $vendorDir . '/symfony/finder/Comparator/Comparator.php',
|
||||
'Symfony\\Component\\Finder\\Comparator\\DateComparator' => $vendorDir . '/symfony/finder/Comparator/DateComparator.php',
|
||||
'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => $vendorDir . '/symfony/finder/Comparator/NumberComparator.php',
|
||||
@@ -909,42 +919,27 @@ return array(
|
||||
'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FileTypeFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilecontentFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilenameFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\LazyIterator' => $vendorDir . '/symfony/finder/Iterator/LazyIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => $vendorDir . '/symfony/finder/Iterator/MultiplePcreFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => $vendorDir . '/symfony/finder/Iterator/PathFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => $vendorDir . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/SizeRangeFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => $vendorDir . '/symfony/finder/Iterator/SortableIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\VcsIgnoredFilterIterator' => $vendorDir . '/symfony/finder/Iterator/VcsIgnoredFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\SplFileInfo' => $vendorDir . '/symfony/finder/SplFileInfo.php',
|
||||
'Symfony\\Contracts\\Cache\\CacheInterface' => $vendorDir . '/symfony/contracts/Cache/CacheInterface.php',
|
||||
'Symfony\\Contracts\\Cache\\CacheTrait' => $vendorDir . '/symfony/contracts/Cache/CacheTrait.php',
|
||||
'Symfony\\Contracts\\Cache\\CallbackInterface' => $vendorDir . '/symfony/contracts/Cache/CallbackInterface.php',
|
||||
'Symfony\\Contracts\\Cache\\ItemInterface' => $vendorDir . '/symfony/contracts/Cache/ItemInterface.php',
|
||||
'Symfony\\Contracts\\Cache\\TagAwareCacheInterface' => $vendorDir . '/symfony/contracts/Cache/TagAwareCacheInterface.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\Event' => $vendorDir . '/symfony/contracts/EventDispatcher/Event.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface' => $vendorDir . '/symfony/contracts/EventDispatcher/EventDispatcherInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\ChunkInterface' => $vendorDir . '/symfony/contracts/HttpClient/ChunkInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\ClientExceptionInterface' => $vendorDir . '/symfony/contracts/HttpClient/Exception/ClientExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/contracts/HttpClient/Exception/ExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\HttpExceptionInterface' => $vendorDir . '/symfony/contracts/HttpClient/Exception/HttpExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\RedirectionExceptionInterface' => $vendorDir . '/symfony/contracts/HttpClient/Exception/RedirectionExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\ServerExceptionInterface' => $vendorDir . '/symfony/contracts/HttpClient/Exception/ServerExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\TransportExceptionInterface' => $vendorDir . '/symfony/contracts/HttpClient/Exception/TransportExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\HttpClientInterface' => $vendorDir . '/symfony/contracts/HttpClient/HttpClientInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\ResponseInterface' => $vendorDir . '/symfony/contracts/HttpClient/ResponseInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\ResponseStreamInterface' => $vendorDir . '/symfony/contracts/HttpClient/ResponseStreamInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Test\\HttpClientTestCase' => $vendorDir . '/symfony/contracts/HttpClient/Test/HttpClientTestCase.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Test\\TestHttpServer' => $vendorDir . '/symfony/contracts/HttpClient/Test/TestHttpServer.php',
|
||||
'Symfony\\Contracts\\Service\\ResetInterface' => $vendorDir . '/symfony/contracts/Service/ResetInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => $vendorDir . '/symfony/contracts/Service/ServiceLocatorTrait.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceProviderInterface' => $vendorDir . '/symfony/contracts/Service/ServiceProviderInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/contracts/Service/ServiceSubscriberInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/contracts/Service/ServiceSubscriberTrait.php',
|
||||
'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => $vendorDir . '/symfony/contracts/Service/Test/ServiceLocatorTest.php',
|
||||
'Symfony\\Contracts\\Tests\\Cache\\CacheTraitTest' => $vendorDir . '/symfony/contracts/Tests/Cache/CacheTraitTest.php',
|
||||
'Symfony\\Contracts\\Tests\\Service\\ServiceSubscriberTraitTest' => $vendorDir . '/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php',
|
||||
'Symfony\\Contracts\\Translation\\LocaleAwareInterface' => $vendorDir . '/symfony/contracts/Translation/LocaleAwareInterface.php',
|
||||
'Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => $vendorDir . '/symfony/contracts/Translation/Test/TranslatorTest.php',
|
||||
'Symfony\\Contracts\\Translation\\TranslatorInterface' => $vendorDir . '/symfony/contracts/Translation/TranslatorInterface.php',
|
||||
'Symfony\\Contracts\\Translation\\TranslatorTrait' => $vendorDir . '/symfony/contracts/Translation/TranslatorTrait.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher-contracts/Event.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher-contracts/EventDispatcherInterface.php',
|
||||
'Symfony\\Contracts\\Service\\Attribute\\Required' => $vendorDir . '/symfony/service-contracts/Attribute/Required.php',
|
||||
'Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => $vendorDir . '/symfony/service-contracts/Attribute/SubscribedService.php',
|
||||
'Symfony\\Contracts\\Service\\ResetInterface' => $vendorDir . '/symfony/service-contracts/ResetInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => $vendorDir . '/symfony/service-contracts/ServiceLocatorTrait.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceProviderInterface' => $vendorDir . '/symfony/service-contracts/ServiceProviderInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => $vendorDir . '/symfony/service-contracts/ServiceSubscriberTrait.php',
|
||||
'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => $vendorDir . '/symfony/service-contracts/Test/ServiceLocatorTest.php',
|
||||
'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php',
|
||||
'Symfony\\Polyfill\\Php73\\Php73' => $vendorDir . '/symfony/polyfill-php73/Php73.php',
|
||||
'Symfony\\Polyfill\\Php80\\Php80' => $vendorDir . '/symfony/polyfill-php80/Php80.php',
|
||||
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
||||
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
||||
);
|
||||
|
||||
3
vendor/composer/autoload_files.php
vendored
3
vendor/composer/autoload_files.php
vendored
@@ -6,7 +6,10 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
|
||||
'2c102faa651ef8ea5874edb585946bce' => $vendorDir . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
||||
'8a67f3044590529ed0a5e02f9cc9c90b' => $baseDir . '/app/functions.php',
|
||||
);
|
||||
|
||||
5
vendor/composer/autoload_psr4.php
vendored
5
vendor/composer/autoload_psr4.php
vendored
@@ -6,8 +6,11 @@ $vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
|
||||
'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
|
||||
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
|
||||
'Symfony\\Contracts\\' => array($vendorDir . '/symfony/contracts'),
|
||||
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
|
||||
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
|
||||
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
|
||||
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
|
||||
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
|
||||
|
||||
83
vendor/composer/autoload_static.php
vendored
83
vendor/composer/autoload_static.php
vendored
@@ -7,7 +7,10 @@ namespace Composer\Autoload;
|
||||
class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
{
|
||||
public static $files = array (
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
|
||||
'2c102faa651ef8ea5874edb585946bce' => __DIR__ . '/..' . '/swiftmailer/swiftmailer/lib/swift_required.php',
|
||||
'8a67f3044590529ed0a5e02f9cc9c90b' => __DIR__ . '/../..' . '/app/functions.php',
|
||||
);
|
||||
@@ -15,8 +18,11 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'S' =>
|
||||
array (
|
||||
'Symfony\\Polyfill\\Php80\\' => 23,
|
||||
'Symfony\\Polyfill\\Php73\\' => 23,
|
||||
'Symfony\\Polyfill\\Mbstring\\' => 26,
|
||||
'Symfony\\Contracts\\' => 18,
|
||||
'Symfony\\Contracts\\Service\\' => 26,
|
||||
'Symfony\\Contracts\\EventDispatcher\\' => 34,
|
||||
'Symfony\\Component\\Finder\\' => 25,
|
||||
'Symfony\\Component\\EventDispatcher\\' => 34,
|
||||
'Symfony\\Component\\Console\\' => 26,
|
||||
@@ -50,13 +56,25 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'Symfony\\Polyfill\\Php80\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
|
||||
),
|
||||
'Symfony\\Polyfill\\Php73\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
|
||||
),
|
||||
'Symfony\\Polyfill\\Mbstring\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
|
||||
),
|
||||
'Symfony\\Contracts\\' =>
|
||||
'Symfony\\Contracts\\Service\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/contracts',
|
||||
0 => __DIR__ . '/..' . '/symfony/service-contracts',
|
||||
),
|
||||
'Symfony\\Contracts\\EventDispatcher\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts',
|
||||
),
|
||||
'Symfony\\Component\\Finder\\' =>
|
||||
array (
|
||||
@@ -152,7 +170,9 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
);
|
||||
|
||||
public static $classMap = array (
|
||||
'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
|
||||
'Base32\\Base32' => __DIR__ . '/..' . '/christian-riesen/base32/src/Base32.php',
|
||||
'Base32\\Base32Hex' => __DIR__ . '/..' . '/christian-riesen/base32/src/Base32Hex.php',
|
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||
'Eluceo\\iCal\\Component' => __DIR__ . '/..' . '/eluceo/ical/src/Component.php',
|
||||
'Eluceo\\iCal\\Component\\Alarm' => __DIR__ . '/..' . '/eluceo/ical/src/Component/Alarm.php',
|
||||
@@ -182,6 +202,7 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Gregwar\\Captcha\\ImageFileHandler' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/ImageFileHandler.php',
|
||||
'Gregwar\\Captcha\\PhraseBuilder' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilder.php',
|
||||
'Gregwar\\Captcha\\PhraseBuilderInterface' => __DIR__ . '/..' . '/gregwar/captcha/src/Gregwar/Captcha/PhraseBuilderInterface.php',
|
||||
'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
|
||||
'JsonRPC\\Client' => __DIR__ . '/../..' . '/libs/jsonrpc/src/JsonRPC/Client.php',
|
||||
'JsonRPC\\Exception\\AccessDeniedException' => __DIR__ . '/../..' . '/libs/jsonrpc/src/JsonRPC/Exception/AccessDeniedException.php',
|
||||
'JsonRPC\\Exception\\AuthenticationFailureException' => __DIR__ . '/../..' . '/libs/jsonrpc/src/JsonRPC/Exception/AuthenticationFailureException.php',
|
||||
@@ -228,6 +249,7 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Kanboard\\Action\\TaskAssignCurrentUser' => __DIR__ . '/../..' . '/app/Action/TaskAssignCurrentUser.php',
|
||||
'Kanboard\\Action\\TaskAssignCurrentUserColumn' => __DIR__ . '/../..' . '/app/Action/TaskAssignCurrentUserColumn.php',
|
||||
'Kanboard\\Action\\TaskAssignDueDateOnCreation' => __DIR__ . '/../..' . '/app/Action/TaskAssignDueDateOnCreation.php',
|
||||
'Kanboard\\Action\\TaskAssignDueDateOnMoveColumn' => __DIR__ . '/../..' . '/app/Action/TaskAssignDueDateOnMoveColumn.php',
|
||||
'Kanboard\\Action\\TaskAssignPrioritySwimlane' => __DIR__ . '/../..' . '/app/Action/TaskAssignPrioritySwimlane.php',
|
||||
'Kanboard\\Action\\TaskAssignSpecificUser' => __DIR__ . '/../..' . '/app/Action/TaskAssignSpecificUser.php',
|
||||
'Kanboard\\Action\\TaskAssignUser' => __DIR__ . '/../..' . '/app/Action/TaskAssignUser.php',
|
||||
@@ -948,6 +970,7 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'SimpleValidator\\Validators\\Range' => __DIR__ . '/../..' . '/libs/SimpleValidator/Validators/Range.php',
|
||||
'SimpleValidator\\Validators\\Required' => __DIR__ . '/../..' . '/libs/SimpleValidator/Validators/Required.php',
|
||||
'SimpleValidator\\Validators\\Unique' => __DIR__ . '/../..' . '/libs/SimpleValidator/Validators/Unique.php',
|
||||
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php',
|
||||
'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php',
|
||||
@@ -975,6 +998,7 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Symfony\\Component\\Console\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/console/Exception/InvalidArgumentException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\InvalidOptionException' => __DIR__ . '/..' . '/symfony/console/Exception/InvalidOptionException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/console/Exception/LogicException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\MissingInputException' => __DIR__ . '/..' . '/symfony/console/Exception/MissingInputException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\NamespaceNotFoundException' => __DIR__ . '/..' . '/symfony/console/Exception/NamespaceNotFoundException.php',
|
||||
'Symfony\\Component\\Console\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/console/Exception/RuntimeException.php',
|
||||
'Symfony\\Component\\Console\\Formatter\\OutputFormatter' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatter.php',
|
||||
@@ -985,6 +1009,7 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Symfony\\Component\\Console\\Formatter\\WrappableOutputFormatterInterface' => __DIR__ . '/..' . '/symfony/console/Formatter/WrappableOutputFormatterInterface.php',
|
||||
'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DebugFormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DescriptorHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Dumper' => __DIR__ . '/..' . '/symfony/console/Helper/Dumper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\FormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/FormatterHelper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\Helper' => __DIR__ . '/..' . '/symfony/console/Helper/Helper.php',
|
||||
'Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/..' . '/symfony/console/Helper/HelperInterface.php',
|
||||
@@ -1019,6 +1044,7 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Symfony\\Component\\Console\\Output\\Output' => __DIR__ . '/..' . '/symfony/console/Output/Output.php',
|
||||
'Symfony\\Component\\Console\\Output\\OutputInterface' => __DIR__ . '/..' . '/symfony/console/Output/OutputInterface.php',
|
||||
'Symfony\\Component\\Console\\Output\\StreamOutput' => __DIR__ . '/..' . '/symfony/console/Output/StreamOutput.php',
|
||||
'Symfony\\Component\\Console\\Output\\TrimmedBufferOutput' => __DIR__ . '/..' . '/symfony/console/Output/TrimmedBufferOutput.php',
|
||||
'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ChoiceQuestion.php',
|
||||
'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ConfirmationQuestion.php',
|
||||
'Symfony\\Component\\Console\\Question\\Question' => __DIR__ . '/..' . '/symfony/console/Question/Question.php',
|
||||
@@ -1029,10 +1055,10 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Symfony\\Component\\Console\\Tester\\ApplicationTester' => __DIR__ . '/..' . '/symfony/console/Tester/ApplicationTester.php',
|
||||
'Symfony\\Component\\Console\\Tester\\CommandTester' => __DIR__ . '/..' . '/symfony/console/Tester/CommandTester.php',
|
||||
'Symfony\\Component\\Console\\Tester\\TesterTrait' => __DIR__ . '/..' . '/symfony/console/Tester/TesterTrait.php',
|
||||
'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ContainerAwareEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/WrappedListener.php',
|
||||
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\AddEventAliasesPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/AddEventAliasesPass.php',
|
||||
'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php',
|
||||
'Symfony\\Component\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher/Event.php',
|
||||
'Symfony\\Component\\EventDispatcher\\EventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcher.php',
|
||||
@@ -1040,6 +1066,8 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Symfony\\Component\\EventDispatcher\\EventSubscriberInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventSubscriberInterface.php',
|
||||
'Symfony\\Component\\EventDispatcher\\GenericEvent' => __DIR__ . '/..' . '/symfony/event-dispatcher/GenericEvent.php',
|
||||
'Symfony\\Component\\EventDispatcher\\ImmutableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ImmutableEventDispatcher.php',
|
||||
'Symfony\\Component\\EventDispatcher\\LegacyEventDispatcherProxy' => __DIR__ . '/..' . '/symfony/event-dispatcher/LegacyEventDispatcherProxy.php',
|
||||
'Symfony\\Component\\EventDispatcher\\LegacyEventProxy' => __DIR__ . '/..' . '/symfony/event-dispatcher/LegacyEventProxy.php',
|
||||
'Symfony\\Component\\Finder\\Comparator\\Comparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/Comparator.php',
|
||||
'Symfony\\Component\\Finder\\Comparator\\DateComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/DateComparator.php',
|
||||
'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/NumberComparator.php',
|
||||
@@ -1055,44 +1083,29 @@ class ComposerStaticInit80f59a55e693f3d5493bcaaa968d1851
|
||||
'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FileTypeFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilecontentFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilenameFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\LazyIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/LazyIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\MultiplePcreFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/MultiplePcreFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\PathFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/PathFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SizeRangeFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SortableIterator.php',
|
||||
'Symfony\\Component\\Finder\\Iterator\\VcsIgnoredFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/VcsIgnoredFilterIterator.php',
|
||||
'Symfony\\Component\\Finder\\SplFileInfo' => __DIR__ . '/..' . '/symfony/finder/SplFileInfo.php',
|
||||
'Symfony\\Contracts\\Cache\\CacheInterface' => __DIR__ . '/..' . '/symfony/contracts/Cache/CacheInterface.php',
|
||||
'Symfony\\Contracts\\Cache\\CacheTrait' => __DIR__ . '/..' . '/symfony/contracts/Cache/CacheTrait.php',
|
||||
'Symfony\\Contracts\\Cache\\CallbackInterface' => __DIR__ . '/..' . '/symfony/contracts/Cache/CallbackInterface.php',
|
||||
'Symfony\\Contracts\\Cache\\ItemInterface' => __DIR__ . '/..' . '/symfony/contracts/Cache/ItemInterface.php',
|
||||
'Symfony\\Contracts\\Cache\\TagAwareCacheInterface' => __DIR__ . '/..' . '/symfony/contracts/Cache/TagAwareCacheInterface.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/contracts/EventDispatcher/Event.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface' => __DIR__ . '/..' . '/symfony/contracts/EventDispatcher/EventDispatcherInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\ChunkInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/ChunkInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\ClientExceptionInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Exception/ClientExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Exception/ExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\HttpExceptionInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Exception/HttpExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\RedirectionExceptionInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Exception/RedirectionExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\ServerExceptionInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Exception/ServerExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Exception\\TransportExceptionInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Exception/TransportExceptionInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\HttpClientInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/HttpClientInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\ResponseInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/ResponseInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\ResponseStreamInterface' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/ResponseStreamInterface.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Test\\HttpClientTestCase' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Test/HttpClientTestCase.php',
|
||||
'Symfony\\Contracts\\HttpClient\\Test\\TestHttpServer' => __DIR__ . '/..' . '/symfony/contracts/HttpClient/Test/TestHttpServer.php',
|
||||
'Symfony\\Contracts\\Service\\ResetInterface' => __DIR__ . '/..' . '/symfony/contracts/Service/ResetInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => __DIR__ . '/..' . '/symfony/contracts/Service/ServiceLocatorTrait.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceProviderInterface' => __DIR__ . '/..' . '/symfony/contracts/Service/ServiceProviderInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/contracts/Service/ServiceSubscriberInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/contracts/Service/ServiceSubscriberTrait.php',
|
||||
'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => __DIR__ . '/..' . '/symfony/contracts/Service/Test/ServiceLocatorTest.php',
|
||||
'Symfony\\Contracts\\Tests\\Cache\\CacheTraitTest' => __DIR__ . '/..' . '/symfony/contracts/Tests/Cache/CacheTraitTest.php',
|
||||
'Symfony\\Contracts\\Tests\\Service\\ServiceSubscriberTraitTest' => __DIR__ . '/..' . '/symfony/contracts/Tests/Service/ServiceSubscriberTraitTest.php',
|
||||
'Symfony\\Contracts\\Translation\\LocaleAwareInterface' => __DIR__ . '/..' . '/symfony/contracts/Translation/LocaleAwareInterface.php',
|
||||
'Symfony\\Contracts\\Translation\\Test\\TranslatorTest' => __DIR__ . '/..' . '/symfony/contracts/Translation/Test/TranslatorTest.php',
|
||||
'Symfony\\Contracts\\Translation\\TranslatorInterface' => __DIR__ . '/..' . '/symfony/contracts/Translation/TranslatorInterface.php',
|
||||
'Symfony\\Contracts\\Translation\\TranslatorTrait' => __DIR__ . '/..' . '/symfony/contracts/Translation/TranslatorTrait.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts/Event.php',
|
||||
'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher-contracts/EventDispatcherInterface.php',
|
||||
'Symfony\\Contracts\\Service\\Attribute\\Required' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/Required.php',
|
||||
'Symfony\\Contracts\\Service\\Attribute\\SubscribedService' => __DIR__ . '/..' . '/symfony/service-contracts/Attribute/SubscribedService.php',
|
||||
'Symfony\\Contracts\\Service\\ResetInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ResetInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceLocatorTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceLocatorTrait.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceProviderInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceProviderInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberInterface.php',
|
||||
'Symfony\\Contracts\\Service\\ServiceSubscriberTrait' => __DIR__ . '/..' . '/symfony/service-contracts/ServiceSubscriberTrait.php',
|
||||
'Symfony\\Contracts\\Service\\Test\\ServiceLocatorTest' => __DIR__ . '/..' . '/symfony/service-contracts/Test/ServiceLocatorTest.php',
|
||||
'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php',
|
||||
'Symfony\\Polyfill\\Php73\\Php73' => __DIR__ . '/..' . '/symfony/polyfill-php73/Php73.php',
|
||||
'Symfony\\Polyfill\\Php80\\Php80' => __DIR__ . '/..' . '/symfony/polyfill-php80/Php80.php',
|
||||
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
||||
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
|
||||
652
vendor/composer/installed.json
vendored
652
vendor/composer/installed.json
vendored
@@ -2,32 +2,32 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "christian-riesen/base32",
|
||||
"version": "1.3.2",
|
||||
"version_normalized": "1.3.2.0",
|
||||
"version": "1.6.0",
|
||||
"version_normalized": "1.6.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ChristianRiesen/base32.git",
|
||||
"reference": "80ff0e3b2124e61b4b39e2535709452f70bff367"
|
||||
"reference": "2e82dab3baa008e24a505649b0d583c31d31e894"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ChristianRiesen/base32/zipball/80ff0e3b2124e61b4b39e2535709452f70bff367",
|
||||
"reference": "80ff0e3b2124e61b4b39e2535709452f70bff367",
|
||||
"url": "https://api.github.com/repos/ChristianRiesen/base32/zipball/2e82dab3baa008e24a505649b0d583c31d31e894",
|
||||
"reference": "2e82dab3baa008e24a505649b0d583c31d31e894",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3"
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php": ">=5.6",
|
||||
"phpunit/phpunit": "^5.0",
|
||||
"satooshi/php-coveralls": "^1.0"
|
||||
"friendsofphp/php-cs-fixer": "^2.17",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpunit/phpunit": "^8.5.13 || ^9.5"
|
||||
},
|
||||
"time": "2018-11-02T09:03:50+00:00",
|
||||
"time": "2021-02-26T10:19:33+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1.x-dev"
|
||||
"dev-master": "1.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
@@ -56,6 +56,10 @@
|
||||
"encode",
|
||||
"rfc4648"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/ChristianRiesen/base32/issues",
|
||||
"source": "https://github.com/ChristianRiesen/base32/tree/1.6.0"
|
||||
},
|
||||
"install-path": "../christian-riesen/base32"
|
||||
},
|
||||
{
|
||||
@@ -326,29 +330,24 @@
|
||||
},
|
||||
{
|
||||
"name": "psr/container",
|
||||
"version": "2.0.1",
|
||||
"version_normalized": "2.0.1.0",
|
||||
"version": "1.1.2",
|
||||
"version_normalized": "1.1.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/container.git",
|
||||
"reference": "2ae37329ee82f91efadc282cc2d527fd6065a5ef"
|
||||
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/container/zipball/2ae37329ee82f91efadc282cc2d527fd6065a5ef",
|
||||
"reference": "2ae37329ee82f91efadc282cc2d527fd6065a5ef",
|
||||
"url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea",
|
||||
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.0"
|
||||
"php": ">=7.4.0"
|
||||
},
|
||||
"time": "2021-03-24T13:40:57+00:00",
|
||||
"time": "2021-11-05T16:50:12+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -374,6 +373,10 @@
|
||||
"container-interop",
|
||||
"psr"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-fig/container/issues",
|
||||
"source": "https://github.com/php-fig/container/tree/1.1.2"
|
||||
},
|
||||
"install-path": "../psr/container"
|
||||
},
|
||||
{
|
||||
@@ -481,42 +484,53 @@
|
||||
"mail",
|
||||
"mailer"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/swiftmailer/swiftmailer/issues",
|
||||
"source": "https://github.com/swiftmailer/swiftmailer/tree/v5.4.8"
|
||||
},
|
||||
"abandoned": "symfony/mailer",
|
||||
"install-path": "../swiftmailer/swiftmailer"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v4.2.12",
|
||||
"version_normalized": "4.2.12.0",
|
||||
"version": "v4.4.37",
|
||||
"version_normalized": "4.4.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "fc2e274aade6567a750551942094b2145ade9b6c"
|
||||
"reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/fc2e274aade6567a750551942094b2145ade9b6c",
|
||||
"reference": "fc2e274aade6567a750551942094b2145ade9b6c",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6",
|
||||
"reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3",
|
||||
"symfony/contracts": "^1.0",
|
||||
"symfony/polyfill-mbstring": "~1.0"
|
||||
"php": ">=7.1.3",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/polyfill-php73": "^1.8",
|
||||
"symfony/polyfill-php80": "^1.16",
|
||||
"symfony/service-contracts": "^1.1|^2"
|
||||
},
|
||||
"conflict": {
|
||||
"psr/log": ">=3",
|
||||
"symfony/dependency-injection": "<3.4",
|
||||
"symfony/event-dispatcher": "<4.3|>=5",
|
||||
"symfony/lock": "<4.4",
|
||||
"symfony/process": "<3.3"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "1.0"
|
||||
"psr/log-implementation": "1.0|2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~3.4|~4.0",
|
||||
"symfony/dependency-injection": "~3.4|~4.0",
|
||||
"symfony/event-dispatcher": "~3.4|~4.0",
|
||||
"symfony/lock": "~3.4|~4.0",
|
||||
"symfony/process": "~3.4|~4.0"
|
||||
"psr/log": "^1|^2",
|
||||
"symfony/config": "^3.4|^4.0|^5.0",
|
||||
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
|
||||
"symfony/event-dispatcher": "^4.3",
|
||||
"symfony/lock": "^4.4|^5.0",
|
||||
"symfony/process": "^3.4|^4.0|^5.0",
|
||||
"symfony/var-dumper": "^4.3|^5.0"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/log": "For using the console logger",
|
||||
@@ -524,13 +538,8 @@
|
||||
"symfony/lock": "",
|
||||
"symfony/process": ""
|
||||
},
|
||||
"time": "2019-07-24T17:13:20+00:00",
|
||||
"time": "2022-01-26T16:15:26+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "4.2-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -554,64 +563,60 @@
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"description": "Eases the creation of beautiful and testable command line interfaces",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v4.4.37"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/console"
|
||||
},
|
||||
{
|
||||
"name": "symfony/contracts",
|
||||
"version": "v1.1.3",
|
||||
"version_normalized": "1.1.3.0",
|
||||
"name": "symfony/deprecation-contracts",
|
||||
"version": "v2.5.0",
|
||||
"version_normalized": "2.5.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/contracts.git",
|
||||
"reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5"
|
||||
"url": "https://github.com/symfony/deprecation-contracts.git",
|
||||
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/contracts/zipball/2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
|
||||
"reference": "2d19b12caccbd80cf0c85624dc87b7021a0df1d5",
|
||||
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8",
|
||||
"reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1.3"
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"replace": {
|
||||
"symfony/cache-contracts": "self.version",
|
||||
"symfony/event-dispatcher-contracts": "self.version",
|
||||
"symfony/http-client-contracts": "self.version",
|
||||
"symfony/service-contracts": "self.version",
|
||||
"symfony/translation-contracts": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/cache": "^1.0",
|
||||
"psr/container": "^1.0",
|
||||
"symfony/polyfill-intl-idn": "^1.10"
|
||||
},
|
||||
"suggest": {
|
||||
"psr/cache": "When using the Cache contracts",
|
||||
"psr/container": "When using the Service contracts",
|
||||
"psr/event-dispatcher": "When using the EventDispatcher contracts",
|
||||
"symfony/cache-implementation": "",
|
||||
"symfony/event-dispatcher-implementation": "",
|
||||
"symfony/http-client-implementation": "",
|
||||
"symfony/service-implementation": "",
|
||||
"symfony/translation-implementation": ""
|
||||
},
|
||||
"time": "2019-06-05T13:28:50+00:00",
|
||||
"time": "2021-07-12T14:48:14+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.1-dev"
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Contracts\\": ""
|
||||
},
|
||||
"exclude-from-classmap": [
|
||||
"**/Tests/"
|
||||
"files": [
|
||||
"function.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
@@ -628,57 +633,70 @@
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "A set of abstractions extracted out of the Symfony components",
|
||||
"description": "A generic function and convention to trigger deprecation notices",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"abstractions",
|
||||
"contracts",
|
||||
"decoupling",
|
||||
"interfaces",
|
||||
"interoperability",
|
||||
"standards"
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/contracts"
|
||||
"install-path": "../symfony/deprecation-contracts"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v3.4.2",
|
||||
"version_normalized": "3.4.2.0",
|
||||
"version": "v4.4.37",
|
||||
"version_normalized": "4.4.37.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "b869cbf8a15ca6261689de2c28a7d7f2d0706835"
|
||||
"reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b869cbf8a15ca6261689de2c28a7d7f2d0706835",
|
||||
"reference": "b869cbf8a15ca6261689de2c28a7d7f2d0706835",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3ccfcfb96ecce1217d7b0875a0736976bc6e63dc",
|
||||
"reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
"php": ">=7.1.3",
|
||||
"symfony/event-dispatcher-contracts": "^1.1",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/dependency-injection": "<3.3"
|
||||
"symfony/dependency-injection": "<3.4"
|
||||
},
|
||||
"provide": {
|
||||
"psr/event-dispatcher-implementation": "1.0",
|
||||
"symfony/event-dispatcher-implementation": "1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/log": "~1.0",
|
||||
"symfony/config": "~2.8|~3.0|~4.0",
|
||||
"symfony/dependency-injection": "~3.3|~4.0",
|
||||
"symfony/expression-language": "~2.8|~3.0|~4.0",
|
||||
"symfony/stopwatch": "~2.8|~3.0|~4.0"
|
||||
"psr/log": "^1|^2|^3",
|
||||
"symfony/config": "^3.4|^4.0|^5.0",
|
||||
"symfony/dependency-injection": "^3.4|^4.0|^5.0",
|
||||
"symfony/error-handler": "~3.4|~4.4",
|
||||
"symfony/expression-language": "^3.4|^4.0|^5.0",
|
||||
"symfony/http-foundation": "^3.4|^4.0|^5.0",
|
||||
"symfony/service-contracts": "^1.1|^2",
|
||||
"symfony/stopwatch": "^3.4|^4.0|^5.0"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/dependency-injection": "",
|
||||
"symfony/http-kernel": ""
|
||||
},
|
||||
"time": "2017-12-14T19:40:10+00:00",
|
||||
"time": "2022-01-02T09:41:36+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -702,29 +720,130 @@
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v4.4.37"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/event-dispatcher"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v5.2.1",
|
||||
"version_normalized": "5.2.1.0",
|
||||
"name": "symfony/event-dispatcher-contracts",
|
||||
"version": "v1.1.11",
|
||||
"version_normalized": "1.1.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba"
|
||||
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
|
||||
"reference": "01e9a4efac0ee33a05dfdf93b346f62e7d0e998c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/0b9231a5922fd7287ba5b411893c0ecd2733e5ba",
|
||||
"reference": "0b9231a5922fd7287ba5b411893c0ecd2733e5ba",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/01e9a4efac0ee33a05dfdf93b346f62e7d0e998c",
|
||||
"reference": "01e9a4efac0ee33a05dfdf93b346f62e7d0e998c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5"
|
||||
"php": ">=7.1.3"
|
||||
},
|
||||
"time": "2020-12-08T17:02:38+00:00",
|
||||
"suggest": {
|
||||
"psr/event-dispatcher": "",
|
||||
"symfony/event-dispatcher-implementation": ""
|
||||
},
|
||||
"time": "2021-03-23T15:25:38+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.1-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Contracts\\EventDispatcher\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Generic abstractions related to dispatching event",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"abstractions",
|
||||
"contracts",
|
||||
"decoupling",
|
||||
"interfaces",
|
||||
"interoperability",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher-contracts/tree/v1.1.11"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/event-dispatcher-contracts"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v5.4.3",
|
||||
"version_normalized": "5.4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/231313534dded84c7ecaa79d14bc5da4ccb69b7d",
|
||||
"reference": "231313534dded84c7ecaa79d14bc5da4ccb69b7d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"symfony/deprecation-contracts": "^2.1|^3",
|
||||
"symfony/polyfill-php80": "^1.16"
|
||||
},
|
||||
"time": "2022-01-26T16:34:36+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@@ -749,8 +868,11 @@
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/finder/tree/v5.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
@@ -769,30 +891,33 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
"version": "v1.18.1",
|
||||
"version_normalized": "1.18.1.0",
|
||||
"version": "v1.24.0",
|
||||
"version_normalized": "1.24.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-mbstring.git",
|
||||
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a"
|
||||
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a",
|
||||
"reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825",
|
||||
"reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.3"
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"provide": {
|
||||
"ext-mbstring": "*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-mbstring": "For best performance"
|
||||
},
|
||||
"time": "2020-07-14T12:35:20+00:00",
|
||||
"time": "2021-11-30T18:21:41+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.18-dev"
|
||||
"dev-main": "1.23-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
@@ -831,7 +956,278 @@
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/polyfill-mbstring"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php73",
|
||||
"version": "v1.24.0",
|
||||
"version_normalized": "1.24.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php73.git",
|
||||
"reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5",
|
||||
"reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"time": "2021-06-05T21:20:04+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.23-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php73\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/polyfill-php73"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php80",
|
||||
"version": "v1.24.0",
|
||||
"version_normalized": "1.24.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/polyfill-php80.git",
|
||||
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9",
|
||||
"reference": "57b712b08eddb97c762a8caa32c84e037892d2e9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"time": "2021-09-13T13:58:33+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.23-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/polyfill",
|
||||
"url": "https://github.com/symfony/polyfill"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Polyfill\\Php80\\": ""
|
||||
},
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
],
|
||||
"classmap": [
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ion Bazan",
|
||||
"email": "ion.bazan@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"polyfill",
|
||||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/polyfill-php80"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
"version": "v2.5.0",
|
||||
"version_normalized": "2.5.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/service-contracts.git",
|
||||
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
|
||||
"reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"psr/container": "^1.1",
|
||||
"symfony/deprecation-contracts": "^2.1"
|
||||
},
|
||||
"conflict": {
|
||||
"ext-psr": "<1.1|>=2"
|
||||
},
|
||||
"suggest": {
|
||||
"symfony/service-implementation": ""
|
||||
},
|
||||
"time": "2021-11-04T16:48:04+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.5-dev"
|
||||
},
|
||||
"thanks": {
|
||||
"name": "symfony/contracts",
|
||||
"url": "https://github.com/symfony/contracts"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Symfony\\Contracts\\Service\\": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicolas Grekas",
|
||||
"email": "p@tchwork.com"
|
||||
},
|
||||
{
|
||||
"name": "Symfony Community",
|
||||
"homepage": "https://symfony.com/contributors"
|
||||
}
|
||||
],
|
||||
"description": "Generic abstractions related to writing services",
|
||||
"homepage": "https://symfony.com",
|
||||
"keywords": [
|
||||
"abstractions",
|
||||
"contracts",
|
||||
"decoupling",
|
||||
"interfaces",
|
||||
"interoperability",
|
||||
"standards"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/service-contracts/tree/v2.5.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://symfony.com/sponsor",
|
||||
"type": "custom"
|
||||
},
|
||||
{
|
||||
"url": "https://github.com/fabpot",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"install-path": "../symfony/service-contracts"
|
||||
}
|
||||
],
|
||||
"dev": false,
|
||||
|
||||
116
vendor/composer/installed.php
vendored
116
vendor/composer/installed.php
vendored
@@ -5,18 +5,18 @@
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '3e139ab6f4989ebd3963229be37166123c528b3a',
|
||||
'reference' => '14cdaa07bd0dad30903e4136e85124e1435c1f93',
|
||||
'name' => 'kanboard/kanboard',
|
||||
'dev' => false,
|
||||
),
|
||||
'versions' => array(
|
||||
'christian-riesen/base32' => array(
|
||||
'pretty_version' => '1.3.2',
|
||||
'version' => '1.3.2.0',
|
||||
'pretty_version' => '1.6.0',
|
||||
'version' => '1.6.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../christian-riesen/base32',
|
||||
'aliases' => array(),
|
||||
'reference' => '80ff0e3b2124e61b4b39e2535709452f70bff367',
|
||||
'reference' => '2e82dab3baa008e24a505649b0d583c31d31e894',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'christian-riesen/otp' => array(
|
||||
@@ -61,7 +61,7 @@
|
||||
'type' => 'project',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
'reference' => '3e139ab6f4989ebd3963229be37166123c528b3a',
|
||||
'reference' => '14cdaa07bd0dad30903e4136e85124e1435c1f93',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'pimple/pimple' => array(
|
||||
@@ -74,14 +74,20 @@
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'psr/container' => array(
|
||||
'pretty_version' => '2.0.1',
|
||||
'version' => '2.0.1.0',
|
||||
'pretty_version' => '1.1.2',
|
||||
'version' => '1.1.2.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../psr/container',
|
||||
'aliases' => array(),
|
||||
'reference' => '2ae37329ee82f91efadc282cc2d527fd6065a5ef',
|
||||
'reference' => '513e0666f7216c7459170d56df27dfcefe1689ea',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'psr/event-dispatcher-implementation' => array(
|
||||
'dev_requirement' => false,
|
||||
'provided' => array(
|
||||
0 => '1.0',
|
||||
),
|
||||
),
|
||||
'psr/log' => array(
|
||||
'pretty_version' => '1.1.4',
|
||||
'version' => '1.1.4.0',
|
||||
@@ -94,7 +100,7 @@
|
||||
'psr/log-implementation' => array(
|
||||
'dev_requirement' => false,
|
||||
'provided' => array(
|
||||
0 => '1.0',
|
||||
0 => '1.0|2.0',
|
||||
),
|
||||
),
|
||||
'swiftmailer/swiftmailer' => array(
|
||||
@@ -106,80 +112,92 @@
|
||||
'reference' => '9a06dc570a0367850280eefd3f1dc2da45aef517',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/cache-contracts' => array(
|
||||
'dev_requirement' => false,
|
||||
'replaced' => array(
|
||||
0 => 'v1.1.3',
|
||||
),
|
||||
),
|
||||
'symfony/console' => array(
|
||||
'pretty_version' => 'v4.2.12',
|
||||
'version' => '4.2.12.0',
|
||||
'pretty_version' => 'v4.4.37',
|
||||
'version' => '4.4.37.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/console',
|
||||
'aliases' => array(),
|
||||
'reference' => 'fc2e274aade6567a750551942094b2145ade9b6c',
|
||||
'reference' => '0259f01dbf9d77badddbbf4c2abb681f24c9cac6',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/contracts' => array(
|
||||
'pretty_version' => 'v1.1.3',
|
||||
'version' => '1.1.3.0',
|
||||
'symfony/deprecation-contracts' => array(
|
||||
'pretty_version' => 'v2.5.0',
|
||||
'version' => '2.5.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/contracts',
|
||||
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
|
||||
'aliases' => array(),
|
||||
'reference' => '2d19b12caccbd80cf0c85624dc87b7021a0df1d5',
|
||||
'reference' => '6f981ee24cf69ee7ce9736146d1c57c2780598a8',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/event-dispatcher' => array(
|
||||
'pretty_version' => 'v3.4.2',
|
||||
'version' => '3.4.2.0',
|
||||
'pretty_version' => 'v4.4.37',
|
||||
'version' => '4.4.37.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/event-dispatcher',
|
||||
'aliases' => array(),
|
||||
'reference' => 'b869cbf8a15ca6261689de2c28a7d7f2d0706835',
|
||||
'reference' => '3ccfcfb96ecce1217d7b0875a0736976bc6e63dc',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/event-dispatcher-contracts' => array(
|
||||
'pretty_version' => 'v1.1.11',
|
||||
'version' => '1.1.11.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
|
||||
'aliases' => array(),
|
||||
'reference' => '01e9a4efac0ee33a05dfdf93b346f62e7d0e998c',
|
||||
'dev_requirement' => false,
|
||||
'replaced' => array(
|
||||
0 => 'v1.1.3',
|
||||
),
|
||||
'symfony/event-dispatcher-implementation' => array(
|
||||
'dev_requirement' => false,
|
||||
'provided' => array(
|
||||
0 => '1.1',
|
||||
),
|
||||
),
|
||||
'symfony/finder' => array(
|
||||
'pretty_version' => 'v5.2.1',
|
||||
'version' => '5.2.1.0',
|
||||
'pretty_version' => 'v5.4.3',
|
||||
'version' => '5.4.3.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/finder',
|
||||
'aliases' => array(),
|
||||
'reference' => '0b9231a5922fd7287ba5b411893c0ecd2733e5ba',
|
||||
'reference' => '231313534dded84c7ecaa79d14bc5da4ccb69b7d',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/http-client-contracts' => array(
|
||||
'dev_requirement' => false,
|
||||
'replaced' => array(
|
||||
0 => 'v1.1.3',
|
||||
),
|
||||
),
|
||||
'symfony/polyfill-mbstring' => array(
|
||||
'pretty_version' => 'v1.18.1',
|
||||
'version' => '1.18.1.0',
|
||||
'pretty_version' => 'v1.24.0',
|
||||
'version' => '1.24.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
|
||||
'aliases' => array(),
|
||||
'reference' => 'a6977d63bf9a0ad4c65cd352709e230876f9904a',
|
||||
'reference' => '0abb51d2f102e00a4eefcf46ba7fec406d245825',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-php73' => array(
|
||||
'pretty_version' => 'v1.24.0',
|
||||
'version' => '1.24.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-php73',
|
||||
'aliases' => array(),
|
||||
'reference' => 'cc5db0e22b3cb4111010e48785a97f670b350ca5',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/polyfill-php80' => array(
|
||||
'pretty_version' => 'v1.24.0',
|
||||
'version' => '1.24.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
|
||||
'aliases' => array(),
|
||||
'reference' => '57b712b08eddb97c762a8caa32c84e037892d2e9',
|
||||
'dev_requirement' => false,
|
||||
),
|
||||
'symfony/service-contracts' => array(
|
||||
'pretty_version' => 'v2.5.0',
|
||||
'version' => '2.5.0.0',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../symfony/service-contracts',
|
||||
'aliases' => array(),
|
||||
'reference' => '1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc',
|
||||
'dev_requirement' => false,
|
||||
'replaced' => array(
|
||||
0 => 'v1.1.3',
|
||||
),
|
||||
),
|
||||
'symfony/translation-contracts' => array(
|
||||
'dev_requirement' => false,
|
||||
'replaced' => array(
|
||||
0 => 'v1.1.3',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
4
vendor/composer/platform_check.php
vendored
4
vendor/composer/platform_check.php
vendored
@@ -4,8 +4,8 @@
|
||||
|
||||
$issues = array();
|
||||
|
||||
if (!(PHP_VERSION_ID >= 70205)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
|
||||
if (!(PHP_VERSION_ID >= 70400)) {
|
||||
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
|
||||
}
|
||||
|
||||
if ($issues) {
|
||||
|
||||
7
vendor/psr/container/composer.json
vendored
7
vendor/psr/container/composer.json
vendored
@@ -12,16 +12,11 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.2.0"
|
||||
"php": ">=7.4.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Container\\": "src/"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
namespace Psr\Container;
|
||||
|
||||
use Throwable;
|
||||
|
||||
/**
|
||||
* Base interface representing a generic exception in a container.
|
||||
*/
|
||||
interface ContainerExceptionInterface
|
||||
interface ContainerExceptionInterface extends Throwable
|
||||
{
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ interface ContainerInterface
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has(string $id): bool;
|
||||
public function has(string $id);
|
||||
}
|
||||
|
||||
268
vendor/symfony/console/Application.php
vendored
268
vendor/symfony/console/Application.php
vendored
@@ -36,14 +36,16 @@ use Symfony\Component\Console\Input\InputAwareInterface;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\StreamableInputInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\Debug\ErrorHandler;
|
||||
use Symfony\Component\Debug\ErrorHandler as LegacyErrorHandler;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
use Symfony\Component\ErrorHandler\ErrorHandler;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
use Symfony\Component\EventDispatcher\LegacyEventDispatcherProxy;
|
||||
use Symfony\Contracts\Service\ResetInterface;
|
||||
|
||||
/**
|
||||
* An Application is the container for a collection of commands.
|
||||
@@ -60,7 +62,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
class Application
|
||||
class Application implements ResetInterface
|
||||
{
|
||||
private $commands = [];
|
||||
private $wantHelps = false;
|
||||
@@ -90,9 +92,12 @@ class Application
|
||||
$this->defaultCommand = 'list';
|
||||
}
|
||||
|
||||
/**
|
||||
* @final since Symfony 4.3, the type-hint will be updated to the interface from symfony/contracts in 5.0
|
||||
*/
|
||||
public function setDispatcher(EventDispatcherInterface $dispatcher)
|
||||
{
|
||||
$this->dispatcher = $dispatcher;
|
||||
$this->dispatcher = LegacyEventDispatcherProxy::decorate($dispatcher);
|
||||
}
|
||||
|
||||
public function setCommandLoader(CommandLoaderInterface $commandLoader)
|
||||
@@ -109,8 +114,10 @@ class Application
|
||||
*/
|
||||
public function run(InputInterface $input = null, OutputInterface $output = null)
|
||||
{
|
||||
putenv('LINES='.$this->terminal->getHeight());
|
||||
putenv('COLUMNS='.$this->terminal->getWidth());
|
||||
if (\function_exists('putenv')) {
|
||||
@putenv('LINES='.$this->terminal->getHeight());
|
||||
@putenv('COLUMNS='.$this->terminal->getWidth());
|
||||
}
|
||||
|
||||
if (null === $input) {
|
||||
$input = new ArgvInput();
|
||||
@@ -120,22 +127,19 @@ class Application
|
||||
$output = new ConsoleOutput();
|
||||
}
|
||||
|
||||
$renderException = function ($e) use ($output) {
|
||||
if (!$e instanceof \Exception) {
|
||||
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
|
||||
}
|
||||
$renderException = function (\Throwable $e) use ($output) {
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$this->renderException($e, $output->getErrorOutput());
|
||||
$this->renderThrowable($e, $output->getErrorOutput());
|
||||
} else {
|
||||
$this->renderException($e, $output);
|
||||
$this->renderThrowable($e, $output);
|
||||
}
|
||||
};
|
||||
if ($phpHandler = set_exception_handler($renderException)) {
|
||||
restore_exception_handler();
|
||||
if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandler) {
|
||||
$debugHandler = true;
|
||||
} elseif ($debugHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
|
||||
$phpHandler[0]->setExceptionHandler($debugHandler);
|
||||
if (!\is_array($phpHandler) || (!$phpHandler[0] instanceof ErrorHandler && !$phpHandler[0] instanceof LegacyErrorHandler)) {
|
||||
$errorHandler = true;
|
||||
} elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
|
||||
$phpHandler[0]->setExceptionHandler($errorHandler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +171,7 @@ class Application
|
||||
restore_exception_handler();
|
||||
}
|
||||
restore_exception_handler();
|
||||
} elseif (!$debugHandler) {
|
||||
} elseif (!$errorHandler) {
|
||||
$finalHandler = $phpHandler[0]->setExceptionHandler(null);
|
||||
if ($finalHandler !== $renderException) {
|
||||
$phpHandler[0]->setExceptionHandler($finalHandler);
|
||||
@@ -235,7 +239,7 @@ class Application
|
||||
if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
|
||||
if (null !== $this->dispatcher) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
|
||||
|
||||
if (0 === $event->getExitCode()) {
|
||||
return 0;
|
||||
@@ -254,7 +258,7 @@ class Application
|
||||
if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
|
||||
if (null !== $this->dispatcher) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
|
||||
|
||||
return $event->getExitCode();
|
||||
}
|
||||
@@ -272,6 +276,13 @@ class Application
|
||||
return $exitCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
}
|
||||
|
||||
public function setHelperSet(HelperSet $helperSet)
|
||||
{
|
||||
$this->helperSet = $helperSet;
|
||||
@@ -468,12 +479,11 @@ class Application
|
||||
if (!$command->isEnabled()) {
|
||||
$command->setApplication(null);
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (null === $command->getDefinition()) {
|
||||
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
|
||||
}
|
||||
// Will throw if the command is not correctly initialized.
|
||||
$command->getDefinition();
|
||||
|
||||
if (!$command->getName()) {
|
||||
throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($command)));
|
||||
@@ -505,6 +515,11 @@ class Application
|
||||
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
// When the command has a different name than the one used at the command loader level
|
||||
if (!isset($this->commands[$name])) {
|
||||
throw new CommandNotFoundException(sprintf('The "%s" command cannot be found because it is registered under multiple names. Make sure you don\'t set a different name via constructor or "setName()".', $name));
|
||||
}
|
||||
|
||||
$command = $this->commands[$name];
|
||||
|
||||
if ($this->wantHelps) {
|
||||
@@ -544,6 +559,10 @@ class Application
|
||||
{
|
||||
$namespaces = [];
|
||||
foreach ($this->all() as $command) {
|
||||
if ($command->isHidden()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
|
||||
|
||||
foreach ($command->getAliases() as $alias) {
|
||||
@@ -587,7 +606,7 @@ class Application
|
||||
|
||||
$exact = \in_array($namespace, $namespaces, true);
|
||||
if (\count($namespaces) > 1 && !$exact) {
|
||||
throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
|
||||
throw new NamespaceNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
|
||||
}
|
||||
|
||||
return $exact ? $namespace : reset($namespaces);
|
||||
@@ -619,6 +638,10 @@ class Application
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->has($name)) {
|
||||
return $this->get($name);
|
||||
}
|
||||
|
||||
$allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands);
|
||||
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
|
||||
$commands = preg_grep('{^'.$expr.'}', $allCommands);
|
||||
@@ -637,6 +660,11 @@ class Application
|
||||
$message = sprintf('Command "%s" is not defined.', $name);
|
||||
|
||||
if ($alternatives = $this->findAlternatives($name, $allCommands)) {
|
||||
// remove hidden commands
|
||||
$alternatives = array_filter($alternatives, function ($name) {
|
||||
return !$this->get($name)->isHidden();
|
||||
});
|
||||
|
||||
if (1 == \count($alternatives)) {
|
||||
$message .= "\n\nDid you mean this?\n ";
|
||||
} else {
|
||||
@@ -645,42 +673,58 @@ class Application
|
||||
$message .= implode("\n ", $alternatives);
|
||||
}
|
||||
|
||||
throw new CommandNotFoundException($message, $alternatives);
|
||||
throw new CommandNotFoundException($message, array_values($alternatives));
|
||||
}
|
||||
|
||||
// filter out aliases for commands which are already on the list
|
||||
if (\count($commands) > 1) {
|
||||
$commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands;
|
||||
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
|
||||
$commandName = $commandList[$nameOrAlias] instanceof Command ? $commandList[$nameOrAlias]->getName() : $nameOrAlias;
|
||||
$commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) {
|
||||
if (!$commandList[$nameOrAlias] instanceof Command) {
|
||||
$commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias);
|
||||
}
|
||||
|
||||
$commandName = $commandList[$nameOrAlias]->getName();
|
||||
|
||||
$aliases[$nameOrAlias] = $commandName;
|
||||
|
||||
return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
|
||||
}));
|
||||
}
|
||||
|
||||
$exact = \in_array($name, $commands, true) || isset($aliases[$name]);
|
||||
if (\count($commands) > 1 && !$exact) {
|
||||
if (\count($commands) > 1) {
|
||||
$usableWidth = $this->terminal->getWidth() - 10;
|
||||
$abbrevs = array_values($commands);
|
||||
$maxLen = 0;
|
||||
foreach ($abbrevs as $abbrev) {
|
||||
$maxLen = max(Helper::strlen($abbrev), $maxLen);
|
||||
}
|
||||
$abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen) {
|
||||
if (!$commandList[$cmd] instanceof Command) {
|
||||
return $cmd;
|
||||
$abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) {
|
||||
if ($commandList[$cmd]->isHidden()) {
|
||||
unset($commands[array_search($cmd, $commands)]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription();
|
||||
|
||||
return Helper::strlen($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev;
|
||||
}, array_values($commands));
|
||||
$suggestions = $this->getAbbreviationSuggestions($abbrevs);
|
||||
|
||||
throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $name, $suggestions), array_values($commands));
|
||||
if (\count($commands) > 1) {
|
||||
$suggestions = $this->getAbbreviationSuggestions(array_filter($abbrevs));
|
||||
|
||||
throw new CommandNotFoundException(sprintf("Command \"%s\" is ambiguous.\nDid you mean one of these?\n%s.", $name, $suggestions), array_values($commands));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->get($exact ? $name : reset($commands));
|
||||
$command = $this->get(reset($commands));
|
||||
|
||||
if ($command->isHidden()) {
|
||||
@trigger_error(sprintf('Command "%s" is hidden, finding it using an abbreviation is deprecated since Symfony 4.4, use its full name instead.', $command->getName()), \E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return $command;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -751,39 +795,95 @@ class Application
|
||||
|
||||
/**
|
||||
* Renders a caught exception.
|
||||
*
|
||||
* @deprecated since Symfony 4.4, use "renderThrowable()" instead
|
||||
*/
|
||||
public function renderException(\Exception $e, OutputInterface $output)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);
|
||||
|
||||
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
|
||||
|
||||
$this->doRenderException($e, $output);
|
||||
|
||||
$this->finishRenderThrowableOrException($output);
|
||||
}
|
||||
|
||||
public function renderThrowable(\Throwable $e, OutputInterface $output): void
|
||||
{
|
||||
if (__CLASS__ !== static::class && __CLASS__ === (new \ReflectionMethod($this, 'renderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'renderException'))->getDeclaringClass()->getName()) {
|
||||
@trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);
|
||||
|
||||
if (!$e instanceof \Exception) {
|
||||
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
|
||||
}
|
||||
|
||||
$this->renderException($e, $output);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
|
||||
|
||||
$this->doRenderThrowable($e, $output);
|
||||
|
||||
$this->finishRenderThrowableOrException($output);
|
||||
}
|
||||
|
||||
private function finishRenderThrowableOrException(OutputInterface $output): void
|
||||
{
|
||||
if (null !== $this->runningCommand) {
|
||||
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
|
||||
$output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
|
||||
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since Symfony 4.4, use "doRenderThrowable()" instead
|
||||
*/
|
||||
protected function doRenderException(\Exception $e, OutputInterface $output)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);
|
||||
|
||||
$this->doActuallyRenderThrowable($e, $output);
|
||||
}
|
||||
|
||||
protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void
|
||||
{
|
||||
if (__CLASS__ !== static::class && __CLASS__ === (new \ReflectionMethod($this, 'doRenderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'doRenderException'))->getDeclaringClass()->getName()) {
|
||||
@trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), \E_USER_DEPRECATED);
|
||||
|
||||
if (!$e instanceof \Exception) {
|
||||
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), \E_ERROR, $e->getFile(), $e->getLine());
|
||||
}
|
||||
|
||||
$this->doRenderException($e, $output);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->doActuallyRenderThrowable($e, $output);
|
||||
}
|
||||
|
||||
private function doActuallyRenderThrowable(\Throwable $e, OutputInterface $output): void
|
||||
{
|
||||
do {
|
||||
$message = trim($e->getMessage());
|
||||
if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
|
||||
$class = \get_class($e);
|
||||
$class = 'c' === $class[0] && 0 === strpos($class, "class@anonymous\0") ? get_parent_class($class).'@anonymous' : $class;
|
||||
$class = get_debug_type($e);
|
||||
$title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : '');
|
||||
$len = Helper::strlen($title);
|
||||
} else {
|
||||
$len = 0;
|
||||
}
|
||||
|
||||
if (false !== strpos($message, "class@anonymous\0")) {
|
||||
$message = preg_replace_callback('/class@anonymous\x00.*?\.php0x?[0-9a-fA-F]++/', function ($m) {
|
||||
return class_exists($m[0], false) ? get_parent_class($m[0]).'@anonymous' : $m[0];
|
||||
if (str_contains($message, "@anonymous\0")) {
|
||||
$message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) {
|
||||
return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0];
|
||||
}, $message);
|
||||
}
|
||||
|
||||
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX;
|
||||
$width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : \PHP_INT_MAX;
|
||||
$lines = [];
|
||||
foreach ('' !== $message ? preg_split('/\r?\n/', $message) : [] as $line) {
|
||||
foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
|
||||
@@ -825,13 +925,13 @@ class Application
|
||||
]);
|
||||
|
||||
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 = $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%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
|
||||
$output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET);
|
||||
}
|
||||
|
||||
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
|
||||
@@ -852,16 +952,6 @@ class Application
|
||||
|
||||
if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
|
||||
$input->setInteractive(false);
|
||||
} elseif (\function_exists('posix_isatty')) {
|
||||
$inputStream = null;
|
||||
|
||||
if ($input instanceof StreamableInputInterface) {
|
||||
$inputStream = $input->getStream();
|
||||
}
|
||||
|
||||
if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($shellVerbosity = (int) getenv('SHELL_VERBOSITY')) {
|
||||
@@ -892,7 +982,9 @@ class Application
|
||||
$input->setInteractive(false);
|
||||
}
|
||||
|
||||
putenv('SHELL_VERBOSITY='.$shellVerbosity);
|
||||
if (\function_exists('putenv')) {
|
||||
@putenv('SHELL_VERBOSITY='.$shellVerbosity);
|
||||
}
|
||||
$_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
|
||||
$_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
|
||||
}
|
||||
@@ -929,7 +1021,7 @@ class Application
|
||||
$e = null;
|
||||
|
||||
try {
|
||||
$this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::COMMAND);
|
||||
|
||||
if ($event->commandShouldRun()) {
|
||||
$exitCode = $command->run($input, $output);
|
||||
@@ -938,7 +1030,7 @@ class Application
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$event = new ConsoleErrorEvent($input, $output, $e, $command);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::ERROR, $event);
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::ERROR);
|
||||
$e = $event->getError();
|
||||
|
||||
if (0 === $exitCode = $event->getExitCode()) {
|
||||
@@ -947,7 +1039,7 @@ class Application
|
||||
}
|
||||
|
||||
$event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
|
||||
$this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
|
||||
$this->dispatcher->dispatch($event, ConsoleEvents::TERMINATE);
|
||||
|
||||
if (null !== $e) {
|
||||
throw $e;
|
||||
@@ -959,7 +1051,7 @@ class Application
|
||||
/**
|
||||
* Gets the name of the command based on input.
|
||||
*
|
||||
* @return string The command name
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getCommandName(InputInterface $input)
|
||||
{
|
||||
@@ -1013,12 +1105,8 @@ class Application
|
||||
|
||||
/**
|
||||
* Returns abbreviated suggestions in string format.
|
||||
*
|
||||
* @param array $abbrevs Abbreviated suggestions to convert
|
||||
*
|
||||
* @return string A formatted string of abbreviated suggestions
|
||||
*/
|
||||
private function getAbbreviationSuggestions($abbrevs)
|
||||
private function getAbbreviationSuggestions(array $abbrevs): string
|
||||
{
|
||||
return ' '.implode("\n ", $abbrevs);
|
||||
}
|
||||
@@ -1035,8 +1123,7 @@ class Application
|
||||
*/
|
||||
public function extractNamespace($name, $limit = null)
|
||||
{
|
||||
$parts = explode(':', $name);
|
||||
array_pop($parts);
|
||||
$parts = explode(':', $name, -1);
|
||||
|
||||
return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
|
||||
}
|
||||
@@ -1045,12 +1132,9 @@ class Application
|
||||
* Finds alternative of $name among $collection,
|
||||
* if nothing is found in $collection, try in $abbrevs.
|
||||
*
|
||||
* @param string $name The string
|
||||
* @param iterable $collection The collection
|
||||
*
|
||||
* @return string[] A sorted array of similar string
|
||||
*/
|
||||
private function findAlternatives($name, $collection)
|
||||
private function findAlternatives(string $name, iterable $collection): array
|
||||
{
|
||||
$threshold = 1e3;
|
||||
$alternatives = [];
|
||||
@@ -1071,7 +1155,7 @@ class Application
|
||||
}
|
||||
|
||||
$lev = levenshtein($subname, $parts[$i]);
|
||||
if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
|
||||
if ($lev <= \strlen($subname) / 3 || '' !== $subname && str_contains($parts[$i], $subname)) {
|
||||
$alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
|
||||
} elseif ($exists) {
|
||||
$alternatives[$collectionName] += $threshold;
|
||||
@@ -1081,13 +1165,13 @@ class Application
|
||||
|
||||
foreach ($collection as $item) {
|
||||
$lev = levenshtein($name, $item);
|
||||
if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
|
||||
if ($lev <= \strlen($name) / 3 || str_contains($item, $name)) {
|
||||
$alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
|
||||
}
|
||||
}
|
||||
|
||||
$alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
|
||||
ksort($alternatives, SORT_NATURAL | SORT_FLAG_CASE);
|
||||
ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE);
|
||||
|
||||
return array_keys($alternatives);
|
||||
}
|
||||
@@ -1117,12 +1201,12 @@ class Application
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function isSingleCommand()
|
||||
public function isSingleCommand(): bool
|
||||
{
|
||||
return $this->singleCommand;
|
||||
}
|
||||
|
||||
private function splitStringByWidth($string, $width)
|
||||
private function splitStringByWidth(string $string, int $width): array
|
||||
{
|
||||
// str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly.
|
||||
// additionally, array_slice() is not enough as some character has doubled width.
|
||||
@@ -1134,15 +1218,21 @@ class Application
|
||||
$utf8String = mb_convert_encoding($string, 'utf8', $encoding);
|
||||
$lines = [];
|
||||
$line = '';
|
||||
foreach (preg_split('//u', $utf8String) as $char) {
|
||||
// test if $char could be appended to current line
|
||||
if (mb_strwidth($line.$char, 'utf8') <= $width) {
|
||||
$line .= $char;
|
||||
continue;
|
||||
|
||||
$offset = 0;
|
||||
while (preg_match('/.{1,10000}/u', $utf8String, $m, 0, $offset)) {
|
||||
$offset += \strlen($m[0]);
|
||||
|
||||
foreach (preg_split('//u', $m[0]) as $char) {
|
||||
// test if $char could be appended to current line
|
||||
if (mb_strwidth($line.$char, 'utf8') <= $width) {
|
||||
$line .= $char;
|
||||
continue;
|
||||
}
|
||||
// if not, push current line to array and make new line
|
||||
$lines[] = str_pad($line, $width);
|
||||
$line = $char;
|
||||
}
|
||||
// if not, push current line to array and make new line
|
||||
$lines[] = str_pad($line, $width);
|
||||
$line = $char;
|
||||
}
|
||||
|
||||
$lines[] = \count($lines) ? str_pad($line, $width) : $line;
|
||||
@@ -1155,11 +1245,9 @@ class Application
|
||||
/**
|
||||
* Returns all namespaces of the command name.
|
||||
*
|
||||
* @param string $name The full name of the command
|
||||
*
|
||||
* @return string[] The namespaces of the command
|
||||
*/
|
||||
private function extractAllNamespaces($name)
|
||||
private function extractAllNamespaces(string $name): array
|
||||
{
|
||||
// -1 as third argument is needed to skip the command short name when exploding
|
||||
$parts = explode(':', $name, -1);
|
||||
|
||||
58
vendor/symfony/console/CHANGELOG.md
vendored
58
vendor/symfony/console/CHANGELOG.md
vendored
@@ -1,6 +1,28 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
4.4.0
|
||||
-----
|
||||
|
||||
* deprecated finding hidden commands using an abbreviation, use the full name instead
|
||||
* added `Question::setTrimmable` default to true to allow the answer to be trimmed
|
||||
* added method `minSecondsBetweenRedraws()` and `maxSecondsBetweenRedraws()` on `ProgressBar`
|
||||
* `Application` implements `ResetInterface`
|
||||
* marked all dispatched event classes as `@final`
|
||||
* added support for displaying table horizontally
|
||||
* deprecated returning `null` from `Command::execute()`, return `0` instead
|
||||
* Deprecated the `Application::renderException()` and `Application::doRenderException()` methods,
|
||||
use `renderThrowable()` and `doRenderThrowable()` instead.
|
||||
* added support for the `NO_COLOR` env var (https://no-color.org/)
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
||||
* added support for hyperlinks
|
||||
* added `ProgressBar::iterate()` method that simplify updating the progress bar when iterating
|
||||
* added `Question::setAutocompleterCallback()` to provide a callback function
|
||||
that dynamically generates suggestions as the user types
|
||||
|
||||
4.2.0
|
||||
-----
|
||||
|
||||
@@ -24,10 +46,10 @@ CHANGELOG
|
||||
|
||||
* `OutputFormatter` throws an exception when unknown options are used
|
||||
* removed `QuestionHelper::setInputStream()/getInputStream()`
|
||||
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
|
||||
`Application::setTerminalDimensions()/getTerminalDimensions()`
|
||||
* removed `ConsoleExceptionEvent`
|
||||
* removed `ConsoleEvents::EXCEPTION`
|
||||
* removed `Application::getTerminalWidth()/getTerminalHeight()` and
|
||||
`Application::setTerminalDimensions()/getTerminalDimensions()`
|
||||
* removed `ConsoleExceptionEvent`
|
||||
* removed `ConsoleEvents::EXCEPTION`
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
@@ -44,29 +66,29 @@ CHANGELOG
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
* added `ExceptionListener`
|
||||
* added `AddConsoleCommandPass` (originally in FrameworkBundle)
|
||||
* [BC BREAK] `Input::getOption()` no longer returns the default value for options
|
||||
with value optional explicitly passed empty
|
||||
* added console.error event to catch exceptions thrown by other listeners
|
||||
* deprecated console.exception event in favor of console.error
|
||||
* added ability to handle `CommandNotFoundException` through the
|
||||
`console.error` event
|
||||
* deprecated default validation in `SymfonyQuestionHelper::ask`
|
||||
* added `ExceptionListener`
|
||||
* added `AddConsoleCommandPass` (originally in FrameworkBundle)
|
||||
* [BC BREAK] `Input::getOption()` no longer returns the default value for options
|
||||
with value optional explicitly passed empty
|
||||
* added console.error event to catch exceptions thrown by other listeners
|
||||
* deprecated console.exception event in favor of console.error
|
||||
* added ability to handle `CommandNotFoundException` through the
|
||||
`console.error` event
|
||||
* deprecated default validation in `SymfonyQuestionHelper::ask`
|
||||
|
||||
3.2.0
|
||||
------
|
||||
|
||||
* added `setInputs()` method to CommandTester for ease testing of commands expecting inputs
|
||||
* added `setStream()` and `getStream()` methods to Input (implement StreamableInputInterface)
|
||||
* added StreamableInputInterface
|
||||
* added LockableTrait
|
||||
* added `setInputs()` method to CommandTester for ease testing of commands expecting inputs
|
||||
* added `setStream()` and `getStream()` methods to Input (implement StreamableInputInterface)
|
||||
* added StreamableInputInterface
|
||||
* added LockableTrait
|
||||
|
||||
3.1.0
|
||||
-----
|
||||
|
||||
* added truncate method to FormatterHelper
|
||||
* added setColumnWidth(s) method to Table
|
||||
* added setColumnWidth(s) method to Table
|
||||
|
||||
2.8.3
|
||||
-----
|
||||
|
||||
59
vendor/symfony/console/Command/Command.php
vendored
59
vendor/symfony/console/Command/Command.php
vendored
@@ -40,8 +40,8 @@ class Command
|
||||
private $aliases = [];
|
||||
private $definition;
|
||||
private $hidden = false;
|
||||
private $help;
|
||||
private $description;
|
||||
private $help = '';
|
||||
private $description = '';
|
||||
private $ignoreValidationErrors = false;
|
||||
private $applicationDefinitionMerged = false;
|
||||
private $applicationDefinitionMergedWithArgs = false;
|
||||
@@ -55,7 +55,7 @@ class Command
|
||||
*/
|
||||
public static function getDefaultName()
|
||||
{
|
||||
$class = \get_called_class();
|
||||
$class = static::class;
|
||||
$r = new \ReflectionProperty($class, 'defaultName');
|
||||
|
||||
return $class === $r->class ? static::$defaultName : null;
|
||||
@@ -105,7 +105,7 @@ class Command
|
||||
/**
|
||||
* Gets the helper set.
|
||||
*
|
||||
* @return HelperSet A HelperSet instance
|
||||
* @return HelperSet|null A HelperSet instance
|
||||
*/
|
||||
public function getHelperSet()
|
||||
{
|
||||
@@ -115,7 +115,7 @@ class Command
|
||||
/**
|
||||
* Gets the application instance for this command.
|
||||
*
|
||||
* @return Application An Application instance
|
||||
* @return Application|null An Application instance
|
||||
*/
|
||||
public function getApplication()
|
||||
{
|
||||
@@ -150,7 +150,7 @@ class Command
|
||||
* execute() method, you set the code to execute by passing
|
||||
* a Closure to the setCode() method.
|
||||
*
|
||||
* @return int|null null or 0 if everything went fine, or an error code
|
||||
* @return int 0 if everything went fine, or an exit code
|
||||
*
|
||||
* @throws LogicException When this abstract method is not implemented
|
||||
*
|
||||
@@ -223,7 +223,7 @@ class Command
|
||||
if (null !== $this->processTitle) {
|
||||
if (\function_exists('cli_set_process_title')) {
|
||||
if (!@cli_set_process_title($this->processTitle)) {
|
||||
if ('Darwin' === PHP_OS) {
|
||||
if ('Darwin' === \PHP_OS) {
|
||||
$output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
|
||||
} else {
|
||||
cli_set_process_title($this->processTitle);
|
||||
@@ -253,6 +253,10 @@ class Command
|
||||
$statusCode = ($this->code)($input, $output);
|
||||
} else {
|
||||
$statusCode = $this->execute($input, $output);
|
||||
|
||||
if (!\is_int($statusCode)) {
|
||||
@trigger_error(sprintf('Return value of "%s::execute()" should always be of the type int since Symfony 4.4, %s returned.', static::class, \gettype($statusCode)), \E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
return is_numeric($statusCode) ? (int) $statusCode : 0;
|
||||
@@ -277,7 +281,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,6 +350,10 @@ class Command
|
||||
*/
|
||||
public function getDefinition()
|
||||
{
|
||||
if (null === $this->definition) {
|
||||
throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', static::class));
|
||||
}
|
||||
|
||||
return $this->definition;
|
||||
}
|
||||
|
||||
@@ -360,10 +375,10 @@ class Command
|
||||
/**
|
||||
* Adds an argument.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|null $default The default value (for InputArgument::OPTIONAL mode only)
|
||||
* @param string $name The argument name
|
||||
* @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
|
||||
*
|
||||
* @throws InvalidArgumentException When argument mode is not valid
|
||||
*
|
||||
@@ -379,11 +394,11 @@ class Command
|
||||
/**
|
||||
* Adds an option.
|
||||
*
|
||||
* @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 InputOption::VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|int|bool|null $default The default value (must be null for InputOption::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 InputOption::VALUE_* constants
|
||||
* @param string $description A description text
|
||||
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*
|
||||
@@ -425,8 +440,6 @@ class Command
|
||||
* This feature should be used only when creating a long process command,
|
||||
* like a daemon.
|
||||
*
|
||||
* PHP 5.5+ or the proctitle PECL library is required
|
||||
*
|
||||
* @param string $title The process title
|
||||
*
|
||||
* @return $this
|
||||
@@ -441,7 +454,7 @@ class Command
|
||||
/**
|
||||
* Returns the command name.
|
||||
*
|
||||
* @return string The command name
|
||||
* @return string|null
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
@@ -451,7 +464,7 @@ class Command
|
||||
/**
|
||||
* @param bool $hidden Whether or not the command should be hidden from the list of commands
|
||||
*
|
||||
* @return Command The current instance
|
||||
* @return $this
|
||||
*/
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
@@ -551,7 +564,7 @@ class Command
|
||||
public function setAliases($aliases)
|
||||
{
|
||||
if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
|
||||
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
|
||||
throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable.');
|
||||
}
|
||||
|
||||
foreach ($aliases as $alias) {
|
||||
@@ -600,7 +613,7 @@ class Command
|
||||
*/
|
||||
public function addUsage($usage)
|
||||
{
|
||||
if (0 !== strpos($usage, $this->name)) {
|
||||
if (!str_starts_with($usage, $this->name)) {
|
||||
$usage = sprintf('%s %s', $this->name, $usage);
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -77,5 +77,7 @@ EOF
|
||||
]);
|
||||
|
||||
$this->command = null;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class ListCommand extends Command
|
||||
$this
|
||||
->setName('list')
|
||||
->setDefinition($this->createDefinition())
|
||||
->setDescription('Lists commands')
|
||||
->setDescription('List commands')
|
||||
->setHelp(<<<'EOF'
|
||||
The <info>%command.name%</info> command lists all commands:
|
||||
|
||||
@@ -74,12 +74,11 @@ EOF
|
||||
'raw_text' => $input->getOption('raw'),
|
||||
'namespace' => $input->getArgument('namespace'),
|
||||
]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
private function createDefinition()
|
||||
private function createDefinition(): InputDefinition
|
||||
{
|
||||
return new InputDefinition([
|
||||
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
namespace Symfony\Component\Console\Command;
|
||||
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Lock\Factory;
|
||||
use Symfony\Component\Lock\Lock;
|
||||
use Symfony\Component\Lock\LockFactory;
|
||||
use Symfony\Component\Lock\Store\FlockStore;
|
||||
use Symfony\Component\Lock\Store\SemaphoreStore;
|
||||
|
||||
@@ -29,10 +29,8 @@ trait LockableTrait
|
||||
|
||||
/**
|
||||
* Locks a command.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function lock($name = null, $blocking = false)
|
||||
private function lock(string $name = null, bool $blocking = false): bool
|
||||
{
|
||||
if (!class_exists(SemaphoreStore::class)) {
|
||||
throw new LogicException('To enable the locking feature you must install the symfony/lock component.');
|
||||
@@ -48,7 +46,7 @@ trait LockableTrait
|
||||
$store = new FlockStore();
|
||||
}
|
||||
|
||||
$this->lock = (new Factory($store))->createLock($name ?: $this->getName());
|
||||
$this->lock = (new LockFactory($store))->createLock($name ?: $this->getName());
|
||||
if (!$this->lock->acquire($blocking)) {
|
||||
$this->lock = null;
|
||||
|
||||
|
||||
@@ -25,8 +25,7 @@ class ContainerCommandLoader implements CommandLoaderInterface
|
||||
private $commandMap;
|
||||
|
||||
/**
|
||||
* @param ContainerInterface $container A container from which to load command services
|
||||
* @param array $commandMap An array with command names as keys and service ids as values
|
||||
* @param array $commandMap An array with command names as keys and service ids as values
|
||||
*/
|
||||
public function __construct(ContainerInterface $container, array $commandMap)
|
||||
{
|
||||
|
||||
8
vendor/symfony/console/ConsoleEvents.php
vendored
8
vendor/symfony/console/ConsoleEvents.php
vendored
@@ -21,11 +21,11 @@ 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")
|
||||
*/
|
||||
const COMMAND = 'console.command';
|
||||
public const COMMAND = 'console.command';
|
||||
|
||||
/**
|
||||
* The TERMINATE event allows you to attach listeners after a command is
|
||||
@@ -33,7 +33,7 @@ final class ConsoleEvents
|
||||
*
|
||||
* @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent")
|
||||
*/
|
||||
const TERMINATE = 'console.terminate';
|
||||
public const TERMINATE = 'console.terminate';
|
||||
|
||||
/**
|
||||
* The ERROR event occurs when an uncaught exception or error appears.
|
||||
@@ -43,5 +43,5 @@ final class ConsoleEvents
|
||||
*
|
||||
* @Event("Symfony\Component\Console\Event\ConsoleErrorEvent")
|
||||
*/
|
||||
const ERROR = 'console.error';
|
||||
public const ERROR = 'console.error';
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ use Symfony\Component\Console\Exception\CommandNotFoundException;
|
||||
*/
|
||||
class ApplicationDescription
|
||||
{
|
||||
const GLOBAL_NAMESPACE = '_global';
|
||||
public const GLOBAL_NAMESPACE = '_global';
|
||||
|
||||
private $application;
|
||||
private $namespace;
|
||||
@@ -50,10 +50,7 @@ class ApplicationDescription
|
||||
$this->showHidden = $showHidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getNamespaces()
|
||||
public function getNamespaces(): array
|
||||
{
|
||||
if (null === $this->namespaces) {
|
||||
$this->inspectApplication();
|
||||
@@ -65,7 +62,7 @@ class ApplicationDescription
|
||||
/**
|
||||
* @return Command[]
|
||||
*/
|
||||
public function getCommands()
|
||||
public function getCommands(): array
|
||||
{
|
||||
if (null === $this->commands) {
|
||||
$this->inspectApplication();
|
||||
@@ -75,19 +72,15 @@ class ApplicationDescription
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return Command
|
||||
*
|
||||
* @throws CommandNotFoundException
|
||||
*/
|
||||
public function getCommand($name)
|
||||
public function getCommand(string $name): Command
|
||||
{
|
||||
if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
|
||||
throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
|
||||
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()
|
||||
@@ -122,23 +115,29 @@ class ApplicationDescription
|
||||
{
|
||||
$namespacedCommands = [];
|
||||
$globalCommands = [];
|
||||
$sortedCommands = [];
|
||||
foreach ($commands as $name => $command) {
|
||||
$key = $this->application->extractNamespace($name, 1);
|
||||
if (!$key) {
|
||||
$globalCommands['_global'][$name] = $command;
|
||||
if (\in_array($key, ['', self::GLOBAL_NAMESPACE], true)) {
|
||||
$globalCommands[$name] = $command;
|
||||
} else {
|
||||
$namespacedCommands[$key][$name] = $command;
|
||||
}
|
||||
}
|
||||
ksort($namespacedCommands);
|
||||
$namespacedCommands = array_merge($globalCommands, $namespacedCommands);
|
||||
|
||||
foreach ($namespacedCommands as &$commandsSet) {
|
||||
ksort($commandsSet);
|
||||
if ($globalCommands) {
|
||||
ksort($globalCommands);
|
||||
$sortedCommands[self::GLOBAL_NAMESPACE] = $globalCommands;
|
||||
}
|
||||
// unset reference to keep scope clear
|
||||
unset($commandsSet);
|
||||
|
||||
return $namespacedCommands;
|
||||
if ($namespacedCommands) {
|
||||
ksort($namespacedCommands);
|
||||
foreach ($namespacedCommands as $key => $commandsSet) {
|
||||
ksort($commandsSet);
|
||||
$sortedCommands[$key] = $commandsSet;
|
||||
}
|
||||
}
|
||||
|
||||
return $sortedCommands;
|
||||
}
|
||||
}
|
||||
|
||||
10
vendor/symfony/console/Descriptor/Descriptor.php
vendored
10
vendor/symfony/console/Descriptor/Descriptor.php
vendored
@@ -72,36 +72,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 = []);
|
||||
}
|
||||
|
||||
@@ -23,9 +23,7 @@ interface DescriptorInterface
|
||||
/**
|
||||
* Describes an object if supported.
|
||||
*
|
||||
* @param OutputInterface $output
|
||||
* @param object $object
|
||||
* @param array $options
|
||||
* @param object $object
|
||||
*/
|
||||
public function describe(OutputInterface $output, $object, 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 = [];
|
||||
|
||||
@@ -92,34 +92,26 @@ class JsonDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* Writes data as json.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getInputArgumentData(InputArgument $argument)
|
||||
private function getInputArgumentData(InputArgument $argument): array
|
||||
{
|
||||
return [
|
||||
'name' => $argument->getName(),
|
||||
'is_required' => $argument->isRequired(),
|
||||
'is_array' => $argument->isArray(),
|
||||
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
|
||||
'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
|
||||
'default' => \INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getInputOptionData(InputOption $option)
|
||||
private function getInputOptionData(InputOption $option): array
|
||||
{
|
||||
return [
|
||||
'name' => '--'.$option->getName(),
|
||||
@@ -128,14 +120,11 @@ class JsonDescriptor extends Descriptor
|
||||
'is_value_required' => $option->isValueRequired(),
|
||||
'is_multiple' => $option->isArray(),
|
||||
'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
|
||||
'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
|
||||
'default' => \INF === $option->getDefault() ? 'INF' : $option->getDefault(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getInputDefinitionData(InputDefinition $definition)
|
||||
private function getInputDefinitionData(InputDefinition $definition): array
|
||||
{
|
||||
$inputArguments = [];
|
||||
foreach ($definition->getArguments() as $name => $argument) {
|
||||
@@ -150,10 +139,7 @@ class JsonDescriptor extends Descriptor
|
||||
return ['arguments' => $inputArguments, 'options' => $inputOptions];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getCommandData(Command $command)
|
||||
private function getCommandData(Command $command): array
|
||||
{
|
||||
$command->getSynopsis();
|
||||
$command->mergeApplicationDefinition(false);
|
||||
|
||||
@@ -143,7 +143,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);
|
||||
|
||||
@@ -167,7 +167,7 @@ class MarkdownDescriptor extends Descriptor
|
||||
}
|
||||
}
|
||||
|
||||
private function getApplicationTitle(Application $application)
|
||||
private function getApplicationTitle(Application $application): string
|
||||
{
|
||||
if ('UNKNOWN' !== $application->getName()) {
|
||||
if ('UNKNOWN' !== $application->getVersion()) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -176,7 +176,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']) {
|
||||
@@ -212,7 +212,7 @@ class TextDescriptor extends Descriptor
|
||||
// calculate max. width based on available commands per namespace
|
||||
$width = $this->getColumnWidth(array_merge(...array_values(array_map(function ($namespace) use ($commands) {
|
||||
return array_intersect($namespace['commands'], array_keys($commands));
|
||||
}, $namespaces))));
|
||||
}, array_values($namespaces)))));
|
||||
|
||||
if ($describedNamespace) {
|
||||
$this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
|
||||
@@ -250,7 +250,7 @@ class TextDescriptor extends Descriptor
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
private function writeText($content, array $options = [])
|
||||
private function writeText(string $content, array $options = [])
|
||||
{
|
||||
$this->write(
|
||||
isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
|
||||
@@ -280,7 +280,7 @@ class TextDescriptor extends Descriptor
|
||||
*/
|
||||
private function formatDefaultValue($default): string
|
||||
{
|
||||
if (INF === $default) {
|
||||
if (\INF === $default) {
|
||||
return 'INF';
|
||||
}
|
||||
|
||||
@@ -294,11 +294,11 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
}
|
||||
|
||||
return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
return str_replace('\\\\', '\\', json_encode($default, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param (Command|string)[] $commands
|
||||
* @param array<Command|string> $commands
|
||||
*/
|
||||
private function getColumnWidth(array $commands): int
|
||||
{
|
||||
|
||||
@@ -26,10 +26,7 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
*/
|
||||
class XmlDescriptor extends Descriptor
|
||||
{
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getInputDefinitionDocument(InputDefinition $definition)
|
||||
public function getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($definitionXML = $dom->createElement('definition'));
|
||||
@@ -47,10 +44,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getCommandDocument(Command $command)
|
||||
public function getCommandDocument(Command $command): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($commandXML = $dom->createElement('command'));
|
||||
@@ -80,13 +74,7 @@ class XmlDescriptor extends Descriptor
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Application $application
|
||||
* @param string|null $namespace
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getApplicationDocument(Application $application, $namespace = null)
|
||||
public function getApplicationDocument(Application $application, string $namespace = null): \DOMDocument
|
||||
{
|
||||
$dom = new \DOMDocument('1.0', 'UTF-8');
|
||||
$dom->appendChild($rootXml = $dom->createElement('symfony'));
|
||||
@@ -164,7 +152,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));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -179,8 +167,6 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* Writes DOM document.
|
||||
*
|
||||
* @return \DOMDocument|string
|
||||
*/
|
||||
private function writeDocument(\DOMDocument $dom)
|
||||
{
|
||||
@@ -215,7 +201,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()));
|
||||
|
||||
@@ -15,13 +15,15 @@ namespace Symfony\Component\Console\Event;
|
||||
* Allows to do things before the command is executed, like skipping the command or changing the input.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
*/
|
||||
class ConsoleCommandEvent extends ConsoleEvent
|
||||
{
|
||||
/**
|
||||
* The return code for skipped commands, this will also be passed into the terminate event.
|
||||
*/
|
||||
const RETURN_CODE_DISABLED = 113;
|
||||
public const RETURN_CODE_DISABLED = 113;
|
||||
|
||||
/**
|
||||
* Indicates if the command should be run or skipped.
|
||||
|
||||
@@ -53,6 +53,6 @@ final class ConsoleErrorEvent extends ConsoleEvent
|
||||
|
||||
public function getExitCode(): int
|
||||
{
|
||||
return null !== $this->exitCode ? $this->exitCode : (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
|
||||
return $this->exitCode ?? (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class ConsoleEvent extends Event
|
||||
private $input;
|
||||
private $output;
|
||||
|
||||
public function __construct(Command $command = null, InputInterface $input, OutputInterface $output)
|
||||
public function __construct(?Command $command, InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->command = $command;
|
||||
$this->input = $input;
|
||||
|
||||
@@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
* Allows to manipulate the exit code of a command after its execution.
|
||||
*
|
||||
* @author Francesco Levorato <git@flevour.net>
|
||||
*
|
||||
* @final since Symfony 4.4
|
||||
*/
|
||||
class ConsoleTerminateEvent extends ConsoleEvent
|
||||
{
|
||||
|
||||
@@ -40,10 +40,12 @@ class ErrorListener implements EventSubscriberInterface
|
||||
$error = $event->getError();
|
||||
|
||||
if (!$inputString = $this->getInputString($event)) {
|
||||
return $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)
|
||||
@@ -59,7 +61,9 @@ class ErrorListener implements EventSubscriberInterface
|
||||
}
|
||||
|
||||
if (!$inputString = $this->getInputString($event)) {
|
||||
return $this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
|
||||
$this->logger->debug('The console exited with code "{code}"', ['code' => $exitCode]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->logger->debug('Command "{command}" exited with code "{code}"', ['command' => $inputString, 'code' => $exitCode]);
|
||||
@@ -73,7 +77,7 @@ class ErrorListener implements EventSubscriberInterface
|
||||
];
|
||||
}
|
||||
|
||||
private static function getInputString(ConsoleEvent $event)
|
||||
private static function getInputString(ConsoleEvent $event): ?string
|
||||
{
|
||||
$commandName = $event->getCommand() ? $event->getCommand()->getName() : null;
|
||||
$input = $event->getInput();
|
||||
|
||||
@@ -21,12 +21,12 @@ 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 \Exception $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, \Exception $previous = null)
|
||||
public function __construct(string $message, array $alternatives = [], int $code = 0, \Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -9,15 +9,13 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Contracts\HttpClient\Exception;
|
||||
namespace Symfony\Component\Console\Exception;
|
||||
|
||||
/**
|
||||
* The base interface for all exceptions in the contract.
|
||||
* Represents failure to read input from stdin.
|
||||
*
|
||||
* @author Nicolas Grekas <p@tchwork.com>
|
||||
*
|
||||
* @experimental in 1.1
|
||||
* @author Gabriel Ostrolucký <gabriel.ostrolucky@gmail.com>
|
||||
*/
|
||||
interface ExceptionInterface extends \Throwable
|
||||
class MissingInputException extends RuntimeException implements ExceptionInterface
|
||||
{
|
||||
}
|
||||
@@ -25,8 +25,16 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
private $styles = [];
|
||||
private $styleStack;
|
||||
|
||||
public function __clone()
|
||||
{
|
||||
$this->styleStack = clone $this->styleStack;
|
||||
foreach ($this->styles as $key => $value) {
|
||||
$this->styles[$key] = clone $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes "<" special char in given text.
|
||||
* Escapes "<" and ">" special chars in given text.
|
||||
*
|
||||
* @param string $text Text to escape
|
||||
*
|
||||
@@ -34,7 +42,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
*/
|
||||
public static function escape($text)
|
||||
{
|
||||
$text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
|
||||
$text = preg_replace('/([^\\\\]|^)([<>])/', '$1\\\\$2', $text);
|
||||
|
||||
return self::escapeTrailingBackslash($text);
|
||||
}
|
||||
@@ -42,15 +50,11 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
/**
|
||||
* Escapes trailing "\" in given text.
|
||||
*
|
||||
* @param string $text Text to escape
|
||||
*
|
||||
* @return string Escaped text
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public static function escapeTrailingBackslash($text)
|
||||
public static function escapeTrailingBackslash(string $text): string
|
||||
{
|
||||
if ('\\' === substr($text, -1)) {
|
||||
if (str_ends_with($text, '\\')) {
|
||||
$len = \strlen($text);
|
||||
$text = rtrim($text, '\\');
|
||||
$text = str_replace("\0", '', $text);
|
||||
@@ -63,8 +67,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
/**
|
||||
* Initializes console output formatter.
|
||||
*
|
||||
* @param bool $decorated Whether this formatter should actually decorate strings
|
||||
* @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
|
||||
* @param OutputFormatterStyleInterface[] $styles Array of "name => FormatterStyle" instances
|
||||
*/
|
||||
public function __construct(bool $decorated = false, array $styles = [])
|
||||
{
|
||||
@@ -120,7 +123,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
public function getStyle($name)
|
||||
{
|
||||
if (!$this->hasStyle($name)) {
|
||||
throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
|
||||
throw new InvalidArgumentException(sprintf('Undefined style: "%s".', $name));
|
||||
}
|
||||
|
||||
return $this->styles[strtolower($name)];
|
||||
@@ -141,9 +144,10 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
{
|
||||
$offset = 0;
|
||||
$output = '';
|
||||
$tagRegex = '[a-z][a-z0-9,_=;-]*+';
|
||||
$openTagRegex = '[a-z](?:[^\\\\<>]*+ | \\\\.)*';
|
||||
$closeTagRegex = '[a-z][^<>]*+';
|
||||
$currentLineLength = 0;
|
||||
preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
|
||||
preg_match_all("#<(($openTagRegex) | /($closeTagRegex)?)>#ix", $message, $matches, \PREG_OFFSET_CAPTURE);
|
||||
foreach ($matches[0] as $i => $match) {
|
||||
$pos = $match[1];
|
||||
$text = $match[0];
|
||||
@@ -160,13 +164,13 @@ 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) {
|
||||
// </>
|
||||
$this->styleStack->pop();
|
||||
} elseif (false === $style = $this->createStyleFromString($tag)) {
|
||||
} elseif (null === $style = $this->createStyleFromString($tag)) {
|
||||
$output .= $this->applyCurrentStyle($text, $output, $width, $currentLineLength);
|
||||
} elseif ($open) {
|
||||
$this->styleStack->push($style);
|
||||
@@ -177,11 +181,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
|
||||
$output .= $this->applyCurrentStyle(substr($message, $offset), $output, $width, $currentLineLength);
|
||||
|
||||
if (false !== strpos($output, "\0")) {
|
||||
return strtr($output, ["\0" => '\\', '\\<' => '<']);
|
||||
}
|
||||
|
||||
return str_replace('\\<', '<', $output);
|
||||
return strtr($output, ["\0" => '\\', '\\<' => '<', '\\>' => '>']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,17 +194,15 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
|
||||
/**
|
||||
* Tries to create new style instance from string.
|
||||
*
|
||||
* @return OutputFormatterStyle|false False if string is not format string
|
||||
*/
|
||||
private function createStyleFromString(string $string)
|
||||
private function createStyleFromString(string $string): ?OutputFormatterStyleInterface
|
||||
{
|
||||
if (isset($this->styles[$string])) {
|
||||
return $this->styles[$string];
|
||||
}
|
||||
|
||||
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, PREG_SET_ORDER)) {
|
||||
return false;
|
||||
if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', $string, $matches, \PREG_SET_ORDER)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$style = new OutputFormatterStyle();
|
||||
@@ -216,6 +214,9 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
$style->setForeground(strtolower($match[1]));
|
||||
} elseif ('bg' == $match[0]) {
|
||||
$style->setBackground(strtolower($match[1]));
|
||||
} elseif ('href' === $match[0]) {
|
||||
$url = preg_replace('{\\\\([<>])}', '$1', $match[1]);
|
||||
$style->setHref($url);
|
||||
} elseif ('options' === $match[0]) {
|
||||
preg_match_all('([^,;]+)', strtolower($match[1]), $options);
|
||||
$options = array_shift($options);
|
||||
@@ -223,7 +224,7 @@ class OutputFormatter implements WrappableOutputFormatterInterface
|
||||
$style->setOption($option);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,7 @@ interface OutputFormatterInterface
|
||||
/**
|
||||
* Sets a new style.
|
||||
*
|
||||
* @param string $name The style name
|
||||
* @param OutputFormatterStyleInterface $style The style instance
|
||||
* @param string $name The style name
|
||||
*/
|
||||
public function setStyle($name, OutputFormatterStyleInterface $style);
|
||||
|
||||
|
||||
@@ -52,14 +52,15 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
||||
|
||||
private $foreground;
|
||||
private $background;
|
||||
private $href;
|
||||
private $options = [];
|
||||
private $handlesHrefGracefully;
|
||||
|
||||
/**
|
||||
* Initializes output formatter style.
|
||||
*
|
||||
* @param string|null $foreground The style foreground color name
|
||||
* @param string|null $background The style background color name
|
||||
* @param array $options The style options
|
||||
*/
|
||||
public function __construct(string $foreground = null, string $background = null, array $options = [])
|
||||
{
|
||||
@@ -86,7 +87,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
||||
}
|
||||
|
||||
if (!isset(static::$availableForegroundColors[$color])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
|
||||
throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableForegroundColors))));
|
||||
}
|
||||
|
||||
$this->foreground = static::$availableForegroundColors[$color];
|
||||
@@ -104,19 +105,24 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
||||
}
|
||||
|
||||
if (!isset(static::$availableBackgroundColors[$color])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
|
||||
throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s).', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
|
||||
}
|
||||
|
||||
$this->background = static::$availableBackgroundColors[$color];
|
||||
}
|
||||
|
||||
public function setHref(string $url): void
|
||||
{
|
||||
$this->href = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setOption($option)
|
||||
{
|
||||
if (!isset(static::$availableOptions[$option])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
|
||||
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions))));
|
||||
}
|
||||
|
||||
if (!\in_array(static::$availableOptions[$option], $this->options)) {
|
||||
@@ -130,7 +136,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
||||
public function unsetOption($option)
|
||||
{
|
||||
if (!isset(static::$availableOptions[$option])) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
|
||||
throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s).', $option, implode(', ', array_keys(static::$availableOptions))));
|
||||
}
|
||||
|
||||
$pos = array_search(static::$availableOptions[$option], $this->options);
|
||||
@@ -159,6 +165,11 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
||||
$setCodes = [];
|
||||
$unsetCodes = [];
|
||||
|
||||
if (null === $this->handlesHrefGracefully) {
|
||||
$this->handlesHrefGracefully = 'JetBrains-JediTerm' !== getenv('TERMINAL_EMULATOR')
|
||||
&& (!getenv('KONSOLE_VERSION') || (int) getenv('KONSOLE_VERSION') > 201100);
|
||||
}
|
||||
|
||||
if (null !== $this->foreground) {
|
||||
$setCodes[] = $this->foreground['set'];
|
||||
$unsetCodes[] = $this->foreground['unset'];
|
||||
@@ -167,11 +178,14 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
|
||||
$setCodes[] = $this->background['set'];
|
||||
$unsetCodes[] = $this->background['unset'];
|
||||
}
|
||||
if (\count($this->options)) {
|
||||
foreach ($this->options as $option) {
|
||||
$setCodes[] = $option['set'];
|
||||
$unsetCodes[] = $option['unset'];
|
||||
}
|
||||
|
||||
foreach ($this->options as $option) {
|
||||
$setCodes[] = $option['set'];
|
||||
$unsetCodes[] = $option['unset'];
|
||||
}
|
||||
|
||||
if (null !== $this->href && $this->handlesHrefGracefully) {
|
||||
$text = "\033]8;;$this->href\033\\$text\033]8;;\033\\";
|
||||
}
|
||||
|
||||
if (0 === \count($setCodes)) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -107,12 +107,7 @@ class DebugFormatterHelper extends Helper
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $id The id of the formatting session
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getBorder($id)
|
||||
private function getBorder(string $id): string
|
||||
{
|
||||
return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,7 @@ class DescriptorHelper extends Helper
|
||||
* * format: string, the output format name
|
||||
* * raw_text: boolean, sets output type as raw
|
||||
*
|
||||
* @param OutputInterface $output
|
||||
* @param object $object
|
||||
* @param array $options
|
||||
* @param object $object
|
||||
*
|
||||
* @throws InvalidArgumentException when the given format is not supported
|
||||
*/
|
||||
@@ -72,8 +70,7 @@ class DescriptorHelper extends Helper
|
||||
/**
|
||||
* Registers a descriptor.
|
||||
*
|
||||
* @param string $format
|
||||
* @param DescriptorInterface $descriptor
|
||||
* @param string $format
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
|
||||
64
vendor/symfony/console/Helper/Dumper.php
vendored
Normal file
64
vendor/symfony/console/Helper/Dumper.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\VarDumper\Cloner\ClonerInterface;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
use Symfony\Component\VarDumper\Dumper\CliDumper;
|
||||
|
||||
/**
|
||||
* @author Roland Franssen <franssen.roland@gmail.com>
|
||||
*/
|
||||
final class Dumper
|
||||
{
|
||||
private $output;
|
||||
private $dumper;
|
||||
private $cloner;
|
||||
private $handler;
|
||||
|
||||
public function __construct(OutputInterface $output, CliDumper $dumper = null, ClonerInterface $cloner = null)
|
||||
{
|
||||
$this->output = $output;
|
||||
$this->dumper = $dumper;
|
||||
$this->cloner = $cloner;
|
||||
|
||||
if (class_exists(CliDumper::class)) {
|
||||
$this->handler = function ($var): string {
|
||||
$dumper = $this->dumper ?? $this->dumper = new CliDumper(null, null, CliDumper::DUMP_LIGHT_ARRAY | CliDumper::DUMP_COMMA_SEPARATOR);
|
||||
$dumper->setColors($this->output->isDecorated());
|
||||
|
||||
return rtrim($dumper->dump(($this->cloner ?? $this->cloner = new VarCloner())->cloneVar($var)->withRefHandles(false), true));
|
||||
};
|
||||
} else {
|
||||
$this->handler = function ($var): string {
|
||||
switch (true) {
|
||||
case null === $var:
|
||||
return 'null';
|
||||
case true === $var:
|
||||
return 'true';
|
||||
case false === $var:
|
||||
return 'false';
|
||||
case \is_string($var):
|
||||
return '"'.$var.'"';
|
||||
default:
|
||||
return rtrim(print_r($var, true));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public function __invoke($var): string
|
||||
{
|
||||
return ($this->handler)($var);
|
||||
}
|
||||
}
|
||||
@@ -54,12 +54,12 @@ class FormatterHelper extends Helper
|
||||
foreach ($messages as $message) {
|
||||
$message = OutputFormatter::escape($message);
|
||||
$lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
|
||||
$len = max($this->strlen($message) + ($large ? 4 : 2), $len);
|
||||
$len = max(self::strlen($message) + ($large ? 4 : 2), $len);
|
||||
}
|
||||
|
||||
$messages = $large ? [str_repeat(' ', $len)] : [];
|
||||
for ($i = 0; isset($lines[$i]); ++$i) {
|
||||
$messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
|
||||
$messages[] = $lines[$i].str_repeat(' ', $len - self::strlen($lines[$i]));
|
||||
}
|
||||
if ($large) {
|
||||
$messages[] = str_repeat(' ', $len);
|
||||
@@ -83,17 +83,13 @@ class FormatterHelper extends Helper
|
||||
*/
|
||||
public function truncate($message, $length, $suffix = '...')
|
||||
{
|
||||
$computedLength = $length - $this->strlen($suffix);
|
||||
$computedLength = $length - self::strlen($suffix);
|
||||
|
||||
if ($computedLength > $this->strlen($message)) {
|
||||
if ($computedLength > self::strlen($message)) {
|
||||
return $message;
|
||||
}
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($message, null, true)) {
|
||||
return substr($message, 0, $length).$suffix;
|
||||
}
|
||||
|
||||
return mb_substr($message, 0, $length, $encoding).$suffix;
|
||||
return self::substr($message, 0, $length).$suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
4
vendor/symfony/console/Helper/Helper.php
vendored
4
vendor/symfony/console/Helper/Helper.php
vendored
@@ -47,6 +47,8 @@ abstract class Helper implements HelperInterface
|
||||
*/
|
||||
public static function strlen($string)
|
||||
{
|
||||
$string = (string) $string;
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string, null, true)) {
|
||||
return \strlen($string);
|
||||
}
|
||||
@@ -65,6 +67,8 @@ abstract class Helper implements HelperInterface
|
||||
*/
|
||||
public static function substr($string, $from, $length = null)
|
||||
{
|
||||
$string = (string) $string;
|
||||
|
||||
if (false === $encoding = mb_detect_encoding($string, null, true)) {
|
||||
return substr($string, $from, $length);
|
||||
}
|
||||
|
||||
6
vendor/symfony/console/Helper/HelperSet.php
vendored
6
vendor/symfony/console/Helper/HelperSet.php
vendored
@@ -40,8 +40,7 @@ class HelperSet implements \IteratorAggregate
|
||||
/**
|
||||
* Sets a helper.
|
||||
*
|
||||
* @param HelperInterface $helper The helper instance
|
||||
* @param string $alias An alias
|
||||
* @param string $alias An alias
|
||||
*/
|
||||
public function set(HelperInterface $helper, $alias = null)
|
||||
{
|
||||
@@ -99,8 +98,9 @@ class HelperSet implements \IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Helper[]
|
||||
* @return \Traversable<Helper>
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function getIterator()
|
||||
{
|
||||
return new \ArrayIterator($this->helpers);
|
||||
|
||||
32
vendor/symfony/console/Helper/ProcessHelper.php
vendored
32
vendor/symfony/console/Helper/ProcessHelper.php
vendored
@@ -28,17 +28,20 @@ class ProcessHelper extends Helper
|
||||
/**
|
||||
* Runs an external process.
|
||||
*
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
* @param array|Process $cmd An instance of Process or an array of the command and arguments
|
||||
* @param string|null $error An error message that must be displayed if something went wrong
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
* @param int $verbosity The threshold for verbosity
|
||||
* @param array|Process $cmd An instance of Process or an array of the command and arguments
|
||||
* @param string|null $error An error message that must be displayed if something went wrong
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
* @param int $verbosity The threshold for verbosity
|
||||
*
|
||||
* @return Process The process that ran
|
||||
*/
|
||||
public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
|
||||
{
|
||||
if (!class_exists(Process::class)) {
|
||||
throw new \LogicException('The ProcessHelper cannot be run as the Process component is not installed. Try running "compose require symfony/process".');
|
||||
}
|
||||
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
}
|
||||
@@ -50,7 +53,7 @@ class ProcessHelper extends Helper
|
||||
}
|
||||
|
||||
if (!\is_array($cmd)) {
|
||||
@trigger_error(sprintf('Passing a command as a string to "%s()" is deprecated since Symfony 4.2, pass it the command as an array of arguments instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('Passing a command as a string to "%s()" is deprecated since Symfony 4.2, pass it the command as an array of arguments instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
$cmd = [method_exists(Process::class, 'fromShellCommandline') ? Process::fromShellCommandline($cmd) : new Process($cmd)];
|
||||
}
|
||||
|
||||
@@ -92,11 +95,10 @@ class ProcessHelper extends Helper
|
||||
* This is identical to run() except that an exception is thrown if the process
|
||||
* exits with a non-zero exit code.
|
||||
*
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
* @param string|Process $cmd An instance of Process or a command to run
|
||||
* @param string|null $error An error message that must be displayed if something went wrong
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
* @param array|Process $cmd An instance of Process or a command to run
|
||||
* @param string|null $error An error message that must be displayed if something went wrong
|
||||
* @param callable|null $callback A PHP callback to run whenever there is some
|
||||
* output available on STDOUT or STDERR
|
||||
*
|
||||
* @return Process The process that ran
|
||||
*
|
||||
@@ -118,10 +120,6 @@ class ProcessHelper extends Helper
|
||||
/**
|
||||
* Wraps a Process callback to add debugging output.
|
||||
*
|
||||
* @param OutputInterface $output An OutputInterface interface
|
||||
* @param Process $process The Process
|
||||
* @param callable|null $callback A PHP callable
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null)
|
||||
@@ -141,7 +139,7 @@ class ProcessHelper extends Helper
|
||||
};
|
||||
}
|
||||
|
||||
private function escapeString($str)
|
||||
private function escapeString(string $str): string
|
||||
{
|
||||
return str_replace('<', '\\<', $str);
|
||||
}
|
||||
|
||||
112
vendor/symfony/console/Helper/ProgressBar.php
vendored
112
vendor/symfony/console/Helper/ProgressBar.php
vendored
@@ -32,6 +32,10 @@ final class ProgressBar
|
||||
private $format;
|
||||
private $internalFormat;
|
||||
private $redrawFreq = 1;
|
||||
private $writeCount;
|
||||
private $lastWriteTime;
|
||||
private $minSecondsBetweenRedraws = 0;
|
||||
private $maxSecondsBetweenRedraws = 1;
|
||||
private $output;
|
||||
private $step = 0;
|
||||
private $max;
|
||||
@@ -42,16 +46,15 @@ final class ProgressBar
|
||||
private $messages = [];
|
||||
private $overwrite = true;
|
||||
private $terminal;
|
||||
private $firstRun = true;
|
||||
private $previousMessage;
|
||||
|
||||
private static $formatters;
|
||||
private static $formats;
|
||||
|
||||
/**
|
||||
* @param OutputInterface $output An OutputInterface instance
|
||||
* @param int $max Maximum steps (0 if unknown)
|
||||
* @param int $max Maximum steps (0 if unknown)
|
||||
*/
|
||||
public function __construct(OutputInterface $output, int $max = 0)
|
||||
public function __construct(OutputInterface $output, int $max = 0, float $minSecondsBetweenRedraws = 0.1)
|
||||
{
|
||||
if ($output instanceof ConsoleOutputInterface) {
|
||||
$output = $output->getErrorOutput();
|
||||
@@ -61,12 +64,17 @@ final class ProgressBar
|
||||
$this->setMaxSteps($max);
|
||||
$this->terminal = new Terminal();
|
||||
|
||||
if (0 < $minSecondsBetweenRedraws) {
|
||||
$this->redrawFreq = null;
|
||||
$this->minSecondsBetweenRedraws = $minSecondsBetweenRedraws;
|
||||
}
|
||||
|
||||
if (!$this->output->isDecorated()) {
|
||||
// disable overwrite when output does not support ANSI codes.
|
||||
$this->overwrite = false;
|
||||
|
||||
// set a reasonable redraw frequency so output isn't flooded
|
||||
$this->setRedrawFrequency($max / 10);
|
||||
$this->redrawFreq = null;
|
||||
}
|
||||
|
||||
$this->startTime = time();
|
||||
@@ -102,7 +110,7 @@ final class ProgressBar
|
||||
self::$formatters = self::initPlaceholderFormatters();
|
||||
}
|
||||
|
||||
return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
|
||||
return self::$formatters[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,7 +143,7 @@ final class ProgressBar
|
||||
self::$formats = self::initFormats();
|
||||
}
|
||||
|
||||
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
|
||||
return self::$formats[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,6 +191,11 @@ final class ProgressBar
|
||||
return $this->percent;
|
||||
}
|
||||
|
||||
public function getBarOffset(): int
|
||||
{
|
||||
return floor($this->max ? $this->percent * $this->barWidth : (null === $this->redrawFreq ? (int) (min(5, $this->barWidth / 15) * $this->writeCount) : $this->step) % $this->barWidth);
|
||||
}
|
||||
|
||||
public function setBarWidth(int $size)
|
||||
{
|
||||
$this->barWidth = max(1, $size);
|
||||
@@ -236,11 +249,39 @@ final class ProgressBar
|
||||
/**
|
||||
* Sets the redraw frequency.
|
||||
*
|
||||
* @param int|float $freq The frequency in steps
|
||||
* @param int|null $freq The frequency in steps
|
||||
*/
|
||||
public function setRedrawFrequency(int $freq)
|
||||
public function setRedrawFrequency(?int $freq)
|
||||
{
|
||||
$this->redrawFreq = max($freq, 1);
|
||||
$this->redrawFreq = null !== $freq ? max(1, $freq) : null;
|
||||
}
|
||||
|
||||
public function minSecondsBetweenRedraws(float $seconds): void
|
||||
{
|
||||
$this->minSecondsBetweenRedraws = $seconds;
|
||||
}
|
||||
|
||||
public function maxSecondsBetweenRedraws(float $seconds): void
|
||||
{
|
||||
$this->maxSecondsBetweenRedraws = $seconds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator that will automatically update the progress bar when iterated.
|
||||
*
|
||||
* @param int|null $max Number of steps to complete the bar (0 if indeterminate), if null it will be inferred from $iterable
|
||||
*/
|
||||
public function iterate(iterable $iterable, int $max = null): iterable
|
||||
{
|
||||
$this->start($max ?? (is_countable($iterable) ? \count($iterable) : 0));
|
||||
|
||||
foreach ($iterable as $key => $value) {
|
||||
yield $key => $value;
|
||||
|
||||
$this->advance();
|
||||
}
|
||||
|
||||
$this->finish();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -287,11 +328,27 @@ final class ProgressBar
|
||||
$step = 0;
|
||||
}
|
||||
|
||||
$prevPeriod = (int) ($this->step / $this->redrawFreq);
|
||||
$currPeriod = (int) ($step / $this->redrawFreq);
|
||||
$redrawFreq = $this->redrawFreq ?? (($this->max ?: 10) / 10);
|
||||
$prevPeriod = (int) ($this->step / $redrawFreq);
|
||||
$currPeriod = (int) ($step / $redrawFreq);
|
||||
$this->step = $step;
|
||||
$this->percent = $this->max ? (float) $this->step / $this->max : 0;
|
||||
if ($prevPeriod !== $currPeriod || $this->max === $step) {
|
||||
$timeInterval = microtime(true) - $this->lastWriteTime;
|
||||
|
||||
// Draw regardless of other limits
|
||||
if ($this->max === $step) {
|
||||
$this->display();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Throttling
|
||||
if ($timeInterval < $this->minSecondsBetweenRedraws) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw each step period, but not too late
|
||||
if ($prevPeriod !== $currPeriod || $timeInterval >= $this->maxSecondsBetweenRedraws) {
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
@@ -375,11 +432,24 @@ final class ProgressBar
|
||||
*/
|
||||
private function overwrite(string $message): void
|
||||
{
|
||||
if ($this->previousMessage === $message) {
|
||||
return;
|
||||
}
|
||||
|
||||
$originalMessage = $message;
|
||||
|
||||
if ($this->overwrite) {
|
||||
if (!$this->firstRun) {
|
||||
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 {
|
||||
// Erase previous lines
|
||||
if ($this->formatLineCount > 0) {
|
||||
@@ -391,12 +461,14 @@ final class ProgressBar
|
||||
}
|
||||
}
|
||||
} elseif ($this->step > 0) {
|
||||
$message = PHP_EOL.$message;
|
||||
$message = \PHP_EOL.$message;
|
||||
}
|
||||
|
||||
$this->firstRun = false;
|
||||
$this->previousMessage = $originalMessage;
|
||||
$this->lastWriteTime = microtime(true);
|
||||
|
||||
$this->output->write($message);
|
||||
++$this->writeCount;
|
||||
}
|
||||
|
||||
private function determineBestFormat(): string
|
||||
@@ -418,7 +490,7 @@ final class ProgressBar
|
||||
{
|
||||
return [
|
||||
'bar' => function (self $bar, OutputInterface $output) {
|
||||
$completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
|
||||
$completeBars = $bar->getBarOffset();
|
||||
$display = str_repeat($bar->getBarCharacter(), $completeBars);
|
||||
if ($completeBars < $bar->getBarWidth()) {
|
||||
$emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
|
||||
@@ -460,7 +532,7 @@ final class ProgressBar
|
||||
return Helper::formatMemory(memory_get_usage(true));
|
||||
},
|
||||
'current' => function (self $bar) {
|
||||
return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
|
||||
return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', \STR_PAD_LEFT);
|
||||
},
|
||||
'max' => function (self $bar) {
|
||||
return $bar->getMaxSteps();
|
||||
|
||||
@@ -34,10 +34,9 @@ class ProgressIndicator
|
||||
private static $formats;
|
||||
|
||||
/**
|
||||
* @param OutputInterface $output
|
||||
* @param string|null $format Indicator format
|
||||
* @param int $indicatorChangeInterval Change interval in milliseconds
|
||||
* @param array|null $indicatorValues Animated indicator characters
|
||||
* @param string|null $format Indicator format
|
||||
* @param int $indicatorChangeInterval Change interval in milliseconds
|
||||
* @param array|null $indicatorValues Animated indicator characters
|
||||
*/
|
||||
public function __construct(OutputInterface $output, string $format = null, int $indicatorChangeInterval = 100, array $indicatorValues = null)
|
||||
{
|
||||
@@ -150,7 +149,7 @@ class ProgressIndicator
|
||||
self::$formats = self::initFormats();
|
||||
}
|
||||
|
||||
return isset(self::$formats[$name]) ? self::$formats[$name] : null;
|
||||
return self::$formats[$name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,7 +182,7 @@ class ProgressIndicator
|
||||
self::$formatters = self::initPlaceholderFormatters();
|
||||
}
|
||||
|
||||
return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
|
||||
return self::$formatters[$name] ?? null;
|
||||
}
|
||||
|
||||
private function display()
|
||||
@@ -192,18 +191,16 @@ class ProgressIndicator
|
||||
return;
|
||||
}
|
||||
|
||||
$self = $this;
|
||||
|
||||
$this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
|
||||
if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
|
||||
return $formatter($self);
|
||||
$this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
|
||||
if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) {
|
||||
return $formatter($this);
|
||||
}
|
||||
|
||||
return $matches[0];
|
||||
}, $this->format));
|
||||
}, $this->format ?? ''));
|
||||
}
|
||||
|
||||
private function determineBestFormat()
|
||||
private function determineBestFormat(): string
|
||||
{
|
||||
switch ($this->output->getVerbosity()) {
|
||||
// OutputInterface::VERBOSITY_QUIET: display is disabled anyway
|
||||
@@ -230,12 +227,12 @@ class ProgressIndicator
|
||||
}
|
||||
}
|
||||
|
||||
private function getCurrentTimeInMilliseconds()
|
||||
private function getCurrentTimeInMilliseconds(): float
|
||||
{
|
||||
return round(microtime(true) * 1000);
|
||||
}
|
||||
|
||||
private static function initPlaceholderFormatters()
|
||||
private static function initPlaceholderFormatters(): array
|
||||
{
|
||||
return [
|
||||
'indicator' => function (self $indicator) {
|
||||
@@ -253,7 +250,7 @@ class ProgressIndicator
|
||||
];
|
||||
}
|
||||
|
||||
private static function initFormats()
|
||||
private static function initFormats(): array
|
||||
{
|
||||
return [
|
||||
'normal' => ' %indicator% %message%',
|
||||
|
||||
314
vendor/symfony/console/Helper/QuestionHelper.php
vendored
314
vendor/symfony/console/Helper/QuestionHelper.php
vendored
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Component\Console\Helper;
|
||||
|
||||
use Symfony\Component\Console\Exception\MissingInputException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
@@ -21,6 +22,7 @@ use Symfony\Component\Console\Output\ConsoleSectionOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Console\Terminal;
|
||||
|
||||
/**
|
||||
* The QuestionHelper class provides helpers to interact with the user.
|
||||
@@ -31,7 +33,8 @@ class QuestionHelper extends Helper
|
||||
{
|
||||
private $inputStream;
|
||||
private static $shell;
|
||||
private static $stty;
|
||||
private static $stty = true;
|
||||
private static $stdinIsInteractive;
|
||||
|
||||
/**
|
||||
* Asks a question to the user.
|
||||
@@ -47,44 +50,32 @@ class QuestionHelper extends Helper
|
||||
}
|
||||
|
||||
if (!$input->isInteractive()) {
|
||||
$default = $question->getDefault();
|
||||
|
||||
if (null === $default) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
if ($validator = $question->getValidator()) {
|
||||
return \call_user_func($question->getValidator(), $default);
|
||||
} elseif ($question instanceof ChoiceQuestion) {
|
||||
$choices = $question->getChoices();
|
||||
|
||||
if (!$question->isMultiselect()) {
|
||||
return isset($choices[$default]) ? $choices[$default] : $default;
|
||||
}
|
||||
|
||||
$default = explode(',', $default);
|
||||
foreach ($default as $k => $v) {
|
||||
$v = trim($v);
|
||||
$default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $default;
|
||||
return $this->getDefaultAnswer($question);
|
||||
}
|
||||
|
||||
if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) {
|
||||
$this->inputStream = $stream;
|
||||
}
|
||||
|
||||
if (!$question->getValidator()) {
|
||||
return $this->doAsk($output, $question);
|
||||
try {
|
||||
if (!$question->getValidator()) {
|
||||
return $this->doAsk($output, $question);
|
||||
}
|
||||
|
||||
$interviewer = function () use ($output, $question) {
|
||||
return $this->doAsk($output, $question);
|
||||
};
|
||||
|
||||
return $this->validateAttempts($interviewer, $output, $question);
|
||||
} catch (MissingInputException $exception) {
|
||||
$input->setInteractive(false);
|
||||
|
||||
if (null === $fallbackOutput = $this->getDefaultAnswer($question)) {
|
||||
throw $exception;
|
||||
}
|
||||
|
||||
return $fallbackOutput;
|
||||
}
|
||||
|
||||
$interviewer = function () use ($output, $question) {
|
||||
return $this->doAsk($output, $question);
|
||||
};
|
||||
|
||||
return $this->validateAttempts($interviewer, $output, $question);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,7 +97,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
|
||||
*/
|
||||
@@ -114,14 +105,15 @@ class QuestionHelper extends Helper
|
||||
{
|
||||
$this->writePrompt($output, $question);
|
||||
|
||||
$inputStream = $this->inputStream ?: STDIN;
|
||||
$autocomplete = $question->getAutocompleterValues();
|
||||
$inputStream = $this->inputStream ?: \STDIN;
|
||||
$autocomplete = $question->getAutocompleterCallback();
|
||||
|
||||
if (null === $autocomplete || !$this->hasSttyAvailable()) {
|
||||
if (null === $autocomplete || !self::$stty || !Terminal::hasSttyAvailable()) {
|
||||
$ret = false;
|
||||
if ($question->isHidden()) {
|
||||
try {
|
||||
$ret = trim($this->getHiddenResponse($output, $inputStream));
|
||||
$hiddenResponse = $this->getHiddenResponse($output, $inputStream, $question->isTrimmable());
|
||||
$ret = $question->isTrimmable() ? trim($hiddenResponse) : $hiddenResponse;
|
||||
} catch (RuntimeException $e) {
|
||||
if (!$question->isHiddenFallback()) {
|
||||
throw $e;
|
||||
@@ -130,14 +122,19 @@ class QuestionHelper extends Helper
|
||||
}
|
||||
|
||||
if (false === $ret) {
|
||||
$cp = $this->setIOCodepage();
|
||||
$ret = fgets($inputStream, 4096);
|
||||
$ret = $this->resetIOCodepage($cp, $ret);
|
||||
if (false === $ret) {
|
||||
throw new RuntimeException('Aborted.');
|
||||
throw new MissingInputException('Aborted.');
|
||||
}
|
||||
if ($question->isTrimmable()) {
|
||||
$ret = trim($ret);
|
||||
}
|
||||
$ret = trim($ret);
|
||||
}
|
||||
} else {
|
||||
$ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
|
||||
$autocomplete = $this->autocomplete($output, $question, $inputStream, $autocomplete);
|
||||
$ret = $question->isTrimmable() ? trim($autocomplete) : $autocomplete;
|
||||
}
|
||||
|
||||
if ($output instanceof ConsoleSectionOutput) {
|
||||
@@ -153,6 +150,36 @@ class QuestionHelper extends Helper
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
private function getDefaultAnswer(Question $question)
|
||||
{
|
||||
$default = $question->getDefault();
|
||||
|
||||
if (null === $default) {
|
||||
return $default;
|
||||
}
|
||||
|
||||
if ($validator = $question->getValidator()) {
|
||||
return \call_user_func($question->getValidator(), $default);
|
||||
} elseif ($question instanceof ChoiceQuestion) {
|
||||
$choices = $question->getChoices();
|
||||
|
||||
if (!$question->isMultiselect()) {
|
||||
return $choices[$default] ?? $default;
|
||||
}
|
||||
|
||||
$default = explode(',', $default);
|
||||
foreach ($default as $k => $v) {
|
||||
$v = $question->isTrimmable() ? trim($v) : $v;
|
||||
$default[$k] = $choices[$v] ?? $v;
|
||||
}
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the question prompt.
|
||||
*/
|
||||
@@ -161,15 +188,9 @@ class QuestionHelper extends Helper
|
||||
$message = $question->getQuestion();
|
||||
|
||||
if ($question instanceof ChoiceQuestion) {
|
||||
$maxWidth = max(array_map([$this, 'strlen'], array_keys($question->getChoices())));
|
||||
|
||||
$messages = (array) $question->getQuestion();
|
||||
foreach ($question->getChoices() as $key => $value) {
|
||||
$width = $maxWidth - $this->strlen($key);
|
||||
$messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
|
||||
}
|
||||
|
||||
$output->writeln($messages);
|
||||
$output->writeln(array_merge([
|
||||
$question->getQuestion(),
|
||||
], $this->formatChoiceQuestionChoices($question, 'info')));
|
||||
|
||||
$message = $question->getPrompt();
|
||||
}
|
||||
@@ -177,6 +198,26 @@ class QuestionHelper extends Helper
|
||||
$output->write($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tag
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
protected function formatChoiceQuestionChoices(ChoiceQuestion $question, $tag)
|
||||
{
|
||||
$messages = [];
|
||||
|
||||
$maxWidth = max(array_map([__CLASS__, 'strlen'], array_keys($choices = $question->getChoices())));
|
||||
|
||||
foreach ($choices as $key => $value) {
|
||||
$padding = str_repeat(' ', $maxWidth - self::strlen($key));
|
||||
|
||||
$messages[] = sprintf(" [<$tag>%s$padding</$tag>] %s", $key, $value);
|
||||
}
|
||||
|
||||
return $messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs an error message.
|
||||
*/
|
||||
@@ -194,18 +235,16 @@ class QuestionHelper extends Helper
|
||||
/**
|
||||
* Autocompletes a question.
|
||||
*
|
||||
* @param OutputInterface $output
|
||||
* @param Question $question
|
||||
* @param resource $inputStream
|
||||
* @param resource $inputStream
|
||||
*/
|
||||
private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete): string
|
||||
private function autocomplete(OutputInterface $output, Question $question, $inputStream, callable $autocomplete): string
|
||||
{
|
||||
$fullChoice = '';
|
||||
$ret = '';
|
||||
|
||||
$i = 0;
|
||||
$ofs = -1;
|
||||
$matches = $autocomplete;
|
||||
$matches = $autocomplete($ret);
|
||||
$numMatches = \count($matches);
|
||||
|
||||
$sttyMode = shell_exec('stty -g');
|
||||
@@ -223,25 +262,25 @@ class QuestionHelper extends Helper
|
||||
// as opposed to fgets(), fread() returns an empty string when the stream content is empty, not false.
|
||||
if (false === $c || ('' === $ret && '' === $c && null === $question->getDefault())) {
|
||||
shell_exec(sprintf('stty %s', $sttyMode));
|
||||
throw new RuntimeException('Aborted.');
|
||||
throw new MissingInputException('Aborted.');
|
||||
} elseif ("\177" === $c) { // Backspace Character
|
||||
if (0 === $numMatches && 0 !== $i) {
|
||||
--$i;
|
||||
$fullChoice = substr($fullChoice, 0, -1);
|
||||
$fullChoice = self::substr($fullChoice, 0, $i);
|
||||
// Move cursor backwards
|
||||
$output->write("\033[1D");
|
||||
}
|
||||
|
||||
if (0 === $i) {
|
||||
$ofs = -1;
|
||||
$matches = $autocomplete;
|
||||
$matches = $autocomplete($ret);
|
||||
$numMatches = \count($matches);
|
||||
} else {
|
||||
$numMatches = 0;
|
||||
}
|
||||
|
||||
// Pop the last character off the end of our string
|
||||
$ret = substr($ret, 0, $i);
|
||||
$ret = self::substr($ret, 0, $i);
|
||||
} elseif ("\033" === $c) {
|
||||
// Did we read an escape sequence?
|
||||
$c .= fread($inputStream, 2);
|
||||
@@ -262,12 +301,21 @@ class QuestionHelper extends Helper
|
||||
} elseif (\ord($c) < 32) {
|
||||
if ("\t" === $c || "\n" === $c) {
|
||||
if ($numMatches > 0 && -1 !== $ofs) {
|
||||
$ret = $matches[$ofs];
|
||||
$ret = (string) $matches[$ofs];
|
||||
// Echo out remaining chars for current match
|
||||
$remainingCharacters = substr($ret, \strlen(trim($this->mostRecentlyEnteredValue($fullChoice))));
|
||||
$output->write($remainingCharacters);
|
||||
$fullChoice .= $remainingCharacters;
|
||||
$i = \strlen($fullChoice);
|
||||
$i = (false === $encoding = mb_detect_encoding($fullChoice, null, true)) ? \strlen($fullChoice) : mb_strlen($fullChoice, $encoding);
|
||||
|
||||
$matches = array_filter(
|
||||
$autocomplete($ret),
|
||||
function ($match) use ($ret) {
|
||||
return '' === $ret || str_starts_with($match, $ret);
|
||||
}
|
||||
);
|
||||
$numMatches = \count($matches);
|
||||
$ofs = -1;
|
||||
}
|
||||
|
||||
if ("\n" === $c) {
|
||||
@@ -298,9 +346,9 @@ class QuestionHelper extends Helper
|
||||
$numMatches = 0;
|
||||
$ofs = 0;
|
||||
|
||||
foreach ($autocomplete as $value) {
|
||||
foreach ($autocomplete($ret) as $value) {
|
||||
// If typed characters match the beginning chunk of value (e.g. [AcmeDe]moBundle)
|
||||
if (0 === strpos($value, $tempRet)) {
|
||||
if (str_starts_with($value, $tempRet)) {
|
||||
$matches[$numMatches++] = $value;
|
||||
}
|
||||
}
|
||||
@@ -326,15 +374,15 @@ class QuestionHelper extends Helper
|
||||
return $fullChoice;
|
||||
}
|
||||
|
||||
private function mostRecentlyEnteredValue($entered)
|
||||
private function mostRecentlyEnteredValue(string $entered): string
|
||||
{
|
||||
// Determine the most recent value that the user entered
|
||||
if (false === strpos($entered, ',')) {
|
||||
if (!str_contains($entered, ',')) {
|
||||
return $entered;
|
||||
}
|
||||
|
||||
$choices = explode(',', $entered);
|
||||
if (\strlen($lastChoice = trim($choices[\count($choices) - 1])) > 0) {
|
||||
if ('' !== $lastChoice = trim($choices[\count($choices) - 1])) {
|
||||
return $lastChoice;
|
||||
}
|
||||
|
||||
@@ -344,12 +392,12 @@ class QuestionHelper extends Helper
|
||||
/**
|
||||
* Gets a hidden response from user.
|
||||
*
|
||||
* @param OutputInterface $output An Output instance
|
||||
* @param resource $inputStream The handler resource
|
||||
* @param resource $inputStream The handler resource
|
||||
* @param bool $trimmable Is the answer trimmable
|
||||
*
|
||||
* @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
|
||||
*/
|
||||
private function getHiddenResponse(OutputInterface $output, $inputStream): string
|
||||
private function getHiddenResponse(OutputInterface $output, $inputStream, bool $trimmable = true): string
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
|
||||
@@ -361,7 +409,8 @@ class QuestionHelper extends Helper
|
||||
$exe = $tmpExe;
|
||||
}
|
||||
|
||||
$value = rtrim(shell_exec($exe));
|
||||
$sExec = shell_exec('"'.$exe.'"');
|
||||
$value = $trimmable ? rtrim($sExec) : $sExec;
|
||||
$output->writeln('');
|
||||
|
||||
if (isset($tmpExe)) {
|
||||
@@ -371,41 +420,34 @@ class QuestionHelper extends Helper
|
||||
return $value;
|
||||
}
|
||||
|
||||
if ($this->hasSttyAvailable()) {
|
||||
if (self::$stty && Terminal::hasSttyAvailable()) {
|
||||
$sttyMode = shell_exec('stty -g');
|
||||
|
||||
shell_exec('stty -echo');
|
||||
$value = fgets($inputStream, 4096);
|
||||
} elseif ($this->isInteractiveInput($inputStream)) {
|
||||
throw new RuntimeException('Unable to hide the response.');
|
||||
}
|
||||
|
||||
$value = fgets($inputStream, 4096);
|
||||
|
||||
if (self::$stty && Terminal::hasSttyAvailable()) {
|
||||
shell_exec(sprintf('stty %s', $sttyMode));
|
||||
}
|
||||
|
||||
if (false === $value) {
|
||||
throw new RuntimeException('Aborted.');
|
||||
}
|
||||
|
||||
if (false === $value) {
|
||||
throw new MissingInputException('Aborted.');
|
||||
}
|
||||
if ($trimmable) {
|
||||
$value = trim($value);
|
||||
$output->writeln('');
|
||||
|
||||
return $value;
|
||||
}
|
||||
$output->writeln('');
|
||||
|
||||
if (false !== $shell = $this->getShell()) {
|
||||
$readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
|
||||
$command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
|
||||
$value = rtrim(shell_exec($command));
|
||||
$output->writeln('');
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
throw new RuntimeException('Unable to hide the response.');
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates an attempt.
|
||||
*
|
||||
* @param callable $interviewer A callable that will ask for a question and return the result
|
||||
* @param OutputInterface $output An Output instance
|
||||
* @param Question $question A Question instance
|
||||
* @param callable $interviewer A callable that will ask for a question and return the result
|
||||
*
|
||||
* @return mixed The validated response
|
||||
*
|
||||
@@ -415,6 +457,7 @@ class QuestionHelper extends Helper
|
||||
{
|
||||
$error = null;
|
||||
$attempts = $question->getMaxAttempts();
|
||||
|
||||
while (null === $attempts || $attempts--) {
|
||||
if (null !== $error) {
|
||||
$this->writeError($output, $error);
|
||||
@@ -431,44 +474,67 @@ class QuestionHelper extends Helper
|
||||
throw $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a valid unix shell.
|
||||
*
|
||||
* @return string|bool The valid shell name, false in case no valid shell is found
|
||||
*/
|
||||
private function getShell()
|
||||
private function isInteractiveInput($inputStream): bool
|
||||
{
|
||||
if (null !== self::$shell) {
|
||||
return self::$shell;
|
||||
if ('php://stdin' !== (stream_get_meta_data($inputStream)['uri'] ?? null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::$shell = false;
|
||||
if (null !== self::$stdinIsInteractive) {
|
||||
return self::$stdinIsInteractive;
|
||||
}
|
||||
|
||||
if (file_exists('/usr/bin/env')) {
|
||||
// handle other OSs with bash/zsh/ksh/csh if available to hide the answer
|
||||
$test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
|
||||
foreach (['bash', 'zsh', 'ksh', 'csh'] as $sh) {
|
||||
if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
|
||||
self::$shell = $sh;
|
||||
break;
|
||||
}
|
||||
if (\function_exists('stream_isatty')) {
|
||||
return self::$stdinIsInteractive = @stream_isatty(fopen('php://stdin', 'r'));
|
||||
}
|
||||
|
||||
if (\function_exists('posix_isatty')) {
|
||||
return self::$stdinIsInteractive = @posix_isatty(fopen('php://stdin', 'r'));
|
||||
}
|
||||
|
||||
if (!\function_exists('exec')) {
|
||||
return self::$stdinIsInteractive = true;
|
||||
}
|
||||
|
||||
exec('stty 2> /dev/null', $output, $status);
|
||||
|
||||
return self::$stdinIsInteractive = 1 !== $status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 self::$shell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether Stty is available or not.
|
||||
*/
|
||||
private function hasSttyAvailable(): bool
|
||||
{
|
||||
if (null !== self::$stty) {
|
||||
return self::$stty;
|
||||
}
|
||||
|
||||
exec('stty 2>&1', $output, $exitcode);
|
||||
|
||||
return self::$stty = 0 === $exitcode;
|
||||
return $input;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,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;
|
||||
|
||||
@@ -68,15 +68,15 @@ class SymfonyQuestionHelper extends QuestionHelper
|
||||
|
||||
$output->writeln($text);
|
||||
|
||||
if ($question instanceof ChoiceQuestion) {
|
||||
$width = max(array_map('strlen', array_keys($question->getChoices())));
|
||||
$prompt = ' > ';
|
||||
|
||||
foreach ($question->getChoices() as $key => $value) {
|
||||
$output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
|
||||
}
|
||||
if ($question instanceof ChoiceQuestion) {
|
||||
$output->writeln($this->formatChoiceQuestionChoices($question, 'comment'));
|
||||
|
||||
$prompt = $question->getPrompt();
|
||||
}
|
||||
|
||||
$output->write(' > ');
|
||||
$output->write($prompt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
117
vendor/symfony/console/Helper/Table.php
vendored
117
vendor/symfony/console/Helper/Table.php
vendored
@@ -48,6 +48,7 @@ class Table
|
||||
* Table rows.
|
||||
*/
|
||||
private $rows = [];
|
||||
private $horizontal = false;
|
||||
|
||||
/**
|
||||
* Column widths cache.
|
||||
@@ -102,8 +103,7 @@ class Table
|
||||
/**
|
||||
* Sets a style definition.
|
||||
*
|
||||
* @param string $name The style name
|
||||
* @param TableStyle $style A TableStyle instance
|
||||
* @param string $name The style name
|
||||
*/
|
||||
public static function setStyleDefinition($name, TableStyle $style)
|
||||
{
|
||||
@@ -207,8 +207,6 @@ class Table
|
||||
/**
|
||||
* Sets the minimum width of all columns.
|
||||
*
|
||||
* @param array $widths
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setColumnWidths(array $widths)
|
||||
@@ -325,6 +323,13 @@ class Table
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHorizontal(bool $horizontal = true): self
|
||||
{
|
||||
$this->horizontal = $horizontal;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders table to output.
|
||||
*
|
||||
@@ -340,14 +345,36 @@ class Table
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$rows = array_merge($this->headers, [$divider = new TableSeparator()], $this->rows);
|
||||
$divider = new TableSeparator();
|
||||
if ($this->horizontal) {
|
||||
$rows = [];
|
||||
foreach ($this->headers[0] ?? [] as $i => $header) {
|
||||
$rows[$i] = [$header];
|
||||
foreach ($this->rows as $row) {
|
||||
if ($row instanceof TableSeparator) {
|
||||
continue;
|
||||
}
|
||||
if (isset($row[$i])) {
|
||||
$rows[$i][] = $row[$i];
|
||||
} elseif ($rows[$i][0] instanceof TableCell && $rows[$i][0]->getColspan() >= 2) {
|
||||
// Noop, there is a "title"
|
||||
} else {
|
||||
$rows[$i][] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rows = array_merge($this->headers, [$divider], $this->rows);
|
||||
}
|
||||
|
||||
$this->calculateNumberOfColumns($rows);
|
||||
|
||||
$rows = $this->buildTableRows($rows);
|
||||
$this->calculateColumnsWidth($rows);
|
||||
|
||||
$isHeader = true;
|
||||
$isFirstRow = false;
|
||||
$isHeader = !$this->horizontal;
|
||||
$isFirstRow = $this->horizontal;
|
||||
$hasTitle = (bool) $this->headerTitle;
|
||||
foreach ($rows as $row) {
|
||||
if ($divider === $row) {
|
||||
$isHeader = false;
|
||||
@@ -365,15 +392,19 @@ class Table
|
||||
}
|
||||
|
||||
if ($isHeader || $isFirstRow) {
|
||||
if ($isFirstRow) {
|
||||
$this->renderRowSeparator(self::SEPARATOR_TOP_BOTTOM);
|
||||
$isFirstRow = false;
|
||||
} else {
|
||||
$this->renderRowSeparator(self::SEPARATOR_TOP, $this->headerTitle, $this->style->getHeaderTitleFormat());
|
||||
}
|
||||
$this->renderRowSeparator(
|
||||
$isHeader ? self::SEPARATOR_TOP : self::SEPARATOR_TOP_BOTTOM,
|
||||
$hasTitle ? $this->headerTitle : null,
|
||||
$hasTitle ? $this->style->getHeaderTitleFormat() : null
|
||||
);
|
||||
$isFirstRow = false;
|
||||
$hasTitle = false;
|
||||
}
|
||||
if ($this->horizontal) {
|
||||
$this->renderRow($row, $this->style->getCellRowFormat(), $this->style->getCellHeaderFormat());
|
||||
} else {
|
||||
$this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
|
||||
}
|
||||
|
||||
$this->renderRow($row, $isHeader ? $this->style->getCellHeaderFormat() : $this->style->getCellRowFormat());
|
||||
}
|
||||
$this->renderRowSeparator(self::SEPARATOR_BOTTOM, $this->footerTitle, $this->style->getFooterTitleFormat());
|
||||
|
||||
@@ -401,13 +432,13 @@ class Table
|
||||
|
||||
$crossings = $this->style->getCrossingChars();
|
||||
if (self::SEPARATOR_MID === $type) {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
|
||||
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[2], $crossings[8], $crossings[0], $crossings[4]];
|
||||
} elseif (self::SEPARATOR_TOP === $type) {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
|
||||
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[1], $crossings[2], $crossings[3]];
|
||||
} elseif (self::SEPARATOR_TOP_BOTTOM === $type) {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
|
||||
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[9], $crossings[10], $crossings[11]];
|
||||
} else {
|
||||
list($horizontal, $leftChar, $midChar, $rightChar) = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
|
||||
[$horizontal, $leftChar, $midChar, $rightChar] = [$borders[0], $crossings[7], $crossings[6], $crossings[5]];
|
||||
}
|
||||
|
||||
$markup = $leftChar;
|
||||
@@ -425,7 +456,7 @@ class Table
|
||||
$formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...');
|
||||
}
|
||||
|
||||
$titleStart = ($markupLength - $titleLength) / 2;
|
||||
$titleStart = intdiv($markupLength - $titleLength, 2);
|
||||
if (false === mb_detect_encoding($markup, null, true)) {
|
||||
$markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength);
|
||||
} else {
|
||||
@@ -439,7 +470,7 @@ class Table
|
||||
/**
|
||||
* Renders vertical column separator.
|
||||
*/
|
||||
private function renderColumnSeparator($type = self::BORDER_OUTSIDE)
|
||||
private function renderColumnSeparator(int $type = self::BORDER_OUTSIDE): string
|
||||
{
|
||||
$borders = $this->style->getBorderChars();
|
||||
|
||||
@@ -453,13 +484,17 @@ class Table
|
||||
*
|
||||
* | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
|
||||
*/
|
||||
private function renderRow(array $row, string $cellFormat)
|
||||
private function renderRow(array $row, string $cellFormat, string $firstCellFormat = null)
|
||||
{
|
||||
$rowContent = $this->renderColumnSeparator(self::BORDER_OUTSIDE);
|
||||
$columns = $this->getRowColumns($row);
|
||||
$last = \count($columns) - 1;
|
||||
foreach ($columns as $i => $column) {
|
||||
$rowContent .= $this->renderCell($row, $column, $cellFormat);
|
||||
if ($firstCellFormat && 0 === $i) {
|
||||
$rowContent .= $this->renderCell($row, $column, $firstCellFormat);
|
||||
} else {
|
||||
$rowContent .= $this->renderCell($row, $column, $cellFormat);
|
||||
}
|
||||
$rowContent .= $this->renderColumnSeparator($last === $i ? self::BORDER_OUTSIDE : self::BORDER_INSIDE);
|
||||
}
|
||||
$this->output->writeln($rowContent);
|
||||
@@ -468,9 +503,9 @@ class Table
|
||||
/**
|
||||
* Renders table cell with padding.
|
||||
*/
|
||||
private function renderCell(array $row, int $column, string $cellFormat)
|
||||
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).
|
||||
@@ -499,7 +534,7 @@ class Table
|
||||
/**
|
||||
* Calculate number of columns for this table.
|
||||
*/
|
||||
private function calculateNumberOfColumns($rows)
|
||||
private function calculateNumberOfColumns(array $rows)
|
||||
{
|
||||
$columns = [0];
|
||||
foreach ($rows as $row) {
|
||||
@@ -513,7 +548,7 @@ class Table
|
||||
$this->numberOfColumns = max($columns);
|
||||
}
|
||||
|
||||
private function buildTableRows($rows)
|
||||
private function buildTableRows(array $rows): TableRows
|
||||
{
|
||||
/** @var WrappableOutputFormatterInterface $formatter */
|
||||
$formatter = $this->output->getFormatter();
|
||||
@@ -528,7 +563,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)));
|
||||
@@ -541,19 +576,22 @@ class Table
|
||||
if (0 === $lineKey) {
|
||||
$rows[$rowKey][$column] = $line;
|
||||
} else {
|
||||
if (!\array_key_exists($rowKey, $unmergedRows) || !\array_key_exists($lineKey, $unmergedRows[$rowKey])) {
|
||||
$unmergedRows[$rowKey][$lineKey] = $this->copyRow($rows, $rowKey);
|
||||
}
|
||||
$unmergedRows[$rowKey][$lineKey][$column] = $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new TableRows(function () use ($rows, $unmergedRows) {
|
||||
return new TableRows(function () use ($rows, $unmergedRows): \Traversable {
|
||||
foreach ($rows as $rowKey => $row) {
|
||||
yield $this->fillCells($row);
|
||||
yield $row instanceof TableSeparator ? $row : $this->fillCells($row);
|
||||
|
||||
if (isset($unmergedRows[$rowKey])) {
|
||||
foreach ($unmergedRows[$rowKey] as $row) {
|
||||
yield $row;
|
||||
yield $row instanceof TableSeparator ? $row : $this->fillCells($row);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -568,7 +606,9 @@ class Table
|
||||
++$numberOfRows; // Add row for header separator
|
||||
}
|
||||
|
||||
++$numberOfRows; // Add row for footer separator
|
||||
if (\count($this->rows) > 0) {
|
||||
++$numberOfRows; // Add row for footer separator
|
||||
}
|
||||
|
||||
return $numberOfRows;
|
||||
}
|
||||
@@ -583,7 +623,7 @@ class Table
|
||||
$unmergedRows = [];
|
||||
foreach ($rows[$line] as $column => $cell) {
|
||||
if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) {
|
||||
throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell)));
|
||||
throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing "__toString()", "%s" given.', \gettype($cell)));
|
||||
}
|
||||
if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
|
||||
$nbLines = $cell->getRowspan() - 1;
|
||||
@@ -599,7 +639,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()]);
|
||||
if ($nbLines === $unmergedRowKey - $line) {
|
||||
break;
|
||||
@@ -632,9 +672,10 @@ class Table
|
||||
/**
|
||||
* fill cells for a row that contains colspan > 1.
|
||||
*/
|
||||
private function fillCells($row)
|
||||
private function fillCells(iterable $row)
|
||||
{
|
||||
$newRow = [];
|
||||
|
||||
foreach ($row as $column => $cell) {
|
||||
$newRow[] = $cell;
|
||||
if ($cell instanceof TableCell && $cell->getColspan() > 1) {
|
||||
@@ -736,7 +777,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;
|
||||
@@ -751,7 +792,7 @@ class Table
|
||||
$this->numberOfColumns = null;
|
||||
}
|
||||
|
||||
private static function initStyles()
|
||||
private static function initStyles(): array
|
||||
{
|
||||
$borderless = new TableStyle();
|
||||
$borderless
|
||||
@@ -798,7 +839,7 @@ class Table
|
||||
];
|
||||
}
|
||||
|
||||
private function resolveStyle($name)
|
||||
private function resolveStyle($name): TableStyle
|
||||
{
|
||||
if ($name instanceof TableStyle) {
|
||||
return $name;
|
||||
|
||||
2
vendor/symfony/console/Helper/TableRows.php
vendored
2
vendor/symfony/console/Helper/TableRows.php
vendored
@@ -23,7 +23,7 @@ class TableRows implements \IteratorAggregate
|
||||
$this->generator = $generator;
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
public function getIterator(): \Traversable
|
||||
{
|
||||
$g = $this->generator;
|
||||
|
||||
|
||||
18
vendor/symfony/console/Helper/TableStyle.php
vendored
18
vendor/symfony/console/Helper/TableStyle.php
vendored
@@ -46,7 +46,7 @@ class TableStyle
|
||||
private $cellRowFormat = '%s';
|
||||
private $cellRowContentFormat = ' %s ';
|
||||
private $borderFormat = '%s';
|
||||
private $padType = STR_PAD_RIGHT;
|
||||
private $padType = \STR_PAD_RIGHT;
|
||||
|
||||
/**
|
||||
* Sets padding character, used for cell padding.
|
||||
@@ -58,7 +58,7 @@ class TableStyle
|
||||
public function setPaddingChar($paddingChar)
|
||||
{
|
||||
if (!$paddingChar) {
|
||||
throw new LogicException('The padding char must not be empty');
|
||||
throw new LogicException('The padding char must not be empty.');
|
||||
}
|
||||
|
||||
$this->paddingChar = $paddingChar;
|
||||
@@ -112,7 +112,7 @@ class TableStyle
|
||||
*/
|
||||
public function setHorizontalBorderChar($horizontalBorderChar)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setHorizontalBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->setHorizontalBorderChars($horizontalBorderChar, $horizontalBorderChar);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ class TableStyle
|
||||
*/
|
||||
public function getHorizontalBorderChar()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->horizontalOutsideBorderChar;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ class TableStyle
|
||||
*/
|
||||
public function setVerticalBorderChar($verticalBorderChar)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use setVerticalBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->setVerticalBorderChars($verticalBorderChar, $verticalBorderChar);
|
||||
}
|
||||
@@ -182,7 +182,7 @@ class TableStyle
|
||||
*/
|
||||
public function getVerticalBorderChar()
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1, use getBorderChars() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->verticalOutsideBorderChar;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class TableStyle
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function getBorderChars()
|
||||
public function getBorderChars(): array
|
||||
{
|
||||
return [
|
||||
$this->horizontalOutsideBorderChar,
|
||||
@@ -270,7 +270,7 @@ class TableStyle
|
||||
*/
|
||||
public function setCrossingChar($crossingChar)
|
||||
{
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), E_USER_DEPRECATED);
|
||||
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.1. Use setDefaultCrossingChar() instead.', __METHOD__), \E_USER_DEPRECATED);
|
||||
|
||||
return $this->setDefaultCrossingChar($crossingChar);
|
||||
}
|
||||
@@ -413,7 +413,7 @@ class TableStyle
|
||||
*/
|
||||
public function setPadType($padType)
|
||||
{
|
||||
if (!\in_array($padType, [STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH], true)) {
|
||||
if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], true)) {
|
||||
throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
|
||||
}
|
||||
|
||||
|
||||
49
vendor/symfony/console/Input/ArgvInput.php
vendored
49
vendor/symfony/console/Input/ArgvInput.php
vendored
@@ -44,14 +44,11 @@ class ArgvInput extends Input
|
||||
private $parsed;
|
||||
|
||||
/**
|
||||
* @param array|null $argv An array of parameters from the CLI (in the argv format)
|
||||
* @param InputDefinition|null $definition A InputDefinition instance
|
||||
* @param array|null $argv An array of parameters from the CLI (in the argv format)
|
||||
*/
|
||||
public function __construct(array $argv = null, InputDefinition $definition = null)
|
||||
{
|
||||
if (null === $argv) {
|
||||
$argv = $_SERVER['argv'];
|
||||
}
|
||||
$argv = $argv ?? $_SERVER['argv'] ?? [];
|
||||
|
||||
// strip the application name
|
||||
array_shift($argv);
|
||||
@@ -78,7 +75,7 @@ class ArgvInput extends Input
|
||||
$this->parseArgument($token);
|
||||
} elseif ($parseOptions && '--' == $token) {
|
||||
$parseOptions = false;
|
||||
} elseif ($parseOptions && 0 === strpos($token, '--')) {
|
||||
} elseif ($parseOptions && str_starts_with($token, '--')) {
|
||||
$this->parseLongOption($token);
|
||||
} elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
|
||||
$this->parseShortOption($token);
|
||||
@@ -90,10 +87,8 @@ class ArgvInput extends Input
|
||||
|
||||
/**
|
||||
* Parses a short option.
|
||||
*
|
||||
* @param string $token The current token
|
||||
*/
|
||||
private function parseShortOption($token)
|
||||
private function parseShortOption(string $token)
|
||||
{
|
||||
$name = substr($token, 1);
|
||||
|
||||
@@ -112,11 +107,9 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Parses a short option set.
|
||||
*
|
||||
* @param string $name The current token
|
||||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function parseShortOptionSet($name)
|
||||
private function parseShortOptionSet(string $name)
|
||||
{
|
||||
$len = \strlen($name);
|
||||
for ($i = 0; $i < $len; ++$i) {
|
||||
@@ -138,15 +131,13 @@ class ArgvInput extends Input
|
||||
|
||||
/**
|
||||
* Parses a long option.
|
||||
*
|
||||
* @param string $token The current token
|
||||
*/
|
||||
private function parseLongOption($token)
|
||||
private function parseLongOption(string $token)
|
||||
{
|
||||
$name = substr($token, 2);
|
||||
|
||||
if (false !== $pos = strpos($name, '=')) {
|
||||
if (0 === \strlen($value = substr($name, $pos + 1))) {
|
||||
if ('' === $value = substr($name, $pos + 1)) {
|
||||
array_unshift($this->parsed, $value);
|
||||
}
|
||||
$this->addLongOption(substr($name, 0, $pos), $value);
|
||||
@@ -158,11 +149,9 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Parses an argument.
|
||||
*
|
||||
* @param string $token The current token
|
||||
*
|
||||
* @throws RuntimeException When too many arguments are given
|
||||
*/
|
||||
private function parseArgument($token)
|
||||
private function parseArgument(string $token)
|
||||
{
|
||||
$c = \count($this->arguments);
|
||||
|
||||
@@ -190,12 +179,9 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Adds a short option value.
|
||||
*
|
||||
* @param string $shortcut The short option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function addShortOption($shortcut, $value)
|
||||
private function addShortOption(string $shortcut, $value)
|
||||
{
|
||||
if (!$this->definition->hasShortcut($shortcut)) {
|
||||
throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
@@ -207,12 +193,9 @@ class ArgvInput extends Input
|
||||
/**
|
||||
* Adds a long option value.
|
||||
*
|
||||
* @param string $name The long option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws RuntimeException When option given doesn't exist
|
||||
*/
|
||||
private function addLongOption($name, $value)
|
||||
private function addLongOption(string $name, $value)
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
|
||||
@@ -260,7 +243,7 @@ class ArgvInput extends Input
|
||||
$isOption = false;
|
||||
foreach ($this->tokens as $i => $token) {
|
||||
if ($token && '-' === $token[0]) {
|
||||
if (false !== strpos($token, '=') || !isset($this->tokens[$i + 1])) {
|
||||
if (str_contains($token, '=') || !isset($this->tokens[$i + 1])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -283,6 +266,8 @@ class ArgvInput extends Input
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,8 +285,8 @@ class ArgvInput extends Input
|
||||
// Options with values:
|
||||
// For long options, test for '--option=' at beginning
|
||||
// For short options, test for '-o' at beginning
|
||||
$leading = 0 === strpos($value, '--') ? $value.'=' : $value;
|
||||
if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
|
||||
$leading = str_starts_with($value, '--') ? $value.'=' : $value;
|
||||
if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -331,8 +316,8 @@ class ArgvInput extends Input
|
||||
// Options with values:
|
||||
// For long options, test for '--option=' at beginning
|
||||
// For short options, test for '-o' at beginning
|
||||
$leading = 0 === strpos($value, '--') ? $value.'=' : $value;
|
||||
if ('' !== $leading && 0 === strpos($token, $leading)) {
|
||||
$leading = str_starts_with($value, '--') ? $value.'=' : $value;
|
||||
if ('' !== $leading && str_starts_with($token, $leading)) {
|
||||
return substr($token, \strlen($leading));
|
||||
}
|
||||
}
|
||||
|
||||
31
vendor/symfony/console/Input/ArrayInput.php
vendored
31
vendor/symfony/console/Input/ArrayInput.php
vendored
@@ -39,13 +39,15 @@ class ArrayInput extends Input
|
||||
*/
|
||||
public function getFirstArgument()
|
||||
{
|
||||
foreach ($this->parameters as $key => $value) {
|
||||
if ($key && '-' === $key[0]) {
|
||||
foreach ($this->parameters as $param => $value) {
|
||||
if ($param && \is_string($param) && '-' === $param[0]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -105,13 +107,14 @@ class ArrayInput extends Input
|
||||
{
|
||||
$params = [];
|
||||
foreach ($this->parameters as $param => $val) {
|
||||
if ($param && '-' === $param[0]) {
|
||||
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);
|
||||
@@ -130,9 +133,9 @@ class ArrayInput extends Input
|
||||
if ('--' === $key) {
|
||||
return;
|
||||
}
|
||||
if (0 === strpos($key, '--')) {
|
||||
if (str_starts_with($key, '--')) {
|
||||
$this->addLongOption(substr($key, 2), $value);
|
||||
} elseif ('-' === $key[0]) {
|
||||
} elseif (str_starts_with($key, '-')) {
|
||||
$this->addShortOption(substr($key, 1), $value);
|
||||
} else {
|
||||
$this->addArgument($key, $value);
|
||||
@@ -143,12 +146,9 @@ class ArrayInput extends Input
|
||||
/**
|
||||
* Adds a short option value.
|
||||
*
|
||||
* @param string $shortcut The short option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws InvalidOptionException When option given doesn't exist
|
||||
*/
|
||||
private function addShortOption($shortcut, $value)
|
||||
private function addShortOption(string $shortcut, $value)
|
||||
{
|
||||
if (!$this->definition->hasShortcut($shortcut)) {
|
||||
throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
@@ -160,13 +160,10 @@ class ArrayInput extends Input
|
||||
/**
|
||||
* Adds a long option value.
|
||||
*
|
||||
* @param string $name The long option key
|
||||
* @param mixed $value The value for the option
|
||||
*
|
||||
* @throws InvalidOptionException When option given doesn't exist
|
||||
* @throws InvalidOptionException When a required value is missing
|
||||
*/
|
||||
private function addLongOption($name, $value)
|
||||
private function addLongOption(string $name, $value)
|
||||
{
|
||||
if (!$this->definition->hasOption($name)) {
|
||||
throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
|
||||
@@ -190,8 +187,8 @@ class ArrayInput extends Input
|
||||
/**
|
||||
* Adds an argument value.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param mixed $value The value for the argument
|
||||
* @param string|int $name The argument name
|
||||
* @param mixed $value The value for the argument
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
|
||||
8
vendor/symfony/console/Input/Input.php
vendored
8
vendor/symfony/console/Input/Input.php
vendored
@@ -106,11 +106,11 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
||||
*/
|
||||
public function getArgument($name)
|
||||
{
|
||||
if (!$this->definition->hasArgument($name)) {
|
||||
if (!$this->definition->hasArgument((string) $name)) {
|
||||
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();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +118,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
||||
*/
|
||||
public function setArgument($name, $value)
|
||||
{
|
||||
if (!$this->definition->hasArgument($name)) {
|
||||
if (!$this->definition->hasArgument((string) $name)) {
|
||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
||||
*/
|
||||
public function hasArgument($name)
|
||||
{
|
||||
return $this->definition->hasArgument($name);
|
||||
return $this->definition->hasArgument((string) $name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
18
vendor/symfony/console/Input/InputArgument.php
vendored
18
vendor/symfony/console/Input/InputArgument.php
vendored
@@ -21,9 +21,9 @@ use Symfony\Component\Console\Exception\LogicException;
|
||||
*/
|
||||
class InputArgument
|
||||
{
|
||||
const REQUIRED = 1;
|
||||
const OPTIONAL = 2;
|
||||
const IS_ARRAY = 4;
|
||||
public const REQUIRED = 1;
|
||||
public const OPTIONAL = 2;
|
||||
public const IS_ARRAY = 4;
|
||||
|
||||
private $name;
|
||||
private $mode;
|
||||
@@ -31,10 +31,10 @@ class InputArgument
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @param string $name The argument name
|
||||
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param string|string[]|null $default The default value (for self::OPTIONAL mode only)
|
||||
* @param string $name The argument name
|
||||
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
|
||||
* @param string $description A description text
|
||||
* @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only)
|
||||
*
|
||||
* @throws InvalidArgumentException When argument mode is not valid
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ class InputArgument
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param string|string[]|null $default The default value
|
||||
* @param string|bool|int|float|array|null $default
|
||||
*
|
||||
* @throws LogicException When incorrect default value is given
|
||||
*/
|
||||
@@ -110,7 +110,7 @@ class InputArgument
|
||||
/**
|
||||
* Returns the default value.
|
||||
*
|
||||
* @return string|string[]|null The default value
|
||||
* @return string|bool|int|float|array|null
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
|
||||
16
vendor/symfony/console/Input/InputDefinition.php
vendored
16
vendor/symfony/console/Input/InputDefinition.php
vendored
@@ -171,7 +171,7 @@ class InputDefinition
|
||||
*/
|
||||
public function getArgumentCount()
|
||||
{
|
||||
return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
|
||||
return $this->hasAnArrayArgument ? \PHP_INT_MAX : \count($this->arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,9 +185,7 @@ class InputDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default values.
|
||||
*
|
||||
* @return array An array of default values
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getArgumentDefaults()
|
||||
{
|
||||
@@ -316,9 +314,7 @@ class InputDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an array of default values.
|
||||
*
|
||||
* @return array An array of all default values
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getOptionDefaults()
|
||||
{
|
||||
@@ -333,15 +329,11 @@ class InputDefinition
|
||||
/**
|
||||
* Returns the InputOption name given a shortcut.
|
||||
*
|
||||
* @param string $shortcut The shortcut
|
||||
*
|
||||
* @return string The InputOption name
|
||||
*
|
||||
* @throws InvalidArgumentException When option given does not exist
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function shortcutToName($shortcut)
|
||||
public function shortcutToName(string $shortcut): string
|
||||
{
|
||||
if (!isset($this->shortcuts[$shortcut])) {
|
||||
throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
|
||||
|
||||
24
vendor/symfony/console/Input/InputInterface.php
vendored
24
vendor/symfony/console/Input/InputInterface.php
vendored
@@ -51,9 +51,9 @@ interface InputInterface
|
||||
* Does not necessarily return the correct result for short options
|
||||
* when multiple flags are combined in the same option.
|
||||
*
|
||||
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
||||
* @param mixed $default The default value to return if no result is found
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
|
||||
* @param string|bool|int|float|array|null $default The default value to return if no result is found
|
||||
* @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal
|
||||
*
|
||||
* @return mixed The option value
|
||||
*/
|
||||
@@ -76,7 +76,7 @@ interface InputInterface
|
||||
/**
|
||||
* Returns all the given arguments merged with the default values.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getArguments();
|
||||
|
||||
@@ -85,7 +85,7 @@ interface InputInterface
|
||||
*
|
||||
* @param string $name The argument name
|
||||
*
|
||||
* @return string|string[]|null The argument value
|
||||
* @return mixed
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
@@ -94,8 +94,8 @@ interface InputInterface
|
||||
/**
|
||||
* Sets an argument value by name.
|
||||
*
|
||||
* @param string $name The argument name
|
||||
* @param string|string[]|null $value The argument value
|
||||
* @param string $name The argument name
|
||||
* @param mixed $value The argument value
|
||||
*
|
||||
* @throws InvalidArgumentException When argument given doesn't exist
|
||||
*/
|
||||
@@ -104,7 +104,7 @@ interface InputInterface
|
||||
/**
|
||||
* Returns true if an InputArgument object exists by name or position.
|
||||
*
|
||||
* @param string|int $name The InputArgument name or position
|
||||
* @param string $name The argument name
|
||||
*
|
||||
* @return bool true if the InputArgument object exists, false otherwise
|
||||
*/
|
||||
@@ -113,7 +113,7 @@ interface InputInterface
|
||||
/**
|
||||
* Returns all the given options merged with the default values.
|
||||
*
|
||||
* @return array
|
||||
* @return array<string|bool|int|float|array|null>
|
||||
*/
|
||||
public function getOptions();
|
||||
|
||||
@@ -122,7 +122,7 @@ interface InputInterface
|
||||
*
|
||||
* @param string $name The option name
|
||||
*
|
||||
* @return string|string[]|bool|null The option value
|
||||
* @return mixed
|
||||
*
|
||||
* @throws InvalidArgumentException When option given doesn't exist
|
||||
*/
|
||||
@@ -131,8 +131,8 @@ interface InputInterface
|
||||
/**
|
||||
* Sets an option value by name.
|
||||
*
|
||||
* @param string $name The option name
|
||||
* @param string|string[]|bool|null $value The option value
|
||||
* @param string $name The option name
|
||||
* @param mixed $value The option value
|
||||
*
|
||||
* @throws InvalidArgumentException When option given doesn't exist
|
||||
*/
|
||||
|
||||
43
vendor/symfony/console/Input/InputOption.php
vendored
43
vendor/symfony/console/Input/InputOption.php
vendored
@@ -21,10 +21,25 @@ use Symfony\Component\Console\Exception\LogicException;
|
||||
*/
|
||||
class InputOption
|
||||
{
|
||||
const VALUE_NONE = 1;
|
||||
const VALUE_REQUIRED = 2;
|
||||
const VALUE_OPTIONAL = 4;
|
||||
const VALUE_IS_ARRAY = 8;
|
||||
/**
|
||||
* 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;
|
||||
private $shortcut;
|
||||
@@ -33,17 +48,17 @@ 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|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE)
|
||||
*
|
||||
* @throws InvalidArgumentException If option mode is invalid or incompatible
|
||||
*/
|
||||
public function __construct(string $name, $shortcut = null, int $mode = null, string $description = '', $default = null)
|
||||
{
|
||||
if (0 === strpos($name, '--')) {
|
||||
if (str_starts_with($name, '--')) {
|
||||
$name = substr($name, 2);
|
||||
}
|
||||
|
||||
@@ -147,11 +162,7 @@ class InputOption
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default value.
|
||||
*
|
||||
* @param string|string[]|int|bool|null $default The default value
|
||||
*
|
||||
* @throws LogicException When incorrect default value is given
|
||||
* @param string|bool|int|float|array|null $default
|
||||
*/
|
||||
public function setDefault($default = null)
|
||||
{
|
||||
@@ -173,7 +184,7 @@ class InputOption
|
||||
/**
|
||||
* Returns the default value.
|
||||
*
|
||||
* @return string|string[]|int|bool|null The default value
|
||||
* @return string|bool|int|float|array|null
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
|
||||
41
vendor/symfony/console/Input/StringInput.php
vendored
41
vendor/symfony/console/Input/StringInput.php
vendored
@@ -24,8 +24,8 @@ use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
*/
|
||||
class StringInput extends ArgvInput
|
||||
{
|
||||
const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
|
||||
const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
|
||||
public const REGEX_STRING = '([^\s\\\\]+?)';
|
||||
public const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
|
||||
|
||||
/**
|
||||
* @param string $input A string representing the parameters from the CLI
|
||||
@@ -40,33 +40,44 @@ class StringInput extends ArgvInput
|
||||
/**
|
||||
* Tokenizes a string.
|
||||
*
|
||||
* @param string $input The input to tokenize
|
||||
*
|
||||
* @return array An array of tokens
|
||||
*
|
||||
* @throws InvalidArgumentException When unable to parse input (should never happen)
|
||||
*/
|
||||
private function tokenize($input)
|
||||
private function tokenize(string $input): array
|
||||
{
|
||||
$tokens = [];
|
||||
$length = \strlen($input);
|
||||
$cursor = 0;
|
||||
$token = null;
|
||||
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)) {
|
||||
$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)) {
|
||||
$tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
|
||||
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
|
||||
$tokens[] = stripcslashes($match[1]);
|
||||
if ('\\' === $input[$cursor]) {
|
||||
$token .= $input[++$cursor] ?? '';
|
||||
++$cursor;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (preg_match('/\s+/A', $input, $match, 0, $cursor)) {
|
||||
if (null !== $token) {
|
||||
$tokens[] = $token;
|
||||
$token = null;
|
||||
}
|
||||
} elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, 0, $cursor)) {
|
||||
$token .= $match[1].$match[2].stripcslashes(str_replace(['"\'', '\'"', '\'\'', '""'], '', substr($match[3], 1, -1)));
|
||||
} elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, 0, $cursor)) {
|
||||
$token .= stripcslashes(substr($match[0], 1, -1));
|
||||
} elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, 0, $cursor)) {
|
||||
$token .= $match[1];
|
||||
} else {
|
||||
// should never happen
|
||||
throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
|
||||
throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ...".', substr($input, $cursor, 10)));
|
||||
}
|
||||
|
||||
$cursor += \strlen($match[0]);
|
||||
}
|
||||
|
||||
if (null !== $token) {
|
||||
$tokens[] = $token;
|
||||
}
|
||||
|
||||
return $tokens;
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/symfony/console/LICENSE
vendored
2
vendor/symfony/console/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2019 Fabien Potencier
|
||||
Copyright (c) 2004-2022 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
|
||||
|
||||
10
vendor/symfony/console/Logger/ConsoleLogger.php
vendored
10
vendor/symfony/console/Logger/ConsoleLogger.php
vendored
@@ -22,12 +22,12 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
*
|
||||
* @author Kévin Dunglas <dunglas@gmail.com>
|
||||
*
|
||||
* @see http://www.php-fig.org/psr/psr-3/
|
||||
* @see https://www.php-fig.org/psr/psr-3/
|
||||
*/
|
||||
class ConsoleLogger extends AbstractLogger
|
||||
{
|
||||
const INFO = 'info';
|
||||
const ERROR = 'error';
|
||||
public const INFO = 'info';
|
||||
public const ERROR = 'error';
|
||||
|
||||
private $output;
|
||||
private $verbosityLevelMap = [
|
||||
@@ -61,6 +61,8 @@ class ConsoleLogger extends AbstractLogger
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function log($level, $message, array $context = [])
|
||||
{
|
||||
@@ -102,7 +104,7 @@ class ConsoleLogger extends AbstractLogger
|
||||
*/
|
||||
private function interpolate(string $message, array $context): string
|
||||
{
|
||||
if (false === strpos($message, '{')) {
|
||||
if (!str_contains($message, '{')) {
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class BufferedOutput extends Output
|
||||
$this->buffer .= $message;
|
||||
|
||||
if ($newline) {
|
||||
$this->buffer .= PHP_EOL;
|
||||
$this->buffer .= \PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
vendor/symfony/console/Output/ConsoleOutput.php
vendored
23
vendor/symfony/console/Output/ConsoleOutput.php
vendored
@@ -41,6 +41,13 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
||||
{
|
||||
parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
|
||||
|
||||
if (null === $formatter) {
|
||||
// for BC reasons, stdErr has it own Formatter only when user don't inject a specific formatter.
|
||||
$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$actualDecorated = $this->isDecorated();
|
||||
$this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
|
||||
|
||||
@@ -125,15 +132,13 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
||||
/**
|
||||
* Checks if current executing environment is IBM iSeries (OS400), which
|
||||
* doesn't properly convert character-encodings between ASCII to EBCDIC.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isRunningOS400()
|
||||
private function isRunningOS400(): bool
|
||||
{
|
||||
$checks = [
|
||||
\function_exists('php_uname') ? php_uname('s') : '',
|
||||
getenv('OSTYPE'),
|
||||
PHP_OS,
|
||||
\PHP_OS,
|
||||
];
|
||||
|
||||
return false !== stripos(implode(';', $checks), 'OS400');
|
||||
@@ -148,7 +153,8 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
||||
return fopen('php://output', 'w');
|
||||
}
|
||||
|
||||
return @fopen('php://stdout', 'w') ?: fopen('php://output', 'w');
|
||||
// Use STDOUT when possible to prevent from opening too many file descriptors
|
||||
return \defined('STDOUT') ? \STDOUT : (@fopen('php://stdout', 'w') ?: fopen('php://output', 'w'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,6 +162,11 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
|
||||
*/
|
||||
private function openErrorStream()
|
||||
{
|
||||
return fopen($this->hasStderrSupport() ? 'php://stderr' : 'php://output', 'w');
|
||||
if (!$this->hasStderrSupport()) {
|
||||
return fopen('php://output', 'w');
|
||||
}
|
||||
|
||||
// Use STDERR when possible to prevent from opening too many file descriptors
|
||||
return \defined('STDERR') ? \STDERR : (@fopen('php://stderr', 'w') ?: fopen('php://output', 'w'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,10 +82,10 @@ class ConsoleSectionOutput extends StreamOutput
|
||||
*/
|
||||
public function addContent(string $input)
|
||||
{
|
||||
foreach (explode(PHP_EOL, $input) as $lineContent) {
|
||||
foreach (explode(\PHP_EOL, $input) as $lineContent) {
|
||||
$this->lines += ceil($this->getDisplayLength($lineContent) / $this->terminal->getWidth()) ?: 1;
|
||||
$this->content[] = $lineContent;
|
||||
$this->content[] = PHP_EOL;
|
||||
$this->content[] = \PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,9 @@ class ConsoleSectionOutput extends StreamOutput
|
||||
protected function doWrite($message, $newline)
|
||||
{
|
||||
if (!$this->isDecorated()) {
|
||||
return parent::doWrite($message, $newline);
|
||||
parent::doWrite($message, $newline);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$erasedContent = $this->popStreamContentUntilCurrentSection();
|
||||
|
||||
4
vendor/symfony/console/Output/Output.php
vendored
4
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);
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ abstract class Output implements OutputInterface
|
||||
break;
|
||||
}
|
||||
|
||||
$this->doWrite($message, $newline);
|
||||
$this->doWrite($message ?? '', $newline);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
*/
|
||||
interface OutputInterface
|
||||
{
|
||||
const VERBOSITY_QUIET = 16;
|
||||
const VERBOSITY_NORMAL = 32;
|
||||
const VERBOSITY_VERBOSE = 64;
|
||||
const VERBOSITY_VERY_VERBOSE = 128;
|
||||
const VERBOSITY_DEBUG = 256;
|
||||
public const VERBOSITY_QUIET = 16;
|
||||
public const VERBOSITY_NORMAL = 32;
|
||||
public const VERBOSITY_VERBOSE = 64;
|
||||
public const VERBOSITY_VERY_VERBOSE = 128;
|
||||
public const VERBOSITY_DEBUG = 256;
|
||||
|
||||
const OUTPUT_NORMAL = 1;
|
||||
const OUTPUT_RAW = 2;
|
||||
const OUTPUT_PLAIN = 4;
|
||||
public const OUTPUT_NORMAL = 1;
|
||||
public const OUTPUT_RAW = 2;
|
||||
public const OUTPUT_PLAIN = 4;
|
||||
|
||||
/**
|
||||
* Writes a message to the output.
|
||||
|
||||
13
vendor/symfony/console/Output/StreamOutput.php
vendored
13
vendor/symfony/console/Output/StreamOutput.php
vendored
@@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Console\Output;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
|
||||
/**
|
||||
@@ -71,13 +70,10 @@ class StreamOutput extends Output
|
||||
protected function doWrite($message, $newline)
|
||||
{
|
||||
if ($newline) {
|
||||
$message .= PHP_EOL;
|
||||
$message .= \PHP_EOL;
|
||||
}
|
||||
|
||||
if (false === @fwrite($this->stream, $message)) {
|
||||
// should never happen
|
||||
throw new RuntimeException('Unable to write output.');
|
||||
}
|
||||
@fwrite($this->stream, $message);
|
||||
|
||||
fflush($this->stream);
|
||||
}
|
||||
@@ -97,6 +93,11 @@ class StreamOutput extends Output
|
||||
*/
|
||||
protected function hasColorSupport()
|
||||
{
|
||||
// Follow https://no-color.org/
|
||||
if (isset($_SERVER['NO_COLOR']) || false !== getenv('NO_COLOR')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('Hyper' === getenv('TERM_PROGRAM')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
63
vendor/symfony/console/Output/TrimmedBufferOutput.php
vendored
Normal file
63
vendor/symfony/console/Output/TrimmedBufferOutput.php
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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\Console\Output;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
|
||||
/**
|
||||
* A BufferedOutput that keeps only the last N chars.
|
||||
*
|
||||
* @author Jérémy Derussé <jeremy@derusse.com>
|
||||
*/
|
||||
class TrimmedBufferOutput extends Output
|
||||
{
|
||||
private $maxLength;
|
||||
private $buffer = '';
|
||||
|
||||
public function __construct(int $maxLength, ?int $verbosity = self::VERBOSITY_NORMAL, bool $decorated = false, OutputFormatterInterface $formatter = null)
|
||||
{
|
||||
if ($maxLength <= 0) {
|
||||
throw new InvalidArgumentException(sprintf('"%s()" expects a strictly positive maxLength. Got %d.', __METHOD__, $maxLength));
|
||||
}
|
||||
|
||||
parent::__construct($verbosity, $decorated, $formatter);
|
||||
$this->maxLength = $maxLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empties buffer and returns its content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fetch()
|
||||
{
|
||||
$content = $this->buffer;
|
||||
$this->buffer = '';
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doWrite($message, $newline)
|
||||
{
|
||||
$this->buffer .= $message;
|
||||
|
||||
if ($newline) {
|
||||
$this->buffer .= \PHP_EOL;
|
||||
}
|
||||
|
||||
$this->buffer = substr($this->buffer, 0 - $this->maxLength);
|
||||
}
|
||||
}
|
||||
@@ -131,13 +131,19 @@ class ChoiceQuestion extends Question
|
||||
return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
|
||||
if ($multiselect) {
|
||||
// Check for a separated comma values
|
||||
if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selected, $matches)) {
|
||||
if (!preg_match('/^[^,]+(?:,[^,]+)*$/', (string) $selected, $matches)) {
|
||||
throw new InvalidArgumentException(sprintf($errorMessage, $selected));
|
||||
}
|
||||
|
||||
$selectedChoices = array_map('trim', explode(',', $selected));
|
||||
$selectedChoices = explode(',', (string) $selected);
|
||||
} else {
|
||||
$selectedChoices = [trim($selected)];
|
||||
$selectedChoices = [$selected];
|
||||
}
|
||||
|
||||
if ($this->isTrimmable()) {
|
||||
foreach ($selectedChoices as $k => $v) {
|
||||
$selectedChoices[$k] = trim((string) $v);
|
||||
}
|
||||
}
|
||||
|
||||
$multiselectChoices = [];
|
||||
@@ -150,7 +156,7 @@ class ChoiceQuestion extends Question
|
||||
}
|
||||
|
||||
if (\count($results) > 1) {
|
||||
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
|
||||
throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of "%s".', implode('" or "', $results)));
|
||||
}
|
||||
|
||||
$result = array_search($value, $choices);
|
||||
|
||||
@@ -35,10 +35,8 @@ class ConfirmationQuestion extends Question
|
||||
|
||||
/**
|
||||
* Returns the default answer normalizer.
|
||||
*
|
||||
* @return callable
|
||||
*/
|
||||
private function getDefaultNormalizer()
|
||||
private function getDefaultNormalizer(): callable
|
||||
{
|
||||
$default = $this->getDefault();
|
||||
$regex = $this->trueAnswerRegex;
|
||||
|
||||
80
vendor/symfony/console/Question/Question.php
vendored
80
vendor/symfony/console/Question/Question.php
vendored
@@ -25,14 +25,15 @@ class Question
|
||||
private $attempts;
|
||||
private $hidden = false;
|
||||
private $hiddenFallback = true;
|
||||
private $autocompleterValues;
|
||||
private $autocompleterCallback;
|
||||
private $validator;
|
||||
private $default;
|
||||
private $normalizer;
|
||||
private $trimmable = true;
|
||||
|
||||
/**
|
||||
* @param string $question The question to ask to the user
|
||||
* @param mixed $default The default answer to return if the user enters nothing
|
||||
* @param string $question The question to ask to the user
|
||||
* @param string|bool|int|float|null $default The default answer to return if the user enters nothing
|
||||
*/
|
||||
public function __construct(string $question, $default = null)
|
||||
{
|
||||
@@ -53,7 +54,7 @@ class Question
|
||||
/**
|
||||
* Returns the default answer.
|
||||
*
|
||||
* @return mixed
|
||||
* @return string|bool|int|float|null
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
@@ -81,7 +82,7 @@ class Question
|
||||
*/
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
if ($this->autocompleterValues) {
|
||||
if ($this->autocompleterCallback) {
|
||||
throw new LogicException('A hidden question cannot use the autocompleter.');
|
||||
}
|
||||
|
||||
@@ -121,7 +122,9 @@ class Question
|
||||
*/
|
||||
public function getAutocompleterValues()
|
||||
{
|
||||
return $this->autocompleterValues;
|
||||
$callback = $this->getAutocompleterCallback();
|
||||
|
||||
return $callback ? $callback('') : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -138,17 +141,46 @@ class Question
|
||||
{
|
||||
if (\is_array($values)) {
|
||||
$values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
|
||||
}
|
||||
|
||||
if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
|
||||
$callback = static function () use ($values) {
|
||||
return $values;
|
||||
};
|
||||
} elseif ($values instanceof \Traversable) {
|
||||
$valueCache = null;
|
||||
$callback = static function () use ($values, &$valueCache) {
|
||||
return $valueCache ?? $valueCache = iterator_to_array($values, false);
|
||||
};
|
||||
} elseif (null === $values) {
|
||||
$callback = null;
|
||||
} else {
|
||||
throw new InvalidArgumentException('Autocompleter values can be either an array, "null" or a "Traversable" object.');
|
||||
}
|
||||
|
||||
if ($this->hidden) {
|
||||
return $this->setAutocompleterCallback($callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the callback function used for the autocompleter.
|
||||
*/
|
||||
public function getAutocompleterCallback(): ?callable
|
||||
{
|
||||
return $this->autocompleterCallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the callback function used for the autocompleter.
|
||||
*
|
||||
* The callback is passed the user input as argument and should return an iterable of corresponding suggestions.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAutocompleterCallback(callable $callback = null): self
|
||||
{
|
||||
if ($this->hidden && null !== $callback) {
|
||||
throw new LogicException('A hidden question cannot use the autocompleter.');
|
||||
}
|
||||
|
||||
$this->autocompleterValues = $values;
|
||||
$this->autocompleterCallback = $callback;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -156,8 +188,6 @@ class Question
|
||||
/**
|
||||
* Sets a validator for the question.
|
||||
*
|
||||
* @param callable|null $validator
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValidator(callable $validator = null)
|
||||
@@ -190,8 +220,11 @@ class Question
|
||||
*/
|
||||
public function setMaxAttempts($attempts)
|
||||
{
|
||||
if (null !== $attempts && $attempts < 1) {
|
||||
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
|
||||
if (null !== $attempts) {
|
||||
$attempts = (int) $attempts;
|
||||
if ($attempts < 1) {
|
||||
throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
|
||||
}
|
||||
}
|
||||
|
||||
$this->attempts = $attempts;
|
||||
@@ -216,8 +249,6 @@ class Question
|
||||
*
|
||||
* The normalizer can be a callable (a string), a closure or a class implementing __invoke.
|
||||
*
|
||||
* @param callable $normalizer
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNormalizer(callable $normalizer)
|
||||
@@ -232,7 +263,7 @@ class Question
|
||||
*
|
||||
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
|
||||
*
|
||||
* @return callable
|
||||
* @return callable|null
|
||||
*/
|
||||
public function getNormalizer()
|
||||
{
|
||||
@@ -243,4 +274,19 @@ class Question
|
||||
{
|
||||
return (bool) \count(array_filter(array_keys($array), 'is_string'));
|
||||
}
|
||||
|
||||
public function isTrimmable(): bool
|
||||
{
|
||||
return $this->trimmable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function setTrimmable(bool $trimmable): self
|
||||
{
|
||||
$this->trimmable = $trimmable;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
10
vendor/symfony/console/README.md
vendored
10
vendor/symfony/console/README.md
vendored
@@ -7,11 +7,11 @@ interfaces.
|
||||
Resources
|
||||
---------
|
||||
|
||||
* [Documentation](https://symfony.com/doc/current/components/console/index.html)
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
in the [main Symfony repository](https://github.com/symfony/symfony)
|
||||
* [Documentation](https://symfony.com/doc/current/components/console.html)
|
||||
* [Contributing](https://symfony.com/doc/current/contributing/index.html)
|
||||
* [Report issues](https://github.com/symfony/symfony/issues) and
|
||||
[send Pull Requests](https://github.com/symfony/symfony/pulls)
|
||||
in the [main Symfony repository](https://github.com/symfony/symfony)
|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
2
vendor/symfony/console/Style/OutputStyle.php
vendored
2
vendor/symfony/console/Style/OutputStyle.php
vendored
@@ -35,7 +35,7 @@ abstract class OutputStyle implements OutputInterface, StyleInterface
|
||||
*/
|
||||
public function newLine($count = 1)
|
||||
{
|
||||
$this->output->write(str_repeat(PHP_EOL, $count));
|
||||
$this->output->write(str_repeat(\PHP_EOL, $count));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -119,7 +119,6 @@ interface StyleInterface
|
||||
* Asks a choice question.
|
||||
*
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string|int|null $default
|
||||
*
|
||||
* @return mixed
|
||||
|
||||
96
vendor/symfony/console/Style/SymfonyStyle.php
vendored
96
vendor/symfony/console/Style/SymfonyStyle.php
vendored
@@ -11,15 +11,18 @@
|
||||
|
||||
namespace Symfony\Component\Console\Style;
|
||||
|
||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Console\Exception\RuntimeException;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatter;
|
||||
use Symfony\Component\Console\Helper\Helper;
|
||||
use Symfony\Component\Console\Helper\ProgressBar;
|
||||
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Helper\TableCell;
|
||||
use Symfony\Component\Console\Helper\TableSeparator;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Output\TrimmedBufferOutput;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Symfony\Component\Console\Question\Question;
|
||||
@@ -32,7 +35,7 @@ use Symfony\Component\Console\Terminal;
|
||||
*/
|
||||
class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
const MAX_LINE_LENGTH = 120;
|
||||
public const MAX_LINE_LENGTH = 120;
|
||||
|
||||
private $input;
|
||||
private $questionHelper;
|
||||
@@ -43,7 +46,7 @@ class SymfonyStyle extends OutputStyle
|
||||
public function __construct(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
$this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
|
||||
$this->bufferedOutput = new TrimmedBufferOutput(\DIRECTORY_SEPARATOR === '\\' ? 4 : 2, $output->getVerbosity(), false, clone $output->getFormatter());
|
||||
// Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
|
||||
$width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
|
||||
$this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
|
||||
@@ -154,7 +157,7 @@ class SymfonyStyle extends OutputStyle
|
||||
*/
|
||||
public function warning($message)
|
||||
{
|
||||
$this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
|
||||
$this->block($message, 'WARNING', 'fg=black;bg=yellow', ' ', true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -190,6 +193,69 @@ class SymfonyStyle extends OutputStyle
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a horizontal table.
|
||||
*/
|
||||
public function horizontalTable(array $headers, array $rows)
|
||||
{
|
||||
$style = clone Table::getStyleDefinition('symfony-style-guide');
|
||||
$style->setCellHeaderFormat('<info>%s</info>');
|
||||
|
||||
$table = new Table($this);
|
||||
$table->setHeaders($headers);
|
||||
$table->setRows($rows);
|
||||
$table->setStyle($style);
|
||||
$table->setHorizontal(true);
|
||||
|
||||
$table->render();
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats a list of key/value horizontally.
|
||||
*
|
||||
* Each row can be one of:
|
||||
* * 'A title'
|
||||
* * ['key' => 'value']
|
||||
* * new TableSeparator()
|
||||
*
|
||||
* @param string|array|TableSeparator ...$list
|
||||
*/
|
||||
public function definitionList(...$list)
|
||||
{
|
||||
$style = clone Table::getStyleDefinition('symfony-style-guide');
|
||||
$style->setCellHeaderFormat('<info>%s</info>');
|
||||
|
||||
$table = new Table($this);
|
||||
$headers = [];
|
||||
$row = [];
|
||||
foreach ($list as $value) {
|
||||
if ($value instanceof TableSeparator) {
|
||||
$headers[] = $value;
|
||||
$row[] = $value;
|
||||
continue;
|
||||
}
|
||||
if (\is_string($value)) {
|
||||
$headers[] = new TableCell($value, ['colspan' => 2]);
|
||||
$row[] = null;
|
||||
continue;
|
||||
}
|
||||
if (!\is_array($value)) {
|
||||
throw new InvalidArgumentException('Value should be an array, string, or an instance of TableSeparator.');
|
||||
}
|
||||
$headers[] = key($value);
|
||||
$row[] = current($value);
|
||||
}
|
||||
|
||||
$table->setHeaders($headers);
|
||||
$table->setRows([$row]);
|
||||
$table->setHorizontal();
|
||||
$table->setStyle($style);
|
||||
|
||||
$table->render();
|
||||
$this->newLine();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
@@ -229,7 +295,7 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
if (null !== $default) {
|
||||
$values = array_flip($choices);
|
||||
$default = $values[$default];
|
||||
$default = $values[$default] ?? $default;
|
||||
}
|
||||
|
||||
return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
|
||||
@@ -361,7 +427,7 @@ class SymfonyStyle extends OutputStyle
|
||||
|
||||
private function autoPrependBlock(): void
|
||||
{
|
||||
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
||||
$chars = substr(str_replace(\PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
|
||||
|
||||
if (!isset($chars[0])) {
|
||||
$this->newLine(); //empty history, so we should start with a new line.
|
||||
@@ -376,19 +442,18 @@ class SymfonyStyle extends OutputStyle
|
||||
{
|
||||
$fetched = $this->bufferedOutput->fetch();
|
||||
//Prepend new line if last char isn't EOL:
|
||||
if ("\n" !== substr($fetched, -1)) {
|
||||
if (!str_ends_with($fetched, "\n")) {
|
||||
$this->newLine();
|
||||
}
|
||||
}
|
||||
|
||||
private function writeBuffer(string $message, bool $newLine, int $type): void
|
||||
{
|
||||
// We need to know if the two last chars are PHP_EOL
|
||||
// Preserve the last 4 chars inserted (PHP_EOL on windows is two chars) in the history buffer
|
||||
$this->bufferedOutput->write(substr($message, -4), $newLine, $type);
|
||||
// We need to know if the last chars are PHP_EOL
|
||||
$this->bufferedOutput->write($message, $newLine, $type);
|
||||
}
|
||||
|
||||
private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false)
|
||||
private function createBlock(iterable $messages, string $type = null, string $style = null, string $prefix = ' ', bool $padding = false, bool $escape = false): array
|
||||
{
|
||||
$indentLength = 0;
|
||||
$prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
|
||||
@@ -406,7 +471,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[] = '';
|
||||
@@ -426,7 +496,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);
|
||||
|
||||
99
vendor/symfony/console/Terminal.php
vendored
99
vendor/symfony/console/Terminal.php
vendored
@@ -15,6 +15,7 @@ class Terminal
|
||||
{
|
||||
private static $width;
|
||||
private static $height;
|
||||
private static $stty;
|
||||
|
||||
/**
|
||||
* Gets the terminal width.
|
||||
@@ -54,6 +55,27 @@ class Terminal
|
||||
return self::$height ?: 50;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasSttyAvailable()
|
||||
{
|
||||
if (null !== self::$stty) {
|
||||
return self::$stty;
|
||||
}
|
||||
|
||||
// skip check if exec function is disabled
|
||||
if (!\function_exists('exec')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
exec('stty 2>&1', $output, $exitcode);
|
||||
|
||||
return self::$stty = 0 === $exitcode;
|
||||
}
|
||||
|
||||
private static function initDimensions()
|
||||
{
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
@@ -62,12 +84,34 @@ class Terminal
|
||||
// or [w, h] from "wxh"
|
||||
self::$width = (int) $matches[1];
|
||||
self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
|
||||
} elseif (!self::hasVt100Support() && self::hasSttyAvailable()) {
|
||||
// only use stty on Windows if the terminal does not support vt100 (e.g. Windows 7 + git-bash)
|
||||
// testing for stty in a Windows 10 vt100-enabled console will implicitly disable vt100 support on STDOUT
|
||||
self::initDimensionsUsingStty();
|
||||
} elseif (null !== $dimensions = self::getConsoleMode()) {
|
||||
// extract [w, h] from "wxh"
|
||||
self::$width = (int) $dimensions[0];
|
||||
self::$height = (int) $dimensions[1];
|
||||
}
|
||||
} elseif ($sttyString = self::getSttyColumns()) {
|
||||
} else {
|
||||
self::initDimensionsUsingStty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether STDOUT has vt100 support (some Windows 10+ configurations).
|
||||
*/
|
||||
private static function hasVt100Support(): bool
|
||||
{
|
||||
return \function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(fopen('php://stdout', 'w'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes dimensions using the output of an stty columns line.
|
||||
*/
|
||||
private static function initDimensionsUsingStty()
|
||||
{
|
||||
if ($sttyString = self::getSttyColumns()) {
|
||||
if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
|
||||
// extract [w, h] from "rows h; columns w;"
|
||||
self::$width = (int) $matches[2];
|
||||
@@ -85,38 +129,29 @@ class Terminal
|
||||
*
|
||||
* @return int[]|null An array composed of the width and the height or null if it could not be parsed
|
||||
*/
|
||||
private static function getConsoleMode()
|
||||
private static function getConsoleMode(): ?array
|
||||
{
|
||||
if (!\function_exists('proc_open')) {
|
||||
return;
|
||||
$info = self::readFromProcess('mode CON');
|
||||
|
||||
if (null === $info || !preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$descriptorspec = [
|
||||
1 => ['pipe', 'w'],
|
||||
2 => ['pipe', 'w'],
|
||||
];
|
||||
$process = proc_open('mode CON', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
||||
if (\is_resource($process)) {
|
||||
$info = stream_get_contents($pipes[1]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
proc_close($process);
|
||||
|
||||
if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
|
||||
return [(int) $matches[2], (int) $matches[1]];
|
||||
}
|
||||
}
|
||||
return [(int) $matches[2], (int) $matches[1]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs and parses stty -a if it's available, suppressing any error output.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
private static function getSttyColumns()
|
||||
private static function getSttyColumns(): ?string
|
||||
{
|
||||
return self::readFromProcess('stty -a | grep columns');
|
||||
}
|
||||
|
||||
private static function readFromProcess(string $command): ?string
|
||||
{
|
||||
if (!\function_exists('proc_open')) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$descriptorspec = [
|
||||
@@ -124,14 +159,16 @@ class Terminal
|
||||
2 => ['pipe', 'w'],
|
||||
];
|
||||
|
||||
$process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
||||
if (\is_resource($process)) {
|
||||
$info = stream_get_contents($pipes[1]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
proc_close($process);
|
||||
|
||||
return $info;
|
||||
$process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
|
||||
if (!\is_resource($process)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$info = stream_get_contents($pipes[1]);
|
||||
fclose($pipes[1]);
|
||||
fclose($pipes[2]);
|
||||
proc_close($process);
|
||||
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,19 +59,12 @@ class ApplicationTester
|
||||
$this->input->setInteractive($options['interactive']);
|
||||
}
|
||||
|
||||
$shellInteractive = getenv('SHELL_INTERACTIVE');
|
||||
|
||||
if ($this->inputs) {
|
||||
$this->input->setStream(self::createStream($this->inputs));
|
||||
putenv('SHELL_INTERACTIVE=1');
|
||||
}
|
||||
|
||||
$this->initOutput($options);
|
||||
|
||||
$this->statusCode = $this->application->run($this->input, $this->output);
|
||||
|
||||
putenv($shellInteractive ? "SHELL_INTERACTIVE=$shellInteractive" : 'SHELL_INTERACTIVE');
|
||||
|
||||
return $this->statusCode;
|
||||
return $this->statusCode = $this->application->run($this->input, $this->output);
|
||||
}
|
||||
}
|
||||
|
||||
15
vendor/symfony/console/Tester/TesterTrait.php
vendored
15
vendor/symfony/console/Tester/TesterTrait.php
vendored
@@ -44,7 +44,7 @@ trait TesterTrait
|
||||
$display = stream_get_contents($this->output->getStream());
|
||||
|
||||
if ($normalize) {
|
||||
$display = str_replace(PHP_EOL, "\n", $display);
|
||||
$display = str_replace(\PHP_EOL, "\n", $display);
|
||||
}
|
||||
|
||||
return $display;
|
||||
@@ -68,7 +68,7 @@ trait TesterTrait
|
||||
$display = stream_get_contents($this->output->getErrorOutput()->getStream());
|
||||
|
||||
if ($normalize) {
|
||||
$display = str_replace(PHP_EOL, "\n", $display);
|
||||
$display = str_replace(\PHP_EOL, "\n", $display);
|
||||
}
|
||||
|
||||
return $display;
|
||||
@@ -110,7 +110,7 @@ trait TesterTrait
|
||||
* @param array $inputs An array of strings representing each input
|
||||
* passed to the command input stream
|
||||
*
|
||||
* @return self
|
||||
* @return $this
|
||||
*/
|
||||
public function setInputs(array $inputs)
|
||||
{
|
||||
@@ -141,8 +141,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));
|
||||
@@ -162,12 +162,15 @@ trait TesterTrait
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource
|
||||
*/
|
||||
private static function createStream(array $inputs)
|
||||
{
|
||||
$stream = fopen('php://memory', 'r+', false);
|
||||
|
||||
foreach ($inputs as $input) {
|
||||
fwrite($stream, $input.PHP_EOL);
|
||||
fwrite($stream, $input.\PHP_EOL);
|
||||
}
|
||||
|
||||
rewind($stream);
|
||||
|
||||
1836
vendor/symfony/console/Tests/ApplicationTest.php
vendored
1836
vendor/symfony/console/Tests/ApplicationTest.php
vendored
File diff suppressed because it is too large
Load Diff
436
vendor/symfony/console/Tests/Command/CommandTest.php
vendored
436
vendor/symfony/console/Tests/Command/CommandTest.php
vendored
@@ -1,436 +0,0 @@
|
||||
<?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\Console\Tests\Command;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Helper\FormatterHelper;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
class CommandTest extends TestCase
|
||||
{
|
||||
protected static $fixturesPath;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$fixturesPath = __DIR__.'/../Fixtures/';
|
||||
require_once self::$fixturesPath.'/TestCommand.php';
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
$command = new Command('foo:bar');
|
||||
$this->assertEquals('foo:bar', $command->getName(), '__construct() takes the command name as its first argument');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage The command defined in "Symfony\Component\Console\Command\Command" cannot have an empty name.
|
||||
*/
|
||||
public function testCommandNameCannotBeEmpty()
|
||||
{
|
||||
(new Application())->add(new Command());
|
||||
}
|
||||
|
||||
public function testSetApplication()
|
||||
{
|
||||
$application = new Application();
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication($application);
|
||||
$this->assertEquals($application, $command->getApplication(), '->setApplication() sets the current application');
|
||||
$this->assertEquals($application->getHelperSet(), $command->getHelperSet());
|
||||
}
|
||||
|
||||
public function testSetApplicationNull()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication(null);
|
||||
$this->assertNull($command->getHelperSet());
|
||||
}
|
||||
|
||||
public function testSetGetDefinition()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$ret = $command->setDefinition($definition = new InputDefinition());
|
||||
$this->assertEquals($command, $ret, '->setDefinition() implements a fluent interface');
|
||||
$this->assertEquals($definition, $command->getDefinition(), '->setDefinition() sets the current InputDefinition instance');
|
||||
$command->setDefinition([new InputArgument('foo'), new InputOption('bar')]);
|
||||
$this->assertTrue($command->getDefinition()->hasArgument('foo'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument');
|
||||
$this->assertTrue($command->getDefinition()->hasOption('bar'), '->setDefinition() also takes an array of InputArguments and InputOptions as an argument');
|
||||
$command->setDefinition(new InputDefinition());
|
||||
}
|
||||
|
||||
public function testAddArgument()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$ret = $command->addArgument('foo');
|
||||
$this->assertEquals($command, $ret, '->addArgument() implements a fluent interface');
|
||||
$this->assertTrue($command->getDefinition()->hasArgument('foo'), '->addArgument() adds an argument to the command');
|
||||
}
|
||||
|
||||
public function testAddOption()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$ret = $command->addOption('foo');
|
||||
$this->assertEquals($command, $ret, '->addOption() implements a fluent interface');
|
||||
$this->assertTrue($command->getDefinition()->hasOption('foo'), '->addOption() adds an option to the command');
|
||||
}
|
||||
|
||||
public function testSetHidden()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->setHidden(true);
|
||||
$this->assertTrue($command->isHidden());
|
||||
}
|
||||
|
||||
public function testGetNamespaceGetNameSetName()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$this->assertEquals('namespace:name', $command->getName(), '->getName() returns the command name');
|
||||
$command->setName('foo');
|
||||
$this->assertEquals('foo', $command->getName(), '->setName() sets the command name');
|
||||
|
||||
$ret = $command->setName('foobar:bar');
|
||||
$this->assertEquals($command, $ret, '->setName() implements a fluent interface');
|
||||
$this->assertEquals('foobar:bar', $command->getName(), '->setName() sets the command name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidCommandNames
|
||||
*/
|
||||
public function testInvalidCommandNames($name)
|
||||
{
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage(sprintf('Command name "%s" is invalid.', $name));
|
||||
} else {
|
||||
$this->setExpectedException('InvalidArgumentException', sprintf('Command name "%s" is invalid.', $name));
|
||||
}
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setName($name);
|
||||
}
|
||||
|
||||
public function provideInvalidCommandNames()
|
||||
{
|
||||
return [
|
||||
[''],
|
||||
['foo:'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testGetSetDescription()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$this->assertEquals('description', $command->getDescription(), '->getDescription() returns the description');
|
||||
$ret = $command->setDescription('description1');
|
||||
$this->assertEquals($command, $ret, '->setDescription() implements a fluent interface');
|
||||
$this->assertEquals('description1', $command->getDescription(), '->setDescription() sets the description');
|
||||
}
|
||||
|
||||
public function testGetSetHelp()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$this->assertEquals('help', $command->getHelp(), '->getHelp() returns the help');
|
||||
$ret = $command->setHelp('help1');
|
||||
$this->assertEquals($command, $ret, '->setHelp() implements a fluent interface');
|
||||
$this->assertEquals('help1', $command->getHelp(), '->setHelp() sets the help');
|
||||
$command->setHelp('');
|
||||
$this->assertEquals('', $command->getHelp(), '->getHelp() does not fall back to the description');
|
||||
}
|
||||
|
||||
public function testGetProcessedHelp()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
|
||||
$this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly');
|
||||
$this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name%');
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setHelp('');
|
||||
$this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
|
||||
$application = new Application();
|
||||
$application->add($command);
|
||||
$application->setDefaultCommand('namespace:name', true);
|
||||
$this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications');
|
||||
$this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications');
|
||||
}
|
||||
|
||||
public function testGetSetAliases()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$this->assertEquals(['name'], $command->getAliases(), '->getAliases() returns the aliases');
|
||||
$ret = $command->setAliases(['name1']);
|
||||
$this->assertEquals($command, $ret, '->setAliases() implements a fluent interface');
|
||||
$this->assertEquals(['name1'], $command->getAliases(), '->setAliases() sets the aliases');
|
||||
}
|
||||
|
||||
public function testSetAliasesNull()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$this->{method_exists($this, $_ = 'expectException') ? $_ : 'setExpectedException'}('InvalidArgumentException');
|
||||
$command->setAliases(null);
|
||||
}
|
||||
|
||||
public function testGetSynopsis()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->addOption('foo');
|
||||
$command->addArgument('bar');
|
||||
$this->assertEquals('namespace:name [--foo] [--] [<bar>]', $command->getSynopsis(), '->getSynopsis() returns the synopsis');
|
||||
}
|
||||
|
||||
public function testAddGetUsages()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->addUsage('foo1');
|
||||
$command->addUsage('foo2');
|
||||
$this->assertContains('namespace:name foo1', $command->getUsages());
|
||||
$this->assertContains('namespace:name foo2', $command->getUsages());
|
||||
}
|
||||
|
||||
public function testGetHelper()
|
||||
{
|
||||
$application = new Application();
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication($application);
|
||||
$formatterHelper = new FormatterHelper();
|
||||
$this->assertEquals($formatterHelper->getName(), $command->getHelper('formatter')->getName(), '->getHelper() returns the correct helper');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage Cannot retrieve helper "formatter" because there is no HelperSet defined.
|
||||
*/
|
||||
public function testGetHelperWithoutHelperSet()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->getHelper('formatter');
|
||||
}
|
||||
|
||||
public function testMergeApplicationDefinition()
|
||||
{
|
||||
$application1 = new Application();
|
||||
$application1->getDefinition()->addArguments([new InputArgument('foo')]);
|
||||
$application1->getDefinition()->addOptions([new InputOption('bar')]);
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication($application1);
|
||||
$command->setDefinition($definition = new InputDefinition([new InputArgument('bar'), new InputOption('foo')]));
|
||||
|
||||
$r = new \ReflectionObject($command);
|
||||
$m = $r->getMethod('mergeApplicationDefinition');
|
||||
$m->setAccessible(true);
|
||||
$m->invoke($command);
|
||||
$this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition() merges the application arguments and the command arguments');
|
||||
$this->assertTrue($command->getDefinition()->hasArgument('bar'), '->mergeApplicationDefinition() merges the application arguments and the command arguments');
|
||||
$this->assertTrue($command->getDefinition()->hasOption('foo'), '->mergeApplicationDefinition() merges the application options and the command options');
|
||||
$this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition() merges the application options and the command options');
|
||||
|
||||
$m->invoke($command);
|
||||
$this->assertEquals(3, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments and options');
|
||||
}
|
||||
|
||||
public function testMergeApplicationDefinitionWithoutArgsThenWithArgsAddsArgs()
|
||||
{
|
||||
$application1 = new Application();
|
||||
$application1->getDefinition()->addArguments([new InputArgument('foo')]);
|
||||
$application1->getDefinition()->addOptions([new InputOption('bar')]);
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication($application1);
|
||||
$command->setDefinition($definition = new InputDefinition([]));
|
||||
|
||||
$r = new \ReflectionObject($command);
|
||||
$m = $r->getMethod('mergeApplicationDefinition');
|
||||
$m->setAccessible(true);
|
||||
$m->invoke($command, false);
|
||||
$this->assertTrue($command->getDefinition()->hasOption('bar'), '->mergeApplicationDefinition(false) merges the application and the command options');
|
||||
$this->assertFalse($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(false) does not merge the application arguments');
|
||||
|
||||
$m->invoke($command, true);
|
||||
$this->assertTrue($command->getDefinition()->hasArgument('foo'), '->mergeApplicationDefinition(true) merges the application arguments and the command arguments');
|
||||
|
||||
$m->invoke($command);
|
||||
$this->assertEquals(2, $command->getDefinition()->getArgumentCount(), '->mergeApplicationDefinition() does not try to merge twice the application arguments');
|
||||
}
|
||||
|
||||
public function testRunInteractive()
|
||||
{
|
||||
$tester = new CommandTester(new \TestCommand());
|
||||
|
||||
$tester->execute([], ['interactive' => true]);
|
||||
|
||||
$this->assertEquals('interact called'.PHP_EOL.'execute called'.PHP_EOL, $tester->getDisplay(), '->run() calls the interact() method if the input is interactive');
|
||||
}
|
||||
|
||||
public function testRunNonInteractive()
|
||||
{
|
||||
$tester = new CommandTester(new \TestCommand());
|
||||
|
||||
$tester->execute([], ['interactive' => false]);
|
||||
|
||||
$this->assertEquals('execute called'.PHP_EOL, $tester->getDisplay(), '->run() does not call the interact() method if the input is not interactive');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage You must override the execute() method in the concrete command class.
|
||||
*/
|
||||
public function testExecuteMethodNeedsToBeOverridden()
|
||||
{
|
||||
$command = new Command('foo');
|
||||
$command->run(new StringInput(''), new NullOutput());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\InvalidOptionException
|
||||
* @expectedExceptionMessage The "--bar" option does not exist.
|
||||
*/
|
||||
public function testRunWithInvalidOption()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$tester = new CommandTester($command);
|
||||
$tester->execute(['--bar' => true]);
|
||||
}
|
||||
|
||||
public function testRunReturnsIntegerExitCode()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$exitCode = $command->run(new StringInput(''), new NullOutput());
|
||||
$this->assertSame(0, $exitCode, '->run() returns integer exit code (treats null as 0)');
|
||||
|
||||
$command = $this->getMockBuilder('TestCommand')->setMethods(['execute'])->getMock();
|
||||
$command->expects($this->once())
|
||||
->method('execute')
|
||||
->willReturn('2.3');
|
||||
$exitCode = $command->run(new StringInput(''), new NullOutput());
|
||||
$this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)');
|
||||
}
|
||||
|
||||
public function testRunWithApplication()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication(new Application());
|
||||
$exitCode = $command->run(new StringInput(''), new NullOutput());
|
||||
|
||||
$this->assertSame(0, $exitCode, '->run() returns an integer exit code');
|
||||
}
|
||||
|
||||
public function testRunReturnsAlwaysInteger()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
|
||||
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput()));
|
||||
}
|
||||
|
||||
public function testRunWithProcessTitle()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->setApplication(new Application());
|
||||
$command->setProcessTitle('foo');
|
||||
$this->assertSame(0, $command->run(new StringInput(''), new NullOutput()));
|
||||
if (\function_exists('cli_set_process_title')) {
|
||||
if (null === @cli_get_process_title() && 'Darwin' === PHP_OS) {
|
||||
$this->markTestSkipped('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.');
|
||||
}
|
||||
$this->assertEquals('foo', cli_get_process_title());
|
||||
}
|
||||
}
|
||||
|
||||
public function testSetCode()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$ret = $command->setCode(function (InputInterface $input, OutputInterface $output) {
|
||||
$output->writeln('from the code...');
|
||||
});
|
||||
$this->assertEquals($command, $ret, '->setCode() implements a fluent interface');
|
||||
$tester = new CommandTester($command);
|
||||
$tester->execute([]);
|
||||
$this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function getSetCodeBindToClosureTests()
|
||||
{
|
||||
return [
|
||||
[true, 'not bound to the command'],
|
||||
[false, 'bound to the command'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider getSetCodeBindToClosureTests
|
||||
*/
|
||||
public function testSetCodeBindToClosure($previouslyBound, $expected)
|
||||
{
|
||||
$code = createClosure();
|
||||
if ($previouslyBound) {
|
||||
$code = $code->bindTo($this);
|
||||
}
|
||||
|
||||
$command = new \TestCommand();
|
||||
$command->setCode($code);
|
||||
$tester = new CommandTester($command);
|
||||
$tester->execute([]);
|
||||
$this->assertEquals('interact called'.PHP_EOL.$expected.PHP_EOL, $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testSetCodeWithStaticClosure()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$command->setCode(self::createClosure());
|
||||
$tester = new CommandTester($command);
|
||||
$tester->execute([]);
|
||||
|
||||
$this->assertEquals('interact called'.PHP_EOL.'bound'.PHP_EOL, $tester->getDisplay());
|
||||
}
|
||||
|
||||
private static function createClosure()
|
||||
{
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output->writeln(isset($this) ? 'bound' : 'not bound');
|
||||
};
|
||||
}
|
||||
|
||||
public function testSetCodeWithNonClosureCallable()
|
||||
{
|
||||
$command = new \TestCommand();
|
||||
$ret = $command->setCode([$this, 'callableMethodCommand']);
|
||||
$this->assertEquals($command, $ret, '->setCode() implements a fluent interface');
|
||||
$tester = new CommandTester($command);
|
||||
$tester->execute([]);
|
||||
$this->assertEquals('interact called'.PHP_EOL.'from the code...'.PHP_EOL, $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function callableMethodCommand(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$output->writeln('from the code...');
|
||||
}
|
||||
}
|
||||
|
||||
// In order to get an unbound closure, we should create it outside a class
|
||||
// scope.
|
||||
function createClosure()
|
||||
{
|
||||
return function (InputInterface $input, OutputInterface $output) {
|
||||
$output->writeln($this instanceof Command ? 'bound to the command' : 'not bound to the command');
|
||||
};
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
<?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\Console\Tests\Command;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\HelpCommand;
|
||||
use Symfony\Component\Console\Command\ListCommand;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
class HelpCommandTest extends TestCase
|
||||
{
|
||||
public function testExecuteForCommandAlias()
|
||||
{
|
||||
$command = new HelpCommand();
|
||||
$command->setApplication(new Application());
|
||||
$commandTester = new CommandTester($command);
|
||||
$commandTester->execute(['command_name' => 'li'], ['decorated' => false]);
|
||||
$this->assertContains('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
|
||||
$this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
|
||||
$this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command alias');
|
||||
}
|
||||
|
||||
public function testExecuteForCommand()
|
||||
{
|
||||
$command = new HelpCommand();
|
||||
$commandTester = new CommandTester($command);
|
||||
$command->setCommand(new ListCommand());
|
||||
$commandTester->execute([], ['decorated' => false]);
|
||||
$this->assertContains('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
$this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
$this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
}
|
||||
|
||||
public function testExecuteForCommandWithXmlOption()
|
||||
{
|
||||
$command = new HelpCommand();
|
||||
$commandTester = new CommandTester($command);
|
||||
$command->setCommand(new ListCommand());
|
||||
$commandTester->execute(['--format' => 'xml']);
|
||||
$this->assertContains('<command', $commandTester->getDisplay(), '->execute() returns an XML help text if --xml is passed');
|
||||
}
|
||||
|
||||
public function testExecuteForApplicationCommand()
|
||||
{
|
||||
$application = new Application();
|
||||
$commandTester = new CommandTester($application->get('help'));
|
||||
$commandTester->execute(['command_name' => 'list']);
|
||||
$this->assertContains('list [options] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
$this->assertContains('format=FORMAT', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
$this->assertContains('raw', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
}
|
||||
|
||||
public function testExecuteForApplicationCommandWithXmlOption()
|
||||
{
|
||||
$application = new Application();
|
||||
$commandTester = new CommandTester($application->get('help'));
|
||||
$commandTester->execute(['command_name' => 'list', '--format' => 'xml']);
|
||||
$this->assertContains('list [--raw] [--format FORMAT] [--] [<namespace>]', $commandTester->getDisplay(), '->execute() returns a text help for the given command');
|
||||
$this->assertContains('<command', $commandTester->getDisplay(), '->execute() returns an XML help text if --format=xml is passed');
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
<?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\Console\Tests\Command;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
class ListCommandTest extends TestCase
|
||||
{
|
||||
public function testExecuteListsCommands()
|
||||
{
|
||||
$application = new Application();
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(['command' => $command->getName()], ['decorated' => false]);
|
||||
|
||||
$this->assertRegExp('/help\s{2,}Displays help for a command/', $commandTester->getDisplay(), '->execute() returns a list of available commands');
|
||||
}
|
||||
|
||||
public function testExecuteListsCommandsWithXmlOption()
|
||||
{
|
||||
$application = new Application();
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(['command' => $command->getName(), '--format' => 'xml']);
|
||||
$this->assertRegExp('/<command id="list" name="list" hidden="0">/', $commandTester->getDisplay(), '->execute() returns a list of available commands in XML if --xml is passed');
|
||||
}
|
||||
|
||||
public function testExecuteListsCommandsWithRawOption()
|
||||
{
|
||||
$application = new Application();
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(['command' => $command->getName(), '--raw' => true]);
|
||||
$output = <<<'EOF'
|
||||
help Displays help for a command
|
||||
list Lists commands
|
||||
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($output, $commandTester->getDisplay(true));
|
||||
}
|
||||
|
||||
public function testExecuteListsCommandsWithNamespaceArgument()
|
||||
{
|
||||
require_once realpath(__DIR__.'/../Fixtures/FooCommand.php');
|
||||
$application = new Application();
|
||||
$application->add(new \FooCommand());
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(['command' => $command->getName(), 'namespace' => 'foo', '--raw' => true]);
|
||||
$output = <<<'EOF'
|
||||
foo:bar The foo:bar command
|
||||
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($output, $commandTester->getDisplay(true));
|
||||
}
|
||||
|
||||
public function testExecuteListsCommandsOrder()
|
||||
{
|
||||
require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php');
|
||||
$application = new Application();
|
||||
$application->add(new \Foo6Command());
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(['command' => $command->getName()], ['decorated' => false]);
|
||||
$output = <<<'EOF'
|
||||
Console Tool
|
||||
|
||||
Usage:
|
||||
command [options] [arguments]
|
||||
|
||||
Options:
|
||||
-h, --help Display this help message
|
||||
-q, --quiet Do not output any message
|
||||
-V, --version Display this application version
|
||||
--ansi Force ANSI output
|
||||
--no-ansi Disable ANSI output
|
||||
-n, --no-interaction Do not ask any interactive question
|
||||
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
|
||||
Available commands:
|
||||
help Displays help for a command
|
||||
list Lists commands
|
||||
0foo
|
||||
0foo:bar 0foo:bar command
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($output, trim($commandTester->getDisplay(true)));
|
||||
}
|
||||
|
||||
public function testExecuteListsCommandsOrderRaw()
|
||||
{
|
||||
require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php');
|
||||
$application = new Application();
|
||||
$application->add(new \Foo6Command());
|
||||
$commandTester = new CommandTester($command = $application->get('list'));
|
||||
$commandTester->execute(['command' => $command->getName(), '--raw' => true]);
|
||||
$output = <<<'EOF'
|
||||
help Displays help for a command
|
||||
list Lists commands
|
||||
0foo:bar 0foo:bar command
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($output, trim($commandTester->getDisplay(true)));
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?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\Console\Tests\Command;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use Symfony\Component\Lock\Factory;
|
||||
use Symfony\Component\Lock\Store\FlockStore;
|
||||
use Symfony\Component\Lock\Store\SemaphoreStore;
|
||||
|
||||
class LockableTraitTest extends TestCase
|
||||
{
|
||||
protected static $fixturesPath;
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$fixturesPath = __DIR__.'/../Fixtures/';
|
||||
require_once self::$fixturesPath.'/FooLockCommand.php';
|
||||
require_once self::$fixturesPath.'/FooLock2Command.php';
|
||||
}
|
||||
|
||||
public function testLockIsReleased()
|
||||
{
|
||||
$command = new \FooLockCommand();
|
||||
|
||||
$tester = new CommandTester($command);
|
||||
$this->assertSame(2, $tester->execute([]));
|
||||
$this->assertSame(2, $tester->execute([]));
|
||||
}
|
||||
|
||||
public function testLockReturnsFalseIfAlreadyLockedByAnotherCommand()
|
||||
{
|
||||
$command = new \FooLockCommand();
|
||||
|
||||
if (SemaphoreStore::isSupported()) {
|
||||
$store = new SemaphoreStore();
|
||||
} else {
|
||||
$store = new FlockStore();
|
||||
}
|
||||
|
||||
$lock = (new Factory($store))->createLock($command->getName());
|
||||
$lock->acquire();
|
||||
|
||||
$tester = new CommandTester($command);
|
||||
$this->assertSame(1, $tester->execute([]));
|
||||
|
||||
$lock->release();
|
||||
$this->assertSame(2, $tester->execute([]));
|
||||
}
|
||||
|
||||
public function testMultipleLockCallsThrowLogicException()
|
||||
{
|
||||
$command = new \FooLock2Command();
|
||||
|
||||
$tester = new CommandTester($command);
|
||||
$this->assertSame(1, $tester->execute([]));
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?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\Console\Tests\CommandLoader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
|
||||
use Symfony\Component\DependencyInjection\ServiceLocator;
|
||||
|
||||
class ContainerCommandLoaderTest extends TestCase
|
||||
{
|
||||
public function testHas()
|
||||
{
|
||||
$loader = new ContainerCommandLoader(new ServiceLocator([
|
||||
'foo-service' => function () { return new Command('foo'); },
|
||||
'bar-service' => function () { return new Command('bar'); },
|
||||
]), ['foo' => 'foo-service', 'bar' => 'bar-service']);
|
||||
|
||||
$this->assertTrue($loader->has('foo'));
|
||||
$this->assertTrue($loader->has('bar'));
|
||||
$this->assertFalse($loader->has('baz'));
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$loader = new ContainerCommandLoader(new ServiceLocator([
|
||||
'foo-service' => function () { return new Command('foo'); },
|
||||
'bar-service' => function () { return new Command('bar'); },
|
||||
]), ['foo' => 'foo-service', 'bar' => 'bar-service']);
|
||||
|
||||
$this->assertInstanceOf(Command::class, $loader->get('foo'));
|
||||
$this->assertInstanceOf(Command::class, $loader->get('bar'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
|
||||
*/
|
||||
public function testGetUnknownCommandThrows()
|
||||
{
|
||||
(new ContainerCommandLoader(new ServiceLocator([]), []))->get('unknown');
|
||||
}
|
||||
|
||||
public function testGetCommandNames()
|
||||
{
|
||||
$loader = new ContainerCommandLoader(new ServiceLocator([
|
||||
'foo-service' => function () { return new Command('foo'); },
|
||||
'bar-service' => function () { return new Command('bar'); },
|
||||
]), ['foo' => 'foo-service', 'bar' => 'bar-service']);
|
||||
|
||||
$this->assertSame(['foo', 'bar'], $loader->getNames());
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
<?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\Console\Tests\CommandLoader;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\CommandLoader\FactoryCommandLoader;
|
||||
|
||||
class FactoryCommandLoaderTest extends TestCase
|
||||
{
|
||||
public function testHas()
|
||||
{
|
||||
$loader = new FactoryCommandLoader([
|
||||
'foo' => function () { return new Command('foo'); },
|
||||
'bar' => function () { return new Command('bar'); },
|
||||
]);
|
||||
|
||||
$this->assertTrue($loader->has('foo'));
|
||||
$this->assertTrue($loader->has('bar'));
|
||||
$this->assertFalse($loader->has('baz'));
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$loader = new FactoryCommandLoader([
|
||||
'foo' => function () { return new Command('foo'); },
|
||||
'bar' => function () { return new Command('bar'); },
|
||||
]);
|
||||
|
||||
$this->assertInstanceOf(Command::class, $loader->get('foo'));
|
||||
$this->assertInstanceOf(Command::class, $loader->get('bar'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException
|
||||
*/
|
||||
public function testGetUnknownCommandThrows()
|
||||
{
|
||||
(new FactoryCommandLoader([]))->get('unknown');
|
||||
}
|
||||
|
||||
public function testGetCommandNames()
|
||||
{
|
||||
$loader = new FactoryCommandLoader([
|
||||
'foo' => function () { return new Command('foo'); },
|
||||
'bar' => function () { return new Command('bar'); },
|
||||
]);
|
||||
|
||||
$this->assertSame(['foo', 'bar'], $loader->getNames());
|
||||
}
|
||||
}
|
||||
@@ -1,258 +0,0 @@
|
||||
<?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\Console\Tests\DependencyInjection;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
|
||||
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
|
||||
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
|
||||
use Symfony\Component\DependencyInjection\ChildDefinition;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
use Symfony\Component\DependencyInjection\TypedReference;
|
||||
|
||||
class AddConsoleCommandPassTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider visibilityProvider
|
||||
*/
|
||||
public function testProcess($public)
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$container->setParameter('my-command.class', 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand');
|
||||
|
||||
$id = 'my-command';
|
||||
$definition = new Definition('%my-command.class%');
|
||||
$definition->setPublic($public);
|
||||
$definition->addTag('console.command');
|
||||
$container->setDefinition($id, $definition);
|
||||
|
||||
$container->compile();
|
||||
|
||||
$alias = 'console.command.public_alias.my-command';
|
||||
|
||||
if ($public) {
|
||||
$this->assertFalse($container->hasAlias($alias));
|
||||
} else {
|
||||
// The alias is replaced by a Definition by the ReplaceAliasByActualDefinitionPass
|
||||
// in case the original service is private
|
||||
$this->assertFalse($container->hasDefinition($id));
|
||||
$this->assertTrue($container->hasDefinition($alias));
|
||||
}
|
||||
|
||||
$this->assertTrue($container->hasParameter('console.command.ids'));
|
||||
$this->assertSame([$public ? $id : $alias], $container->getParameter('console.command.ids'));
|
||||
}
|
||||
|
||||
public function testProcessRegistersLazyCommands()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$command = $container
|
||||
->register('my-command', MyCommand::class)
|
||||
->setPublic(false)
|
||||
->addTag('console.command', ['command' => 'my:command'])
|
||||
->addTag('console.command', ['command' => 'my:alias'])
|
||||
;
|
||||
|
||||
(new AddConsoleCommandPass())->process($container);
|
||||
|
||||
$commandLoader = $container->getDefinition('console.command_loader');
|
||||
$commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0));
|
||||
|
||||
$this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass());
|
||||
$this->assertSame(['my:command' => 'my-command', 'my:alias' => 'my-command'], $commandLoader->getArgument(1));
|
||||
$this->assertEquals([['my-command' => new ServiceClosureArgument(new TypedReference('my-command', MyCommand::class))]], $commandLocator->getArguments());
|
||||
$this->assertSame([], $container->getParameter('console.command.ids'));
|
||||
$this->assertSame([['setName', ['my:command']], ['setAliases', [['my:alias']]]], $command->getMethodCalls());
|
||||
}
|
||||
|
||||
public function testProcessFallsBackToDefaultName()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container
|
||||
->register('with-default-name', NamedCommand::class)
|
||||
->setPublic(false)
|
||||
->addTag('console.command')
|
||||
;
|
||||
|
||||
$pass = new AddConsoleCommandPass();
|
||||
$pass->process($container);
|
||||
|
||||
$commandLoader = $container->getDefinition('console.command_loader');
|
||||
$commandLocator = $container->getDefinition((string) $commandLoader->getArgument(0));
|
||||
|
||||
$this->assertSame(ContainerCommandLoader::class, $commandLoader->getClass());
|
||||
$this->assertSame(['default' => 'with-default-name'], $commandLoader->getArgument(1));
|
||||
$this->assertEquals([['with-default-name' => new ServiceClosureArgument(new TypedReference('with-default-name', NamedCommand::class))]], $commandLocator->getArguments());
|
||||
$this->assertSame([], $container->getParameter('console.command.ids'));
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container
|
||||
->register('with-default-name', NamedCommand::class)
|
||||
->setPublic(false)
|
||||
->addTag('console.command', ['command' => 'new-name'])
|
||||
;
|
||||
|
||||
$pass->process($container);
|
||||
|
||||
$this->assertSame(['new-name' => 'with-default-name'], $container->getDefinition('console.command_loader')->getArgument(1));
|
||||
}
|
||||
|
||||
public function visibilityProvider()
|
||||
{
|
||||
return [
|
||||
[true],
|
||||
[false],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The service "my-command" tagged "console.command" must not be abstract.
|
||||
*/
|
||||
public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->setResourceTracking(false);
|
||||
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
|
||||
$definition = new Definition('Symfony\Component\Console\Tests\DependencyInjection\MyCommand');
|
||||
$definition->addTag('console.command');
|
||||
$definition->setAbstract(true);
|
||||
$container->setDefinition('my-command', $definition);
|
||||
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".
|
||||
*/
|
||||
public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->setResourceTracking(false);
|
||||
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
|
||||
$definition = new Definition('SplObjectStorage');
|
||||
$definition->addTag('console.command');
|
||||
$container->setDefinition('my-command', $definition);
|
||||
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
public function testProcessPrivateServicesWithSameCommand()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand';
|
||||
|
||||
$definition1 = new Definition($className);
|
||||
$definition1->addTag('console.command')->setPublic(false);
|
||||
|
||||
$definition2 = new Definition($className);
|
||||
$definition2->addTag('console.command')->setPublic(false);
|
||||
|
||||
$container->setDefinition('my-command1', $definition1);
|
||||
$container->setDefinition('my-command2', $definition2);
|
||||
|
||||
(new AddConsoleCommandPass())->process($container);
|
||||
|
||||
$aliasPrefix = 'console.command.public_alias.';
|
||||
$this->assertTrue($container->hasAlias($aliasPrefix.'my-command1'));
|
||||
$this->assertTrue($container->hasAlias($aliasPrefix.'my-command2'));
|
||||
}
|
||||
|
||||
public function testProcessOnChildDefinitionWithClass()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand';
|
||||
|
||||
$parentId = 'my-parent-command';
|
||||
$childId = 'my-child-command';
|
||||
|
||||
$parentDefinition = new Definition(/* no class */);
|
||||
$parentDefinition->setAbstract(true)->setPublic(false);
|
||||
|
||||
$childDefinition = new ChildDefinition($parentId);
|
||||
$childDefinition->addTag('console.command')->setPublic(true);
|
||||
$childDefinition->setClass($className);
|
||||
|
||||
$container->setDefinition($parentId, $parentDefinition);
|
||||
$container->setDefinition($childId, $childDefinition);
|
||||
|
||||
$container->compile();
|
||||
$command = $container->get($childId);
|
||||
|
||||
$this->assertInstanceOf($className, $command);
|
||||
}
|
||||
|
||||
public function testProcessOnChildDefinitionWithParentClass()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
$className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand';
|
||||
|
||||
$parentId = 'my-parent-command';
|
||||
$childId = 'my-child-command';
|
||||
|
||||
$parentDefinition = new Definition($className);
|
||||
$parentDefinition->setAbstract(true)->setPublic(false);
|
||||
|
||||
$childDefinition = new ChildDefinition($parentId);
|
||||
$childDefinition->addTag('console.command')->setPublic(true);
|
||||
|
||||
$container->setDefinition($parentId, $parentDefinition);
|
||||
$container->setDefinition($childId, $childDefinition);
|
||||
|
||||
$container->compile();
|
||||
$command = $container->get($childId);
|
||||
|
||||
$this->assertInstanceOf($className, $command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage The definition for "my-child-command" has no class.
|
||||
*/
|
||||
public function testProcessOnChildDefinitionWithoutClass()
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
|
||||
|
||||
$parentId = 'my-parent-command';
|
||||
$childId = 'my-child-command';
|
||||
|
||||
$parentDefinition = new Definition();
|
||||
$parentDefinition->setAbstract(true)->setPublic(false);
|
||||
|
||||
$childDefinition = new ChildDefinition($parentId);
|
||||
$childDefinition->addTag('console.command')->setPublic(true);
|
||||
|
||||
$container->setDefinition($parentId, $parentDefinition);
|
||||
$container->setDefinition($childId, $childDefinition);
|
||||
|
||||
$container->compile();
|
||||
}
|
||||
}
|
||||
|
||||
class MyCommand extends Command
|
||||
{
|
||||
}
|
||||
|
||||
class NamedCommand extends Command
|
||||
{
|
||||
protected static $defaultName = 'default';
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
<?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\Console\Tests\Descriptor;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
|
||||
abstract class AbstractDescriptorTest extends TestCase
|
||||
{
|
||||
/** @dataProvider getDescribeInputArgumentTestData */
|
||||
public function testDescribeInputArgument(InputArgument $argument, $expectedDescription)
|
||||
{
|
||||
$this->assertDescription($expectedDescription, $argument);
|
||||
}
|
||||
|
||||
/** @dataProvider getDescribeInputOptionTestData */
|
||||
public function testDescribeInputOption(InputOption $option, $expectedDescription)
|
||||
{
|
||||
$this->assertDescription($expectedDescription, $option);
|
||||
}
|
||||
|
||||
/** @dataProvider getDescribeInputDefinitionTestData */
|
||||
public function testDescribeInputDefinition(InputDefinition $definition, $expectedDescription)
|
||||
{
|
||||
$this->assertDescription($expectedDescription, $definition);
|
||||
}
|
||||
|
||||
/** @dataProvider getDescribeCommandTestData */
|
||||
public function testDescribeCommand(Command $command, $expectedDescription)
|
||||
{
|
||||
$this->assertDescription($expectedDescription, $command);
|
||||
}
|
||||
|
||||
/** @dataProvider getDescribeApplicationTestData */
|
||||
public function testDescribeApplication(Application $application, $expectedDescription)
|
||||
{
|
||||
// Replaces the dynamic placeholders of the command help text with a static version.
|
||||
// The placeholder %command.full_name% includes the script path that is not predictable
|
||||
// and can not be tested against.
|
||||
foreach ($application->all() as $command) {
|
||||
$command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp()));
|
||||
}
|
||||
|
||||
$this->assertDescription($expectedDescription, $application);
|
||||
}
|
||||
|
||||
public function getDescribeInputArgumentTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(ObjectsProvider::getInputArguments());
|
||||
}
|
||||
|
||||
public function getDescribeInputOptionTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(ObjectsProvider::getInputOptions());
|
||||
}
|
||||
|
||||
public function getDescribeInputDefinitionTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(ObjectsProvider::getInputDefinitions());
|
||||
}
|
||||
|
||||
public function getDescribeCommandTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(ObjectsProvider::getCommands());
|
||||
}
|
||||
|
||||
public function getDescribeApplicationTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(ObjectsProvider::getApplications());
|
||||
}
|
||||
|
||||
abstract protected function getDescriptor();
|
||||
|
||||
abstract protected function getFormat();
|
||||
|
||||
protected function getDescriptionTestData(array $objects)
|
||||
{
|
||||
$data = [];
|
||||
foreach ($objects as $name => $object) {
|
||||
$description = file_get_contents(sprintf('%s/../Fixtures/%s.%s', __DIR__, $name, $this->getFormat()));
|
||||
$data[] = [$object, $description];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function assertDescription($expectedDescription, $describedObject, array $options = [])
|
||||
{
|
||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
||||
$this->getDescriptor()->describe($output, $describedObject, $options + ['raw_output' => true]);
|
||||
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $output->fetch())));
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?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\Console\Tests\Descriptor;
|
||||
|
||||
use Symfony\Component\Console\Descriptor\JsonDescriptor;
|
||||
use Symfony\Component\Console\Output\BufferedOutput;
|
||||
|
||||
class JsonDescriptorTest extends AbstractDescriptorTest
|
||||
{
|
||||
protected function getDescriptor()
|
||||
{
|
||||
return new JsonDescriptor();
|
||||
}
|
||||
|
||||
protected function getFormat()
|
||||
{
|
||||
return 'json';
|
||||
}
|
||||
|
||||
protected function assertDescription($expectedDescription, $describedObject, array $options = [])
|
||||
{
|
||||
$output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
|
||||
$this->getDescriptor()->describe($output, $describedObject, $options + ['raw_output' => true]);
|
||||
$this->assertEquals(json_decode(trim($expectedDescription), true), json_decode(trim(str_replace(PHP_EOL, "\n", $output->fetch())), true));
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<?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\Console\Tests\Descriptor;
|
||||
|
||||
use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplicationMbString;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommandMbString;
|
||||
|
||||
class MarkdownDescriptorTest extends AbstractDescriptorTest
|
||||
{
|
||||
public function getDescribeCommandTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(array_merge(
|
||||
ObjectsProvider::getCommands(),
|
||||
['command_mbstring' => new DescriptorCommandMbString()]
|
||||
));
|
||||
}
|
||||
|
||||
public function getDescribeApplicationTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(array_merge(
|
||||
ObjectsProvider::getApplications(),
|
||||
['application_mbstring' => new DescriptorApplicationMbString()]
|
||||
));
|
||||
}
|
||||
|
||||
protected function getDescriptor()
|
||||
{
|
||||
return new MarkdownDescriptor();
|
||||
}
|
||||
|
||||
protected function getFormat()
|
||||
{
|
||||
return 'md';
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<?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\Console\Tests\Descriptor;
|
||||
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication1;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand1;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommand2;
|
||||
|
||||
/**
|
||||
* @author Jean-François Simon <contact@jfsimon.fr>
|
||||
*/
|
||||
class ObjectsProvider
|
||||
{
|
||||
public static function getInputArguments()
|
||||
{
|
||||
return [
|
||||
'input_argument_1' => new InputArgument('argument_name', InputArgument::REQUIRED),
|
||||
'input_argument_2' => new InputArgument('argument_name', InputArgument::IS_ARRAY, 'argument description'),
|
||||
'input_argument_3' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value'),
|
||||
'input_argument_4' => new InputArgument('argument_name', InputArgument::REQUIRED, "multiline\nargument description"),
|
||||
'input_argument_with_style' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', '<comment>style</>'),
|
||||
'input_argument_with_default_inf_value' => new InputArgument('argument_name', InputArgument::OPTIONAL, 'argument description', INF),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getInputOptions()
|
||||
{
|
||||
return [
|
||||
'input_option_1' => new InputOption('option_name', 'o', InputOption::VALUE_NONE),
|
||||
'input_option_2' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value'),
|
||||
'input_option_3' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description'),
|
||||
'input_option_4' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'option description', []),
|
||||
'input_option_5' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, "multiline\noption description"),
|
||||
'input_option_6' => new InputOption('option_name', ['o', 'O'], InputOption::VALUE_REQUIRED, 'option with multiple shortcuts'),
|
||||
'input_option_with_style' => new InputOption('option_name', 'o', InputOption::VALUE_REQUIRED, 'option description', '<comment>style</>'),
|
||||
'input_option_with_style_array' => new InputOption('option_name', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'option description', ['<comment>Hello</comment>', '<info>world</info>']),
|
||||
'input_option_with_default_inf_value' => new InputOption('option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', INF),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getInputDefinitions()
|
||||
{
|
||||
return [
|
||||
'input_definition_1' => new InputDefinition(),
|
||||
'input_definition_2' => new InputDefinition([new InputArgument('argument_name', InputArgument::REQUIRED)]),
|
||||
'input_definition_3' => new InputDefinition([new InputOption('option_name', 'o', InputOption::VALUE_NONE)]),
|
||||
'input_definition_4' => new InputDefinition([
|
||||
new InputArgument('argument_name', InputArgument::REQUIRED),
|
||||
new InputOption('option_name', 'o', InputOption::VALUE_NONE),
|
||||
]),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCommands()
|
||||
{
|
||||
return [
|
||||
'command_1' => new DescriptorCommand1(),
|
||||
'command_2' => new DescriptorCommand2(),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getApplications()
|
||||
{
|
||||
return [
|
||||
'application_1' => new DescriptorApplication1(),
|
||||
'application_2' => new DescriptorApplication2(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?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\Console\Tests\Descriptor;
|
||||
|
||||
use Symfony\Component\Console\Descriptor\TextDescriptor;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplication2;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorApplicationMbString;
|
||||
use Symfony\Component\Console\Tests\Fixtures\DescriptorCommandMbString;
|
||||
|
||||
class TextDescriptorTest extends AbstractDescriptorTest
|
||||
{
|
||||
public function getDescribeCommandTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(array_merge(
|
||||
ObjectsProvider::getCommands(),
|
||||
['command_mbstring' => new DescriptorCommandMbString()]
|
||||
));
|
||||
}
|
||||
|
||||
public function getDescribeApplicationTestData()
|
||||
{
|
||||
return $this->getDescriptionTestData(array_merge(
|
||||
ObjectsProvider::getApplications(),
|
||||
['application_mbstring' => new DescriptorApplicationMbString()]
|
||||
));
|
||||
}
|
||||
|
||||
public function testDescribeApplicationWithFilteredNamespace()
|
||||
{
|
||||
$application = new DescriptorApplication2();
|
||||
|
||||
$this->assertDescription(file_get_contents(__DIR__.'/../Fixtures/application_filtered_namespace.txt'), $application, ['namespace' => 'command4']);
|
||||
}
|
||||
|
||||
protected function getDescriptor()
|
||||
{
|
||||
return new TextDescriptor();
|
||||
}
|
||||
|
||||
protected function getFormat()
|
||||
{
|
||||
return 'txt';
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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\Console\Tests\Descriptor;
|
||||
|
||||
use Symfony\Component\Console\Descriptor\XmlDescriptor;
|
||||
|
||||
class XmlDescriptorTest extends AbstractDescriptorTest
|
||||
{
|
||||
protected function getDescriptor()
|
||||
{
|
||||
return new XmlDescriptor();
|
||||
}
|
||||
|
||||
protected function getFormat()
|
||||
{
|
||||
return 'xml';
|
||||
}
|
||||
}
|
||||
@@ -1,156 +0,0 @@
|
||||
<?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\Console\Tests\EventListener;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Event\ConsoleErrorEvent;
|
||||
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
|
||||
use Symfony\Component\Console\EventListener\ErrorListener;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Input\Input;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class ErrorListenerTest extends TestCase
|
||||
{
|
||||
public function testOnConsoleError()
|
||||
{
|
||||
$error = new \TypeError('An error occurred');
|
||||
|
||||
$logger = $this->getLogger();
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('error')
|
||||
->with('Error thrown while running command "{command}". Message: "{message}"', ['exception' => $error, 'command' => 'test:run --foo=baz buzz', 'message' => 'An error occurred'])
|
||||
;
|
||||
|
||||
$listener = new ErrorListener($logger);
|
||||
$listener->onConsoleError(new ConsoleErrorEvent(new ArgvInput(['console.php', 'test:run', '--foo=baz', 'buzz']), $this->getOutput(), $error, new Command('test:run')));
|
||||
}
|
||||
|
||||
public function testOnConsoleErrorWithNoCommandAndNoInputString()
|
||||
{
|
||||
$error = new \RuntimeException('An error occurred');
|
||||
|
||||
$logger = $this->getLogger();
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('error')
|
||||
->with('An error occurred while using the console. Message: "{message}"', ['exception' => $error, 'message' => 'An error occurred'])
|
||||
;
|
||||
|
||||
$listener = new ErrorListener($logger);
|
||||
$listener->onConsoleError(new ConsoleErrorEvent(new NonStringInput(), $this->getOutput(), $error));
|
||||
}
|
||||
|
||||
public function testOnConsoleTerminateForNonZeroExitCodeWritesToLog()
|
||||
{
|
||||
$logger = $this->getLogger();
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('debug')
|
||||
->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run', 'code' => 255])
|
||||
;
|
||||
|
||||
$listener = new ErrorListener($logger);
|
||||
$listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(['console.php', 'test:run']), 255));
|
||||
}
|
||||
|
||||
public function testOnConsoleTerminateForZeroExitCodeDoesNotWriteToLog()
|
||||
{
|
||||
$logger = $this->getLogger();
|
||||
$logger
|
||||
->expects($this->never())
|
||||
->method('debug')
|
||||
;
|
||||
|
||||
$listener = new ErrorListener($logger);
|
||||
$listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(['console.php', 'test:run']), 0));
|
||||
}
|
||||
|
||||
public function testGetSubscribedEvents()
|
||||
{
|
||||
$this->assertEquals(
|
||||
[
|
||||
'console.error' => ['onConsoleError', -128],
|
||||
'console.terminate' => ['onConsoleTerminate', -128],
|
||||
],
|
||||
ErrorListener::getSubscribedEvents()
|
||||
);
|
||||
}
|
||||
|
||||
public function testAllKindsOfInputCanBeLogged()
|
||||
{
|
||||
$logger = $this->getLogger();
|
||||
$logger
|
||||
->expects($this->exactly(3))
|
||||
->method('debug')
|
||||
->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run --foo=bar', 'code' => 255])
|
||||
;
|
||||
|
||||
$listener = new ErrorListener($logger);
|
||||
$listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArgvInput(['console.php', 'test:run', '--foo=bar']), 255));
|
||||
$listener->onConsoleTerminate($this->getConsoleTerminateEvent(new ArrayInput(['name' => 'test:run', '--foo' => 'bar']), 255));
|
||||
$listener->onConsoleTerminate($this->getConsoleTerminateEvent(new StringInput('test:run --foo=bar'), 255));
|
||||
}
|
||||
|
||||
public function testCommandNameIsDisplayedForNonStringableInput()
|
||||
{
|
||||
$logger = $this->getLogger();
|
||||
$logger
|
||||
->expects($this->once())
|
||||
->method('debug')
|
||||
->with('Command "{command}" exited with code "{code}"', ['command' => 'test:run', 'code' => 255])
|
||||
;
|
||||
|
||||
$listener = new ErrorListener($logger);
|
||||
$listener->onConsoleTerminate($this->getConsoleTerminateEvent($this->getMockBuilder(InputInterface::class)->getMock(), 255));
|
||||
}
|
||||
|
||||
private function getLogger()
|
||||
{
|
||||
return $this->getMockForAbstractClass(LoggerInterface::class);
|
||||
}
|
||||
|
||||
private function getConsoleTerminateEvent(InputInterface $input, $exitCode)
|
||||
{
|
||||
return new ConsoleTerminateEvent(new Command('test:run'), $input, $this->getOutput(), $exitCode);
|
||||
}
|
||||
|
||||
private function getOutput()
|
||||
{
|
||||
return $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
}
|
||||
}
|
||||
|
||||
class NonStringInput extends Input
|
||||
{
|
||||
public function getFirstArgument()
|
||||
{
|
||||
}
|
||||
|
||||
public function hasParameterOption($values, $onlyParams = false)
|
||||
{
|
||||
}
|
||||
|
||||
public function getParameterOption($values, $default = false, $onlyParams = false)
|
||||
{
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
class BarBucCommand extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('bar:buc');
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?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\Console\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
class DescriptorApplication2 extends Application
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('My Symfony application', 'v1.0');
|
||||
$this->add(new DescriptorCommand1());
|
||||
$this->add(new DescriptorCommand2());
|
||||
$this->add(new DescriptorCommand3());
|
||||
$this->add(new DescriptorCommand4());
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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\Console\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
class DescriptorApplicationMbString extends Application
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('MbString åpplicätion');
|
||||
|
||||
$this->add(new DescriptorCommandMbString());
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<?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\Console\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
|
||||
class DescriptorCommand1 extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('descriptor:command1')
|
||||
->setAliases(['alias1', 'alias2'])
|
||||
->setDescription('command 1 description')
|
||||
->setHelp('command 1 help')
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?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\Console\Tests\Fixtures;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class DescriptorCommand2 extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('descriptor:command2')
|
||||
->setDescription('command 2 description')
|
||||
->setHelp('command 2 help')
|
||||
->addUsage('-o|--option_name <argument_name>')
|
||||
->addUsage('<argument_name>')
|
||||
->addArgument('argument_name', InputArgument::REQUIRED)
|
||||
->addOption('option_name', 'o', InputOption::VALUE_NONE)
|
||||
;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user