Skip to content

Commit

Permalink
Bump dependencies (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Oct 30, 2019
1 parent 7870406 commit 58cabb2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 18 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"composer/semver": "^1.5",
"composer/xdebug-handler": "^1.3.2",
"hoa/compiler": "^3.17",
"humbug/php-scoper": "~0.12",
"humbug/php-scoper": "^0.12",
"justinrainbow/json-schema": "^5.2.9",
"nikic/iter": "^2.0",
"nikic/php-parser": "^4.2",
Expand All @@ -56,7 +56,7 @@
"phpseclib/phpseclib": "^2.0",
"psr/log": "^1.0",
"seld/jsonlint": "^1.7",
"symfony/console": "^4.2",
"symfony/console": "^4.3.5",
"symfony/filesystem": "^4.2",
"symfony/finder": "^4.0",
"symfony/process": "^4.2",
Expand Down
24 changes: 12 additions & 12 deletions requirement-checker/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions requirement-checker/expected_terminal_diff
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
> *
> * @license MIT (c) Fabien Potencier <fabien@symfony.com>
> */
96c103
122c129
< return [(int) $matches[2], (int) $matches[1]];
---
> return array((int) $matches[2], (int) $matches[1]);
120,123c127,130
146,149c153,156
< $descriptorspec = [
< 1 => ['pipe', 'w'],
< 2 => ['pipe', 'w'],
Expand All @@ -38,7 +38,7 @@
> 1 => array('pipe', 'w'),
> 2 => array('pipe', 'w'),
> );
125c132
151c158
< $process = proc_open($command, $descriptorspec, $pipes, null, null, ['suppress_errors' => true]);
---
> $process = proc_open($command, $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
28 changes: 27 additions & 1 deletion requirement-checker/src/Terminal.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Terminal
{
private static $width;
private static $height;
private static $stty;

/**
* Gets the terminal width.
Expand Down Expand Up @@ -61,6 +62,22 @@ public function getHeight()
return self::$height ?: 50;
}

/**
* @internal
*
* @return bool
*/
public static function hasSttyAvailable()
{
if (null !== self::$stty) {
return self::$stty;
}

exec('stty 2>&1', $output, $exitcode);

return self::$stty = 0 === $exitcode;
}

private static function initDimensions()
{
if ('\\' === \DIRECTORY_SEPARATOR) {
Expand All @@ -69,12 +86,21 @@ private static function initDimensions()
// or [w, h] from "wxh"
self::$width = (int) $matches[1];
self::$height = isset($matches[4]) ? (int) $matches[4] : (int) $matches[2];
} elseif (self::hasSttyAvailable()) {
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();
}
}

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];
Expand Down

0 comments on commit 58cabb2

Please sign in to comment.