1
0
Fork 0

Add type info to many properties/methods

pull/10086/head
Jordi Boggiano 2021-08-30 14:14:19 +02:00
parent fc04c86f82
commit 0761474599
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
26 changed files with 77 additions and 26 deletions

View File

@ -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

View File

@ -33,7 +33,7 @@ class ClassMapGenerator
/**
* Generate a class map file
*
* @param \Traversable|string[] $dirs Directories or a single path to search in
* @param \Traversable|array<string> $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,7 +50,7 @@ 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 \Traversable|string|array<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

View File

@ -40,6 +40,7 @@ class BaseDependencyCommand extends BaseCommand
const OPTION_RECURSIVE = 'recursive';
const OPTION_TREE = 'tree';
/** @var ?string[] */
protected $colors;
/**

View File

@ -46,7 +46,7 @@ class InitCommand extends BaseCommand
/** @var ?CompositeRepository */
protected $repos;
/** @var array */
/** @var array<string, string> */
private $gitConfig;
/** @var RepositorySet[] */

View File

@ -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;

View File

@ -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,

View File

@ -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)

View File

@ -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

View File

@ -52,6 +52,7 @@ class ShowCommand extends BaseCommand
{
/** @var VersionParser */
protected $versionParser;
/** @var string[] */
protected $colors;
/** @var ?RepositorySet */

View File

@ -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;
/**

View File

@ -19,6 +19,7 @@ use Symfony\Component\Console\Formatter\OutputFormatter;
*/
class HtmlOutputFormatter extends OutputFormatter
{
/** @var array<int, string> */
private static $availableForegroundColors = array(
30 => 'black',
31 => 'red',
@ -29,6 +30,7 @@ class HtmlOutputFormatter extends OutputFormatter
36 => 'cyan',
37 => 'white',
);
/** @var array<int, string> */
private static $availableBackgroundColors = array(
40 => 'black',
41 => 'red',
@ -39,6 +41,7 @@ class HtmlOutputFormatter extends OutputFormatter
46 => 'cyan',
47 => 'white',
);
/** @var array<int, string> */
private static $availableOptions = array(
1 => 'bold',
4 => 'underscore',

View File

@ -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<string, string> Map of package name to cache key
*/
public $lastCacheWrites = array();
/** @var array<string, string[]> Map of package name to list of paths */
private $additionalCleanupPaths = array();
/**

View File

@ -23,6 +23,7 @@ use Composer\Util\ProcessExecutor;
*/
class SvnDownloader extends VcsDownloader
{
/** @var bool */
protected $cacheCredentials = true;
/**

View File

@ -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;
@ -43,8 +43,8 @@ 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[] $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()
{

View File

@ -18,6 +18,7 @@ use Psr\Log\LogLevel;
abstract class BaseIO implements IOInterface
{
/** @var array<string, array{username: string, password: string}> */
protected $authentications = array();
/**

View File

@ -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)

View File

@ -19,6 +19,7 @@ use Composer\Repository\PlatformRepository;
*/
class JsonManipulator
{
/** @var string */
private static $DEFINES = '(?(DEFINE)
(?<number> -? (?= [1-9]|0(?!\d) ) \d++ (\.\d++)? ([eE] [+-]?+ \d++)? )
(?<boolean> true | false | null )
@ -29,8 +30,11 @@ class JsonManipulator
(?<json> \s*+ (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
)';
/** @var string */
private $contents;
/** @var string */
private $newline;
/** @var string */
private $indent;
public function __construct($contents)

View File

@ -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;

View File

@ -24,7 +24,9 @@ use Symfony\Component\Console\Question\Question;
*/
class StrictConfirmationQuestion extends Question
{
/** @var string */
private $trueAnswerRegex;
/** @var string */
private $falseAnswerRegex;
/**

View File

@ -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<string, array<int, array{path: string, version: string, min-php: int}>> */
private $versionsData;
public function __construct(Config $config, HttpDownloader $httpDownloader)

View File

@ -21,8 +21,11 @@ use Composer\Downloader\TransportException;
*/
class AuthHelper
{
/** @var IOInterface */
protected $io;
/** @var Config */
protected $config;
/** @var array<string, string> Map of origins to message displayed */
private $displayedOriginAuthentications = array();
public function __construct(IOInterface $io, Config $config)

View File

@ -30,6 +30,7 @@ class ConfigValidator
{
const CHECK_VERSION = 1;
/** @var IOInterface */
private $io;
public function __construct(IOInterface $io)

View File

@ -21,6 +21,7 @@ use Composer\IO\IOInterface;
*/
class ErrorHandler
{
/** @var ?IOInterface */
private static $io;
/**

View File

@ -20,6 +20,7 @@ use Composer\IO\IOInterface;
*/
class Git
{
/** @var string|false|null */
private static $version = false;
/** @var IOInterface */

View File

@ -20,6 +20,7 @@ use Composer\IO\IOInterface;
*/
class Hg
{
/** @var string|false|null */
private static $version = false;
/**

View File

@ -27,6 +27,9 @@ abstract class TestCase extends PolyfillTestCase
private static $parser;
private static $executableCache = array();
/**
* @return string
*/
public static function getUniqueTmpDirectory()
{
$attempts = 5;