added phpstan on level 0
parent
fb3d0981c0
commit
a062cd1a31
12
.travis.yml
12
.travis.yml
|
@ -23,10 +23,15 @@ matrix:
|
||||||
- php: 5.6
|
- php: 5.6
|
||||||
- php: 7.0
|
- php: 7.0
|
||||||
- php: 7.1
|
- php: 7.1
|
||||||
|
env: PHPSTAN=1
|
||||||
- php: 7.2
|
- php: 7.2
|
||||||
|
env: PHPSTAN=1
|
||||||
- php: 7.3
|
- php: 7.3
|
||||||
|
env: PHPSTAN=1
|
||||||
- php: 7.3
|
- php: 7.3
|
||||||
env: deps=high
|
env:
|
||||||
|
- deps=high
|
||||||
|
- PHPSTAN=1
|
||||||
- php: nightly
|
- php: nightly
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
@ -58,6 +63,11 @@ before_script:
|
||||||
script:
|
script:
|
||||||
# run test suite directories in parallel using GNU parallel
|
# run test suite directories in parallel using GNU parallel
|
||||||
- ls -d tests/Composer/Test/* | grep -v TestCase.php | parallel --gnu --keep-order 'echo "Running {} tests"; ./vendor/bin/phpunit -c tests/complete.phpunit.xml --colors=always {} || (echo -e "\e[41mFAILED\e[0m {}" && exit 1);'
|
- ls -d tests/Composer/Test/* | grep -v TestCase.php | parallel --gnu --keep-order 'echo "Running {} tests"; ./vendor/bin/phpunit -c tests/complete.phpunit.xml --colors=always {} || (echo -e "\e[41mFAILED\e[0m {}" && exit 1);'
|
||||||
|
# Run PHPStan
|
||||||
|
- if [[ $PHPSTAN == "1" ]]; then
|
||||||
|
composer require --dev phpstan/phpstan-shim:^0.11 --ignore-platform-reqs &&
|
||||||
|
vendor/bin/phpstan.phar analyse src tests --configuration=phpstan/config.neon --autoload-file=phpstan/autoload.php;
|
||||||
|
fi
|
||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- php -d phar.readonly=0 bin/compile
|
- php -d phar.readonly=0 bin/compile
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../src/bootstrap.php';
|
|
@ -0,0 +1,38 @@
|
||||||
|
parameters:
|
||||||
|
level: 0
|
||||||
|
excludes_analyse:
|
||||||
|
- 'tests/Composer/Test/Fixtures'
|
||||||
|
- 'tests/Composer/Test/Autoload/Fixtures'
|
||||||
|
- 'tests/Composer/Test/Plugin/Fixtures'
|
||||||
|
ignoreErrors:
|
||||||
|
# unused parameters
|
||||||
|
- '~^Constructor of class Composer\\Repository\\VcsRepository has an unused parameter \$dispatcher\.$~'
|
||||||
|
- '~^Constructor of class Composer\\Repository\\PearRepository has an unused parameter \$dispatcher\.$~'
|
||||||
|
- '~^Constructor of class Composer\\Util\\Http\\CurlDownloader has an unused parameter \$disableTls\.$~'
|
||||||
|
- '~^Constructor of class Composer\\Util\\Http\\CurlDownloader has an unused parameter \$options\.$~'
|
||||||
|
- '~^Constructor of class Composer\\Repository\\PearRepository has an unused parameter \$config\.$~'
|
||||||
|
|
||||||
|
# unused uses
|
||||||
|
- '~^Anonymous function has an unused use \$io\.$~'
|
||||||
|
- '~^Anonymous function has an unused use \$cache\.$~'
|
||||||
|
- '~^Anonymous function has an unused use \$path\.$~'
|
||||||
|
- '~^Anonymous function has an unused use \$fileName\.$~'
|
||||||
|
|
||||||
|
# ion cube is not installed
|
||||||
|
- '~^Function ioncube_loader_\w+ not found\.$~'
|
||||||
|
# rar is not installed
|
||||||
|
- '~^Call to static method open\(\) on an unknown class RarArchive\.$~'
|
||||||
|
# imagick is not installed
|
||||||
|
- '~^Instantiated class Imagick not found\.$~'
|
||||||
|
|
||||||
|
# variables from global scope
|
||||||
|
- '~^Undefined variable: \$vendorDir$~'
|
||||||
|
- '~^Undefined variable: \$baseDir$~'
|
||||||
|
|
||||||
|
# always checked whether the class exists
|
||||||
|
- '~^Instantiated class Symfony\\Component\\Console\\Terminal not found\.$~'
|
||||||
|
- '~^Class Symfony\\Component\\Console\\Input\\StreamableInputInterface not found\.$~'
|
||||||
|
|
||||||
|
# parent call in test mocks
|
||||||
|
- '~^Composer\\Test\\Mock\\HttpDownloaderMock::__construct\(\) does not call parent constructor from Composer\\Util\\HttpDownloader\.$~'
|
||||||
|
- '~^Composer\\Test\\Mock\\InstallationManagerMock::__construct\(\) does not call parent constructor from Composer\\Installer\\InstallationManager\.$~'
|
|
@ -48,7 +48,7 @@ class PoolBuilder
|
||||||
|
|
||||||
public function buildPool(array $repositories, array $rootAliases, Request $request)
|
public function buildPool(array $repositories, array $rootAliases, Request $request)
|
||||||
{
|
{
|
||||||
$this->pool = new Pool($this->filterRequires);
|
$pool = new Pool($this->filterRequires);
|
||||||
$this->rootAliases = $rootAliases;
|
$this->rootAliases = $rootAliases;
|
||||||
|
|
||||||
// TODO do we really want the request here? kind of want a root requirements thingy instead
|
// TODO do we really want the request here? kind of want a root requirements thingy instead
|
||||||
|
@ -133,13 +133,13 @@ class PoolBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pool->setPackages($this->packages, $this->priorities);
|
$pool->setPackages($this->packages, $this->priorities);
|
||||||
|
|
||||||
unset($this->aliasMap);
|
unset($this->aliasMap);
|
||||||
unset($this->loadedNames);
|
unset($this->loadedNames);
|
||||||
unset($this->nameConstraints);
|
unset($this->nameConstraints);
|
||||||
|
|
||||||
return $this->pool;
|
return $pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadPackage(PackageInterface $package, $repoIndex)
|
private function loadPackage(PackageInterface $package, $repoIndex)
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Composer\IO\IOInterface;
|
||||||
*/
|
*/
|
||||||
class GzipDownloader extends ArchiveDownloader
|
class GzipDownloader extends ArchiveDownloader
|
||||||
{
|
{
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
|
||||||
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
||||||
|
|
|
@ -32,6 +32,7 @@ use RarArchive;
|
||||||
*/
|
*/
|
||||||
class RarDownloader extends ArchiveDownloader
|
class RarDownloader extends ArchiveDownloader
|
||||||
{
|
{
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
|
||||||
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
||||||
|
|
|
@ -28,6 +28,7 @@ use Composer\IO\IOInterface;
|
||||||
*/
|
*/
|
||||||
class XzDownloader extends ArchiveDownloader
|
class XzDownloader extends ArchiveDownloader
|
||||||
{
|
{
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
|
||||||
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
||||||
|
|
|
@ -33,7 +33,9 @@ class ZipDownloader extends ArchiveDownloader
|
||||||
private static $hasZipArchive;
|
private static $hasZipArchive;
|
||||||
private static $isWindows;
|
private static $isWindows;
|
||||||
|
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
/** @var ZipArchive|null */
|
||||||
private $zipArchiveObject;
|
private $zipArchiveObject;
|
||||||
|
|
||||||
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
public function __construct(IOInterface $io, Config $config, HttpDownloader $downloader, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null)
|
||||||
|
|
|
@ -31,13 +31,21 @@ use Seld\JsonLint\ParsingException;
|
||||||
*/
|
*/
|
||||||
class Locker
|
class Locker
|
||||||
{
|
{
|
||||||
|
/** @var JsonFile */
|
||||||
private $lockFile;
|
private $lockFile;
|
||||||
|
/** @var RepositoryManager */
|
||||||
private $repositoryManager;
|
private $repositoryManager;
|
||||||
|
/** @var InstallationManager */
|
||||||
private $installationManager;
|
private $installationManager;
|
||||||
|
/** @var string */
|
||||||
private $hash;
|
private $hash;
|
||||||
|
/** @var string */
|
||||||
private $contentHash;
|
private $contentHash;
|
||||||
|
/** @var ArrayLoader */
|
||||||
private $loader;
|
private $loader;
|
||||||
|
/** @var ArrayDumper */
|
||||||
private $dumper;
|
private $dumper;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
private $process;
|
private $process;
|
||||||
private $lockDataCache;
|
private $lockDataCache;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Composer\Repository\Vcs\HgDriver;
|
||||||
use Composer\IO\NullIO;
|
use Composer\IO\NullIO;
|
||||||
use Composer\Semver\VersionParser as SemverVersionParser;
|
use Composer\Semver\VersionParser as SemverVersionParser;
|
||||||
use Composer\Util\Git as GitUtil;
|
use Composer\Util\Git as GitUtil;
|
||||||
|
use Composer\Util\HttpDownloader;
|
||||||
use Composer\Util\ProcessExecutor;
|
use Composer\Util\ProcessExecutor;
|
||||||
use Composer\Util\Svn as SvnUtil;
|
use Composer\Util\Svn as SvnUtil;
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,17 @@ use Composer\Downloader\TransportException;
|
||||||
*/
|
*/
|
||||||
class Bitbucket
|
class Bitbucket
|
||||||
{
|
{
|
||||||
|
/** @var IOInterface */
|
||||||
private $io;
|
private $io;
|
||||||
|
/** @var Config */
|
||||||
private $config;
|
private $config;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
private $process;
|
private $process;
|
||||||
|
/** @var HttpDownloader */
|
||||||
private $httpDownloader;
|
private $httpDownloader;
|
||||||
|
/** @var array */
|
||||||
private $token = array();
|
private $token = array();
|
||||||
|
/** @var int|null */
|
||||||
private $time;
|
private $time;
|
||||||
|
|
||||||
const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
|
const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
|
||||||
|
|
|
@ -23,6 +23,7 @@ use Symfony\Component\Finder\Finder;
|
||||||
*/
|
*/
|
||||||
class Filesystem
|
class Filesystem
|
||||||
{
|
{
|
||||||
|
/** @var ProcessExecutor */
|
||||||
private $processExecutor;
|
private $processExecutor;
|
||||||
|
|
||||||
public function __construct(ProcessExecutor $executor = null)
|
public function __construct(ProcessExecutor $executor = null)
|
||||||
|
@ -537,6 +538,9 @@ class Filesystem
|
||||||
return $size;
|
return $size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return ProcessExecutor
|
||||||
|
*/
|
||||||
protected function getProcess()
|
protected function getProcess()
|
||||||
{
|
{
|
||||||
return $this->processExecutor;
|
return $this->processExecutor;
|
||||||
|
|
|
@ -22,9 +22,13 @@ use Composer\Downloader\TransportException;
|
||||||
*/
|
*/
|
||||||
class GitHub
|
class GitHub
|
||||||
{
|
{
|
||||||
|
/** @var IOInterface */
|
||||||
protected $io;
|
protected $io;
|
||||||
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
/** @var HttpDownloader */
|
||||||
protected $httpDownloader;
|
protected $httpDownloader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,9 +23,13 @@ use Composer\Json\JsonFile;
|
||||||
*/
|
*/
|
||||||
class GitLab
|
class GitLab
|
||||||
{
|
{
|
||||||
|
/** @var IOInterface */
|
||||||
protected $io;
|
protected $io;
|
||||||
|
/** @var Config */
|
||||||
protected $config;
|
protected $config;
|
||||||
|
/** @var ProcessExecutor */
|
||||||
protected $process;
|
protected $process;
|
||||||
|
/** @var HttpDownloader */
|
||||||
protected $httpDownloader;
|
protected $httpDownloader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,7 +20,7 @@ use React\Promise\Promise;
|
||||||
*/
|
*/
|
||||||
class Loop
|
class Loop
|
||||||
{
|
{
|
||||||
private $io;
|
private $httpDownloader;
|
||||||
|
|
||||||
public function __construct(HttpDownloader $httpDownloader)
|
public function __construct(HttpDownloader $httpDownloader)
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,6 +14,7 @@ namespace Composer\Util;
|
||||||
|
|
||||||
use Composer\Composer;
|
use Composer\Composer;
|
||||||
use Composer\CaBundle\CaBundle;
|
use Composer\CaBundle\CaBundle;
|
||||||
|
use Composer\Downloader\TransportException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,6 +20,8 @@ use Composer\Util\Loop;
|
||||||
|
|
||||||
class FileDownloaderTest extends TestCase
|
class FileDownloaderTest extends TestCase
|
||||||
{
|
{
|
||||||
|
private $httpDownloader;
|
||||||
|
|
||||||
protected function getDownloader($io = null, $config = null, $eventDispatcher = null, $cache = null, $httpDownloader = null, $filesystem = null)
|
protected function getDownloader($io = null, $config = null, $eventDispatcher = null, $cache = null, $httpDownloader = null, $filesystem = null)
|
||||||
{
|
{
|
||||||
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||||
|
|
|
@ -25,7 +25,7 @@ class ZipDownloaderTest extends TestCase
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $testDir;
|
private $testDir;
|
||||||
private $prophet;
|
private $httpDownloader;
|
||||||
private $io;
|
private $io;
|
||||||
private $config;
|
private $config;
|
||||||
private $package;
|
private $package;
|
||||||
|
|
Loading…
Reference in New Issue