added phpstan on level 0
parent
fb3d0981c0
commit
a062cd1a31
12
.travis.yml
12
.travis.yml
|
@ -23,10 +23,15 @@ matrix:
|
|||
- php: 5.6
|
||||
- php: 7.0
|
||||
- php: 7.1
|
||||
env: PHPSTAN=1
|
||||
- php: 7.2
|
||||
env: PHPSTAN=1
|
||||
- php: 7.3
|
||||
env: PHPSTAN=1
|
||||
- php: 7.3
|
||||
env: deps=high
|
||||
env:
|
||||
- deps=high
|
||||
- PHPSTAN=1
|
||||
- php: nightly
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
|
@ -58,6 +63,11 @@ before_script:
|
|||
script:
|
||||
# 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);'
|
||||
# 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:
|
||||
- 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)
|
||||
{
|
||||
$this->pool = new Pool($this->filterRequires);
|
||||
$pool = new Pool($this->filterRequires);
|
||||
$this->rootAliases = $rootAliases;
|
||||
|
||||
// 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->loadedNames);
|
||||
unset($this->nameConstraints);
|
||||
|
||||
return $this->pool;
|
||||
return $pool;
|
||||
}
|
||||
|
||||
private function loadPackage(PackageInterface $package, $repoIndex)
|
||||
|
|
|
@ -28,6 +28,7 @@ use Composer\IO\IOInterface;
|
|||
*/
|
||||
class GzipDownloader extends ArchiveDownloader
|
||||
{
|
||||
/** @var ProcessExecutor */
|
||||
protected $process;
|
||||
|
||||
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
|
||||
{
|
||||
/** @var ProcessExecutor */
|
||||
protected $process;
|
||||
|
||||
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
|
||||
{
|
||||
/** @var ProcessExecutor */
|
||||
protected $process;
|
||||
|
||||
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 $isWindows;
|
||||
|
||||
/** @var ProcessExecutor */
|
||||
protected $process;
|
||||
/** @var ZipArchive|null */
|
||||
private $zipArchiveObject;
|
||||
|
||||
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
|
||||
{
|
||||
/** @var JsonFile */
|
||||
private $lockFile;
|
||||
/** @var RepositoryManager */
|
||||
private $repositoryManager;
|
||||
/** @var InstallationManager */
|
||||
private $installationManager;
|
||||
/** @var string */
|
||||
private $hash;
|
||||
/** @var string */
|
||||
private $contentHash;
|
||||
/** @var ArrayLoader */
|
||||
private $loader;
|
||||
/** @var ArrayDumper */
|
||||
private $dumper;
|
||||
/** @var ProcessExecutor */
|
||||
private $process;
|
||||
private $lockDataCache;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use Composer\Repository\Vcs\HgDriver;
|
|||
use Composer\IO\NullIO;
|
||||
use Composer\Semver\VersionParser as SemverVersionParser;
|
||||
use Composer\Util\Git as GitUtil;
|
||||
use Composer\Util\HttpDownloader;
|
||||
use Composer\Util\ProcessExecutor;
|
||||
use Composer\Util\Svn as SvnUtil;
|
||||
|
||||
|
|
|
@ -22,11 +22,17 @@ use Composer\Downloader\TransportException;
|
|||
*/
|
||||
class Bitbucket
|
||||
{
|
||||
/** @var IOInterface */
|
||||
private $io;
|
||||
/** @var Config */
|
||||
private $config;
|
||||
/** @var ProcessExecutor */
|
||||
private $process;
|
||||
/** @var HttpDownloader */
|
||||
private $httpDownloader;
|
||||
/** @var array */
|
||||
private $token = array();
|
||||
/** @var int|null */
|
||||
private $time;
|
||||
|
||||
const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
|
||||
|
|
|
@ -23,6 +23,7 @@ use Symfony\Component\Finder\Finder;
|
|||
*/
|
||||
class Filesystem
|
||||
{
|
||||
/** @var ProcessExecutor */
|
||||
private $processExecutor;
|
||||
|
||||
public function __construct(ProcessExecutor $executor = null)
|
||||
|
@ -537,6 +538,9 @@ class Filesystem
|
|||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ProcessExecutor
|
||||
*/
|
||||
protected function getProcess()
|
||||
{
|
||||
return $this->processExecutor;
|
||||
|
|
|
@ -22,9 +22,13 @@ use Composer\Downloader\TransportException;
|
|||
*/
|
||||
class GitHub
|
||||
{
|
||||
/** @var IOInterface */
|
||||
protected $io;
|
||||
/** @var Config */
|
||||
protected $config;
|
||||
/** @var ProcessExecutor */
|
||||
protected $process;
|
||||
/** @var HttpDownloader */
|
||||
protected $httpDownloader;
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,9 +23,13 @@ use Composer\Json\JsonFile;
|
|||
*/
|
||||
class GitLab
|
||||
{
|
||||
/** @var IOInterface */
|
||||
protected $io;
|
||||
/** @var Config */
|
||||
protected $config;
|
||||
/** @var ProcessExecutor */
|
||||
protected $process;
|
||||
/** @var HttpDownloader */
|
||||
protected $httpDownloader;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ use React\Promise\Promise;
|
|||
*/
|
||||
class Loop
|
||||
{
|
||||
private $io;
|
||||
private $httpDownloader;
|
||||
|
||||
public function __construct(HttpDownloader $httpDownloader)
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace Composer\Util;
|
|||
|
||||
use Composer\Composer;
|
||||
use Composer\CaBundle\CaBundle;
|
||||
use Composer\Downloader\TransportException;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,8 @@ use Composer\Util\Loop;
|
|||
|
||||
class FileDownloaderTest extends TestCase
|
||||
{
|
||||
private $httpDownloader;
|
||||
|
||||
protected function getDownloader($io = null, $config = null, $eventDispatcher = null, $cache = null, $httpDownloader = null, $filesystem = null)
|
||||
{
|
||||
$io = $io ?: $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
|
||||
|
|
|
@ -25,7 +25,7 @@ class ZipDownloaderTest extends TestCase
|
|||
* @var string
|
||||
*/
|
||||
private $testDir;
|
||||
private $prophet;
|
||||
private $httpDownloader;
|
||||
private $io;
|
||||
private $config;
|
||||
private $package;
|
||||
|
|
Loading…
Reference in New Issue