Fixes from PHPStan level 0

More fixes from PHPStan level 0
main
Gabriel Caruso 7 years ago
parent 994bac0c15
commit 3d262bd637

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

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

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

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

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

@ -32,9 +32,8 @@ class PluginInstaller extends LibraryInstaller
*
* @param IOInterface $io
* @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');
$this->installationManager = $composer->getInstallationManager();

@ -229,7 +229,7 @@ class JsonManipulator
// child exists
$childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
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) {
$curVal = json_decode($matches['content'], true);
if (!is_array($curVal)) {

@ -71,7 +71,7 @@ abstract class BaseExcludeFilter
* Processes a file containing exclude rules of different formats per line
*
* @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()
*/

@ -68,7 +68,7 @@ interface RepositoryInterface extends \Countable
* @param string $query search query
* @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);
}

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

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

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

@ -22,6 +22,7 @@ class PerforceTest extends TestCase
{
protected $perforce;
protected $processExecutor;
protected $repoConfig;
protected $io;
const TEST_DEPOT = 'depot';
@ -224,7 +225,7 @@ class PerforceTest extends TestCase
'p4user' => 'user',
'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();
$this->assertEquals('TEST_PASSWORD', $password);
}
@ -289,7 +290,7 @@ class PerforceTest extends TestCase
$this->assertStringStartsWith($expected, fgets($stream));
}
$this->assertFalse(fgets($stream));
} catch (Exception $e) {
} catch (\Exception $e) {
fclose($stream);
throw $e;
}
@ -310,7 +311,7 @@ class PerforceTest extends TestCase
$this->assertStringStartsWith($expected, fgets($stream));
}
$this->assertFalse(fgets($stream));
} catch (Exception $e) {
} catch (\Exception $e) {
fclose($stream);
throw $e;
}

Loading…
Cancel
Save