updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -40,7 +40,7 @@ final class Console
if ($this->isWindows()) {
// @codeCoverageIgnoreStart
return (\defined('STDOUT') && \function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(\STDOUT))
return (\defined('STDOUT') && \function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support(\STDOUT))
|| false !== \getenv('ANSICON')
|| 'ON' === \getenv('ConEmuANSI')
|| 'xterm' === \getenv('TERM');
@@ -53,13 +53,7 @@ final class Console
// @codeCoverageIgnoreEnd
}
if ($this->isInteractive(\STDOUT)) {
return true;
}
$stat = @\fstat(\STDOUT);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
return $this->isInteractive(\STDOUT);
}
/**
@@ -69,14 +63,14 @@ final class Console
*/
public function getNumberOfColumns(): int
{
if ($this->isWindows()) {
return $this->getNumberOfColumnsWindows();
}
if (!$this->isInteractive(\defined('STDIN') ? \STDIN : self::STDIN)) {
return 80;
}
if ($this->isWindows()) {
return $this->getNumberOfColumnsWindows();
}
return $this->getNumberOfColumnsInteractive();
}
@@ -90,8 +84,18 @@ final class Console
*/
public function isInteractive($fileDescriptor = self::STDOUT): bool
{
return (\is_resource($fileDescriptor) && \function_exists('stream_isatty') && @\stream_isatty($fileDescriptor)) // stream_isatty requires that descriptor is a real resource, not numeric ID of it
|| (\function_exists('posix_isatty') && @\posix_isatty($fileDescriptor));
if (\is_resource($fileDescriptor)) {
// These functions require a descriptor that is a real resource, not a numeric ID of it
if (\function_exists('stream_isatty') && @\stream_isatty($fileDescriptor)) {
return true;
}
$stat = @\fstat(\STDOUT);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
}
return \function_exists('posix_isatty') && @\posix_isatty($fileDescriptor);
}
private function isWindows(): bool
@@ -104,13 +108,13 @@ final class Console
*/
private function getNumberOfColumnsInteractive(): int
{
if (\function_exists('shell_exec') && \preg_match('#\d+ (\d+)#', \shell_exec('stty size') ?? '', $match) === 1) {
if (\function_exists('shell_exec') && \preg_match('#\d+ (\d+)#', \shell_exec('stty size') ?: '', $match) === 1) {
if ((int) $match[1] > 0) {
return (int) $match[1];
}
}
if (\function_exists('shell_exec') && \preg_match('#columns = (\d+);#', \shell_exec('stty') ?? '', $match) === 1) {
if (\function_exists('shell_exec') && \preg_match('#columns = (\d+);#', \shell_exec('stty') ?: '', $match) === 1) {
if ((int) $match[1] > 0) {
return (int) $match[1];
}