1
0
Fork 0

Merge pull request #6982 from carusogabriel/phpstan

Fixes from PHPStan level 0
pull/7015/merge
Jordi Boggiano 2018-01-22 14:50:43 +01:00 committed by GitHub
commit ea9b7ecbb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 18 additions and 12 deletions

View File

@ -34,7 +34,7 @@ use Symfony\Component\Console\Output\OutputInterface;
*/ */
class DiagnoseCommand extends BaseCommand class DiagnoseCommand extends BaseCommand
{ {
/** @var RemoteFileSystem */ /** @var RemoteFilesystem */
protected $rfs; protected $rfs;
/** @var ProcessExecutor */ /** @var ProcessExecutor */

View File

@ -279,7 +279,7 @@ EOT
$minimumStability = $input->getOption('stability') ?: null; $minimumStability = $input->getOption('stability') ?: null;
$minimumStability = $io->askAndValidate( $minimumStability = $io->askAndValidate(
'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ', 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
function ($value) use ($self, $minimumStability) { function ($value) use ($minimumStability) {
if (null === $value) { if (null === $value) {
return $minimumStability; return $minimumStability;
} }

View File

@ -41,6 +41,7 @@ abstract class Rule
const BITFIELD_DISABLED = 16; const BITFIELD_DISABLED = 16;
protected $bitfield; protected $bitfield;
protected $job;
protected $reasonData; protected $reasonData;
/** /**

View File

@ -30,7 +30,7 @@ class Solver
protected $pool; protected $pool;
/** @var RepositoryInterface */ /** @var RepositoryInterface */
protected $installed; protected $installed;
/** @var Ruleset */ /** @var RuleSet */
protected $rules; protected $rules;
/** @var RuleSetGenerator */ /** @var RuleSetGenerator */
protected $ruleSetGenerator; protected $ruleSetGenerator;

View File

@ -546,7 +546,7 @@ class Factory
$im->addInstaller(new Installer\LibraryInstaller($io, $composer, null)); $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
$im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library')); $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
$im->addInstaller(new Installer\PluginInstaller($io, $composer)); $im->addInstaller(new Installer\PluginInstaller($io, $composer));
$im->addInstaller(new Installer\MetapackageInstaller($io)); $im->addInstaller(new Installer\MetapackageInstaller());
} }
/** /**

View File

@ -32,9 +32,8 @@ class PluginInstaller extends LibraryInstaller
* *
* @param IOInterface $io * @param IOInterface $io
* @param Composer $composer * @param Composer $composer
* @param string $type
*/ */
public function __construct(IOInterface $io, Composer $composer, $type = 'library') public function __construct(IOInterface $io, Composer $composer)
{ {
parent::__construct($io, $composer, 'composer-plugin'); parent::__construct($io, $composer, 'composer-plugin');
$this->installationManager = $composer->getInstallationManager(); $this->installationManager = $composer->getInstallationManager();

View File

@ -229,7 +229,7 @@ class JsonManipulator
// child exists // child exists
$childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x'; $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
if ($this->pregMatch($childRegex, $children, $matches)) { if ($this->pregMatch($childRegex, $children, $matches)) {
$children = preg_replace_callback($childRegex, function ($matches) use ($name, $subName, $value, $that) { $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
if ($subName !== null) { if ($subName !== null) {
$curVal = json_decode($matches['content'], true); $curVal = json_decode($matches['content'], true);
if (!is_array($curVal)) { if (!is_array($curVal)) {

View File

@ -71,7 +71,7 @@ abstract class BaseExcludeFilter
* Processes a file containing exclude rules of different formats per line * Processes a file containing exclude rules of different formats per line
* *
* @param array $lines A set of lines to be parsed * @param array $lines A set of lines to be parsed
* @param callback $lineParser The parser to be used on each line * @param callable $lineParser The parser to be used on each line
* *
* @return array Exclude patterns to be used in filter() * @return array Exclude patterns to be used in filter()
*/ */

View File

@ -68,7 +68,7 @@ interface RepositoryInterface extends \Countable
* @param string $query search query * @param string $query search query
* @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only * @param int $mode a set of SEARCH_* constants to search on, implementations should do a best effort only
* *
* @return \array[] an array of array('name' => '...', 'description' => '...') * @return array[] an array of array('name' => '...', 'description' => '...')
*/ */
public function search($query, $mode = 0); public function search($query, $mode = 0);
} }

View File

@ -22,6 +22,7 @@ use PHPUnit\Framework\TestCase;
class RuleSetIteratorTest extends TestCase class RuleSetIteratorTest extends TestCase
{ {
protected $rules; protected $rules;
protected $pool;
protected function setUp() protected function setUp()
{ {

View File

@ -20,6 +20,8 @@ use PHPUnit\Framework\TestCase;
class InstallationManagerTest extends TestCase class InstallationManagerTest extends TestCase
{ {
protected $repository;
public function setUp() public function setUp()
{ {
$this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface'); $this->repository = $this->getMock('Composer\Repository\InstalledRepositoryInterface');

View File

@ -20,6 +20,8 @@ use Composer\Downloader\TransportException;
*/ */
class RemoteFilesystemMock extends RemoteFilesystem class RemoteFilesystemMock extends RemoteFilesystem
{ {
protected $contentMap;
/** /**
* @param array $contentMap associative array of locations and content * @param array $contentMap associative array of locations and content
*/ */

View File

@ -22,6 +22,7 @@ class PerforceTest extends TestCase
{ {
protected $perforce; protected $perforce;
protected $processExecutor; protected $processExecutor;
protected $repoConfig;
protected $io; protected $io;
const TEST_DEPOT = 'depot'; const TEST_DEPOT = 'depot';
@ -224,7 +225,7 @@ class PerforceTest extends TestCase
'p4user' => 'user', 'p4user' => 'user',
'p4password' => 'TEST_PASSWORD', 'p4password' => 'TEST_PASSWORD',
); );
$this->perforce = new Perforce($repoConfig, 'port', 'path', $this->processExecutor, false, $this->getMockIOInterface(), 'TEST'); $this->perforce = new Perforce($repoConfig, 'port', 'path', $this->processExecutor, false, $this->getMockIOInterface());
$password = $this->perforce->queryP4Password(); $password = $this->perforce->queryP4Password();
$this->assertEquals('TEST_PASSWORD', $password); $this->assertEquals('TEST_PASSWORD', $password);
} }
@ -289,7 +290,7 @@ class PerforceTest extends TestCase
$this->assertStringStartsWith($expected, fgets($stream)); $this->assertStringStartsWith($expected, fgets($stream));
} }
$this->assertFalse(fgets($stream)); $this->assertFalse(fgets($stream));
} catch (Exception $e) { } catch (\Exception $e) {
fclose($stream); fclose($stream);
throw $e; throw $e;
} }
@ -310,7 +311,7 @@ class PerforceTest extends TestCase
$this->assertStringStartsWith($expected, fgets($stream)); $this->assertStringStartsWith($expected, fgets($stream));
} }
$this->assertFalse(fgets($stream)); $this->assertFalse(fgets($stream));
} catch (Exception $e) { } catch (\Exception $e) {
fclose($stream); fclose($stream);
throw $e; throw $e;
} }