From 5b067a1b298bf9485015df76b5cab0777a92b964 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 25 May 2022 22:02:22 +0200 Subject: [PATCH] Update phpstan to latest --- composer.lock | 12 ++++++------ src/Composer/Console/Application.php | 3 ++- src/Composer/DependencyResolver/RuleSetIterator.php | 4 ++-- src/Composer/Package/BasePackage.php | 1 - src/Composer/Util/Platform.php | 3 +++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/composer.lock b/composer.lock index 6c6c67a8c..5850e2813 100644 --- a/composer.lock +++ b/composer.lock @@ -1825,16 +1825,16 @@ "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.6.8", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "d76498c5531232cb8386ceb6004f7e013138d3ba" + "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d76498c5531232cb8386ceb6004f7e013138d3ba", - "reference": "d76498c5531232cb8386ceb6004f7e013138d3ba", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", + "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", "shasum": "" }, "require": { @@ -1860,7 +1860,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.6.8" + "source": "https://github.com/phpstan/phpstan/tree/1.7.1" }, "funding": [ { @@ -1880,7 +1880,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T06:54:21+00:00" + "time": "2022-05-24T09:05:09+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index ba140a149..dac353a94 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -135,7 +135,8 @@ class Application extends BaseApplication $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins'); $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts'); - if (Platform::getEnv('COMPOSER_NO_INTERACTION') || !Platform::isTty(defined('STDIN') ? STDIN : fopen('php://stdin', 'r'))) { + $stdin = defined('STDIN') ? STDIN : fopen('php://stdin', 'r'); + if (Platform::getEnv('COMPOSER_NO_INTERACTION') || $stdin === false || !Platform::isTty($stdin)) { $input->setInteractive(false); } diff --git a/src/Composer/DependencyResolver/RuleSetIterator.php b/src/Composer/DependencyResolver/RuleSetIterator.php index 3d30c5d7e..2bf67f55b 100644 --- a/src/Composer/DependencyResolver/RuleSetIterator.php +++ b/src/Composer/DependencyResolver/RuleSetIterator.php @@ -75,7 +75,7 @@ class RuleSetIterator implements \Iterator } $this->currentType = $this->types[$this->currentTypeOffset]; - } while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType])); + } while (0 === \count($this->rules[$this->currentType])); } } @@ -95,7 +95,7 @@ class RuleSetIterator implements \Iterator } $this->currentType = $this->types[$this->currentTypeOffset]; - } while (isset($this->types[$this->currentTypeOffset]) && !\count($this->rules[$this->currentType])); + } while (0 === \count($this->rules[$this->currentType])); } public function valid(): bool diff --git a/src/Composer/Package/BasePackage.php b/src/Composer/Package/BasePackage.php index b815aec53..df9b3ce29 100644 --- a/src/Composer/Package/BasePackage.php +++ b/src/Composer/Package/BasePackage.php @@ -53,7 +53,6 @@ abstract class BasePackage implements PackageInterface * READ-ONLY: The package id, public for fast access in dependency solver * @var int * @internal - * @readonly */ public $id; /** @var string */ diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index be37ba621..d27bda08c 100644 --- a/src/Composer/Util/Platform.php +++ b/src/Composer/Util/Platform.php @@ -201,6 +201,9 @@ class Platform { if ($fd === null) { $fd = defined('STDOUT') ? STDOUT : fopen('php://stdout', 'w'); + if ($fd === false) { + return false; + } } // detect msysgit/mingw and assume this is a tty because detection