diff --git a/phpstan/config.neon b/phpstan/config.neon index d1a078e1e..0707dac8b 100644 --- a/phpstan/config.neon +++ b/phpstan/config.neon @@ -36,8 +36,11 @@ parameters: - '~^Call to an undefined method (PHPUnit\\Framework\\MockObject\\MockObject|Prophecy\\Prophecy\\ObjectProphecy)::.*$~' # Level 6 TODO - #- '~parameter .*? with no return typehint specified.$~' + #- '~parameter .*? with no typehint specified.$~' + #- '~parameter .*? with no value type specified in iterable type array.$~' #- '~has no return typehint specified.$~' + #- '~return type has no value type specified in iterable type array.$~' + #- '~ignorePlatformReqs~' bootstrapFiles: - ../tests/bootstrap.php diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index fd67bb0c3..a43254a25 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -33,8 +33,8 @@ class ClassMapGenerator /** * Generate a class map file * - * @param \Traversable|string[] $dirs Directories or a single path to search in - * @param string $file The name of the class map file + * @param \Traversable|array $dirs Directories or a single path to search in + * @param string $file The name of the class map file */ public static function dump($dirs, $file) { @@ -50,11 +50,11 @@ class ClassMapGenerator /** * Iterate over all files in the given directory searching for classes * - * @param \Traversable|string|string[] $path The path to search in or an iterator - * @param string $excluded Regex that matches file paths to be excluded from the classmap - * @param ?IOInterface $io IO object - * @param ?string $namespace Optional namespace prefix to filter by - * @param ?string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules + * @param \Traversable|string|array $path The path to search in or an iterator + * @param string $excluded Regex that matches file paths to be excluded from the classmap + * @param ?IOInterface $io IO object + * @param ?string $namespace Optional namespace prefix to filter by + * @param ?string $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules * * @throws \RuntimeException When the path is neither an existing file nor directory * @return array A class map array diff --git a/src/Composer/Command/BaseDependencyCommand.php b/src/Composer/Command/BaseDependencyCommand.php index aabacd995..962c1b2ce 100644 --- a/src/Composer/Command/BaseDependencyCommand.php +++ b/src/Composer/Command/BaseDependencyCommand.php @@ -40,6 +40,7 @@ class BaseDependencyCommand extends BaseCommand const OPTION_RECURSIVE = 'recursive'; const OPTION_TREE = 'tree'; + /** @var ?string[] */ protected $colors; /** @@ -202,7 +203,7 @@ class BaseDependencyCommand extends BaseCommand /** * @var PackageInterface $package * @var Link $link - * @var array|bool $children + * @var array|bool $children */ list($package, $link, $children) = $result; diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index e6ebadd25..c8888f07e 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -46,7 +46,7 @@ class InitCommand extends BaseCommand /** @var ?CompositeRepository */ protected $repos; - /** @var array */ + /** @var array */ private $gitConfig; /** @var RepositorySet[] */ diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 094b5df55..578e2a208 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -38,10 +38,15 @@ use Composer\Util\Silencer; */ class RequireCommand extends InitCommand { + /** @var bool */ private $newlyCreated; + /** @var bool */ private $firstRequire; + /** @var JsonFile */ private $json; + /** @var string */ private $file; + /** @var string */ private $composerBackup; /** @var string file name */ private $lock; diff --git a/src/Composer/Command/RunScriptCommand.php b/src/Composer/Command/RunScriptCommand.php index 1ecf1e0c1..81b625786 100644 --- a/src/Composer/Command/RunScriptCommand.php +++ b/src/Composer/Command/RunScriptCommand.php @@ -27,7 +27,7 @@ use Symfony\Component\Console\Output\OutputInterface; class RunScriptCommand extends BaseCommand { /** - * @var array Array with command events + * @var string[] Array with command events */ protected $scriptEvents = array( ScriptEvents::PRE_INSTALL_CMD, diff --git a/src/Composer/Command/ScriptAliasCommand.php b/src/Composer/Command/ScriptAliasCommand.php index 455f7420c..63f0f9e6a 100644 --- a/src/Composer/Command/ScriptAliasCommand.php +++ b/src/Composer/Command/ScriptAliasCommand.php @@ -22,7 +22,9 @@ use Symfony\Component\Console\Output\OutputInterface; */ class ScriptAliasCommand extends BaseCommand { + /** @var string */ private $script; + /** @var string */ private $description; public function __construct($script, $description) diff --git a/src/Composer/Command/SearchCommand.php b/src/Composer/Command/SearchCommand.php index 1302a196f..8b51d530a 100644 --- a/src/Composer/Command/SearchCommand.php +++ b/src/Composer/Command/SearchCommand.php @@ -29,12 +29,6 @@ use Composer\Plugin\PluginEvents; */ class SearchCommand extends BaseCommand { - protected $matches; - protected $lowMatches = array(); - protected $tokens; - protected $output; - protected $onlyName; - protected function configure() { $this diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index dd26bbe7c..057edc40e 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -52,6 +52,7 @@ class ShowCommand extends BaseCommand { /** @var VersionParser */ protected $versionParser; + /** @var string[] */ protected $colors; /** @var ?RepositorySet */ diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index c3404d6d3..bdc9b2a32 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -56,6 +56,7 @@ class Application extends BaseApplication */ protected $io; + /** @var string */ private static $logo = ' ______ / ____/___ ____ ___ ____ ____ ________ _____ / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/ @@ -64,7 +65,9 @@ class Application extends BaseApplication /_/ '; + /** @var bool */ private $hasPluginCommands = false; + /** @var bool */ private $disablePluginsByDefault = false; /** diff --git a/src/Composer/Console/HtmlOutputFormatter.php b/src/Composer/Console/HtmlOutputFormatter.php index 994fcbcd5..acef97325 100644 --- a/src/Composer/Console/HtmlOutputFormatter.php +++ b/src/Composer/Console/HtmlOutputFormatter.php @@ -19,6 +19,7 @@ use Symfony\Component\Console\Formatter\OutputFormatter; */ class HtmlOutputFormatter extends OutputFormatter { + /** @var array */ private static $availableForegroundColors = array( 30 => 'black', 31 => 'red', @@ -29,6 +30,7 @@ class HtmlOutputFormatter extends OutputFormatter 36 => 'cyan', 37 => 'white', ); + /** @var array */ private static $availableBackgroundColors = array( 40 => 'black', 41 => 'red', @@ -39,6 +41,7 @@ class HtmlOutputFormatter extends OutputFormatter 46 => 'cyan', 47 => 'white', ); + /** @var array */ private static $availableOptions = array( 1 => 'bold', 4 => 'underscore', diff --git a/src/Composer/Downloader/FileDownloader.php b/src/Composer/Downloader/FileDownloader.php index 7683d3d21..e915d6995 100644 --- a/src/Composer/Downloader/FileDownloader.php +++ b/src/Composer/Downloader/FileDownloader.php @@ -59,8 +59,11 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface protected $process; /** * @private this is only public for php 5.3 support in closures + * + * @var array Map of package name to cache key */ public $lastCacheWrites = array(); + /** @var array Map of package name to list of paths */ private $additionalCleanupPaths = array(); /** diff --git a/src/Composer/Downloader/SvnDownloader.php b/src/Composer/Downloader/SvnDownloader.php index 2a5880aac..f36b04917 100644 --- a/src/Composer/Downloader/SvnDownloader.php +++ b/src/Composer/Downloader/SvnDownloader.php @@ -23,6 +23,7 @@ use Composer\Util\ProcessExecutor; */ class SvnDownloader extends VcsDownloader { + /** @var bool */ protected $cacheCredentials = true; /** diff --git a/src/Composer/EventDispatcher/Event.php b/src/Composer/EventDispatcher/Event.php index 2091f6be0..51cfda4f8 100644 --- a/src/Composer/EventDispatcher/Event.php +++ b/src/Composer/EventDispatcher/Event.php @@ -25,12 +25,12 @@ class Event protected $name; /** - * @var array Arguments passed by the user, these will be forwarded to CLI script handlers + * @var string[] Arguments passed by the user, these will be forwarded to CLI script handlers */ protected $args; /** - * @var array Flags usable in PHP script handlers + * @var mixed[] Flags usable in PHP script handlers */ protected $flags; @@ -42,9 +42,9 @@ class Event /** * Constructor. * - * @param string $name The event name - * @param array $args Arguments passed by the user - * @param array $flags Optional flags to pass data not as argument + * @param string $name The event name + * @param string[] $args Arguments passed by the user + * @param mixed[] $flags Optional flags to pass data not as argument */ public function __construct($name, array $args = array(), array $flags = array()) { @@ -66,7 +66,7 @@ class Event /** * Returns the event's arguments. * - * @return array The event arguments + * @return string[] The event arguments */ public function getArguments() { @@ -76,7 +76,7 @@ class Event /** * Returns the event's flags. * - * @return array The event flags + * @return mixed[] The event flags */ public function getFlags() { diff --git a/src/Composer/IO/BaseIO.php b/src/Composer/IO/BaseIO.php index 44bd73062..380902fa7 100644 --- a/src/Composer/IO/BaseIO.php +++ b/src/Composer/IO/BaseIO.php @@ -18,6 +18,7 @@ use Psr\Log\LogLevel; abstract class BaseIO implements IOInterface { + /** @var array */ protected $authentications = array(); /** diff --git a/src/Composer/Json/JsonFile.php b/src/Composer/Json/JsonFile.php index 53cf5534f..1f830452c 100644 --- a/src/Composer/Json/JsonFile.php +++ b/src/Composer/Json/JsonFile.php @@ -36,16 +36,19 @@ class JsonFile const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json'; + /** @var string */ private $path; + /** @var ?HttpDownloader */ private $httpDownloader; + /** @var ?IOInterface */ private $io; /** * Initializes json file reader/parser. * * @param string $path path to a lockfile - * @param HttpDownloader $httpDownloader required for loading http/https json files - * @param IOInterface $io + * @param ?HttpDownloader $httpDownloader required for loading http/https json files + * @param ?IOInterface $io * @throws \InvalidArgumentException */ public function __construct($path, HttpDownloader $httpDownloader = null, IOInterface $io = null) diff --git a/src/Composer/Json/JsonManipulator.php b/src/Composer/Json/JsonManipulator.php index ecb15878b..b1c82a687 100644 --- a/src/Composer/Json/JsonManipulator.php +++ b/src/Composer/Json/JsonManipulator.php @@ -19,6 +19,7 @@ use Composer\Repository\PlatformRepository; */ class JsonManipulator { + /** @var string */ private static $DEFINES = '(?(DEFINE) (? -? (?= [1-9]|0(?!\d) ) \d++ (\.\d++)? ([eE] [+-]?+ \d++)? ) (? true | false | null ) @@ -29,8 +30,11 @@ class JsonManipulator (? \s*+ (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) ) )'; + /** @var string */ private $contents; + /** @var string */ private $newline; + /** @var string */ private $indent; public function __construct($contents) diff --git a/src/Composer/Json/JsonValidationException.php b/src/Composer/Json/JsonValidationException.php index 2d113a802..e4533f672 100644 --- a/src/Composer/Json/JsonValidationException.php +++ b/src/Composer/Json/JsonValidationException.php @@ -19,14 +19,24 @@ use Exception; */ class JsonValidationException extends Exception { + /** + * @var string[] + */ protected $errors; + /** + * @param string $message + * @param string[] $errors + */ public function __construct($message, $errors = array(), Exception $previous = null) { $this->errors = $errors; parent::__construct((string) $message, 0, $previous); } + /** + * @return string[] + */ public function getErrors() { return $this->errors; diff --git a/src/Composer/Question/StrictConfirmationQuestion.php b/src/Composer/Question/StrictConfirmationQuestion.php index c64890b8d..19432201d 100644 --- a/src/Composer/Question/StrictConfirmationQuestion.php +++ b/src/Composer/Question/StrictConfirmationQuestion.php @@ -24,7 +24,9 @@ use Symfony\Component\Console\Question\Question; */ class StrictConfirmationQuestion extends Question { + /** @var string */ private $trueAnswerRegex; + /** @var string */ private $falseAnswerRegex; /** diff --git a/src/Composer/SelfUpdate/Versions.php b/src/Composer/SelfUpdate/Versions.php index 45bc4272f..591c11253 100644 --- a/src/Composer/SelfUpdate/Versions.php +++ b/src/Composer/SelfUpdate/Versions.php @@ -20,11 +20,16 @@ use Composer\Config; */ class Versions { + /** @var string[] */ public static $channels = array('stable', 'preview', 'snapshot', '1', '2'); + /** @var HttpDownloader */ private $httpDownloader; + /** @var Config */ private $config; + /** @var string */ private $channel; + /** @var array> */ private $versionsData; public function __construct(Config $config, HttpDownloader $httpDownloader) diff --git a/src/Composer/Util/AuthHelper.php b/src/Composer/Util/AuthHelper.php index deb0a4c39..b8dc44407 100644 --- a/src/Composer/Util/AuthHelper.php +++ b/src/Composer/Util/AuthHelper.php @@ -21,8 +21,11 @@ use Composer\Downloader\TransportException; */ class AuthHelper { + /** @var IOInterface */ protected $io; + /** @var Config */ protected $config; + /** @var array Map of origins to message displayed */ private $displayedOriginAuthentications = array(); public function __construct(IOInterface $io, Config $config) diff --git a/src/Composer/Util/ConfigValidator.php b/src/Composer/Util/ConfigValidator.php index dd2cbcb0d..a73b91651 100644 --- a/src/Composer/Util/ConfigValidator.php +++ b/src/Composer/Util/ConfigValidator.php @@ -30,6 +30,7 @@ class ConfigValidator { const CHECK_VERSION = 1; + /** @var IOInterface */ private $io; public function __construct(IOInterface $io) diff --git a/src/Composer/Util/ErrorHandler.php b/src/Composer/Util/ErrorHandler.php index 15e1832e9..cbe42f4b8 100644 --- a/src/Composer/Util/ErrorHandler.php +++ b/src/Composer/Util/ErrorHandler.php @@ -21,6 +21,7 @@ use Composer\IO\IOInterface; */ class ErrorHandler { + /** @var ?IOInterface */ private static $io; /** diff --git a/src/Composer/Util/Git.php b/src/Composer/Util/Git.php index 67d42b7c2..a0a389215 100644 --- a/src/Composer/Util/Git.php +++ b/src/Composer/Util/Git.php @@ -20,6 +20,7 @@ use Composer\IO\IOInterface; */ class Git { + /** @var string|false|null */ private static $version = false; /** @var IOInterface */ diff --git a/src/Composer/Util/Hg.php b/src/Composer/Util/Hg.php index fe0649dbb..b6321c17a 100644 --- a/src/Composer/Util/Hg.php +++ b/src/Composer/Util/Hg.php @@ -20,6 +20,7 @@ use Composer\IO\IOInterface; */ class Hg { + /** @var string|false|null */ private static $version = false; /** diff --git a/tests/Composer/Test/TestCase.php b/tests/Composer/Test/TestCase.php index 0b38c6d73..157d9dbdc 100644 --- a/tests/Composer/Test/TestCase.php +++ b/tests/Composer/Test/TestCase.php @@ -27,6 +27,9 @@ abstract class TestCase extends PolyfillTestCase private static $parser; private static $executableCache = array(); + /** + * @return string + */ public static function getUniqueTmpDirectory() { $attempts = 5;