diff vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 1fec387a4317
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php	Thu Apr 26 11:26:54 2018 +0100
+++ b/vendor/symfony/phpunit-bridge/DeprecationErrorHandler.php	Tue Jul 10 15:07:59 2018 +0100
@@ -297,17 +297,38 @@
         });
     }
 
+    /**
+     * Returns true if STDOUT is defined and supports colorization.
+     *
+     * Reference: Composer\XdebugHandler\Process::supportsColor
+     * https://github.com/composer/xdebug-handler
+     *
+     * @return bool
+     */
     private static function hasColorSupport()
     {
-        if ('\\' === DIRECTORY_SEPARATOR) {
-            return
-                defined('STDOUT') && function_exists('sapi_windows_vt100_support') && sapi_windows_vt100_support(STDOUT)
-                || '10.0.10586' === PHP_WINDOWS_VERSION_MAJOR.'.'.PHP_WINDOWS_VERSION_MINOR.'.'.PHP_WINDOWS_VERSION_BUILD
+        if (!defined('STDOUT')) {
+            return false;
+        }
+
+        if (DIRECTORY_SEPARATOR === '\\') {
+            return (function_exists('sapi_windows_vt100_support')
+                && sapi_windows_vt100_support(STDOUT))
                 || false !== getenv('ANSICON')
                 || 'ON' === getenv('ConEmuANSI')
                 || 'xterm' === getenv('TERM');
         }
 
-        return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT);
+        if (function_exists('stream_isatty')) {
+            return stream_isatty(STDOUT);
+        }
+
+        if (function_exists('posix_isatty')) {
+            return posix_isatty(STDOUT);
+        }
+
+        $stat = fstat(STDOUT);
+        // Check if formatted mode is S_IFCHR
+        return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
     }
 }