1
0
Fork 0
pull/10545/head
Jordi Boggiano 2022-02-18 08:50:11 +01:00
parent 2e40cdf2dc
commit 86fb8d4412
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
57 changed files with 146 additions and 88 deletions

View File

@ -20,11 +20,9 @@ use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\IO\NullIO; use Composer\IO\NullIO;
use Composer\Pcre\Preg;
use Composer\Plugin\PreCommandRunEvent; use Composer\Plugin\PreCommandRunEvent;
use Composer\Package\Version\VersionParser; use Composer\Package\Version\VersionParser;
use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginEvents;
use Composer\Repository\PlatformRepository;
use Composer\Util\Platform; use Composer\Util\Platform;
use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Helper\TableSeparator; use Symfony\Component\Console\Helper\TableSeparator;

View File

@ -455,7 +455,7 @@ EOT
return 'php-only'; return 'php-only';
} }
return $val !== 'false' && (bool)$val; return $val !== 'false' && (bool) $val;
}, },
), ),
'use-parent-dir' => array( 'use-parent-dir' => array(
@ -739,7 +739,7 @@ EOT
return 0; return 0;
} }
$this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]); $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]);
return 0; return 0;
} }

View File

@ -12,7 +12,6 @@
namespace Composer\Command; namespace Composer\Command;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Plugin\CommandEvent; use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginEvents;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;

View File

@ -13,24 +13,15 @@
namespace Composer\Command; namespace Composer\Command;
use Composer\Factory; use Composer\Factory;
use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Json\JsonValidationException; use Composer\Json\JsonValidationException;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Package\CompletePackageInterface;
use Composer\Package\Package; use Composer\Package\Package;
use Composer\Package\PackageInterface;
use Composer\Package\Version\VersionParser;
use Composer\Package\Version\VersionSelector;
use Composer\Pcre\Preg; use Composer\Pcre\Preg;
use Composer\Repository\CompositeRepository; use Composer\Repository\CompositeRepository;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryFactory; use Composer\Repository\RepositoryFactory;
use Composer\Repository\RepositorySet;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor;
use Composer\Semver\Constraint\Constraint;
use Composer\Util\Silencer; use Composer\Util\Silencer;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;

View File

@ -12,7 +12,6 @@
namespace Composer\Command; namespace Composer\Command;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Installer; use Composer\Installer;
use Composer\Plugin\CommandEvent; use Composer\Plugin\CommandEvent;
use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginEvents;

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Command; namespace Composer\Command;
use Composer\Factory; use Composer\Factory;

View File

@ -15,7 +15,6 @@ namespace Composer\Command;
use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Transaction; use Composer\DependencyResolver\Transaction;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Pcre\Preg; use Composer\Pcre\Preg;

View File

@ -14,7 +14,6 @@ namespace Composer\Command;
use Composer\Config\JsonConfigSource; use Composer\Config\JsonConfigSource;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Installer; use Composer\Installer;
use Composer\Pcre\Preg; use Composer\Pcre\Preg;
use Composer\Plugin\CommandEvent; use Composer\Plugin\CommandEvent;

View File

@ -13,8 +13,6 @@
namespace Composer\Command; namespace Composer\Command;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Repository\RepositorySet;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;

View File

@ -14,7 +14,6 @@ namespace Composer\Command;
use Composer\Composer; use Composer\Composer;
use Composer\DependencyResolver\DefaultPolicy; use Composer\DependencyResolver\DefaultPolicy;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
use Composer\Json\JsonFile; use Composer\Json\JsonFile;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;

View File

@ -14,7 +14,6 @@ namespace Composer\Command;
use Composer\Composer; use Composer\Composer;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Installer; use Composer\Installer;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Package\Loader\RootPackageLoader; use Composer\Package\Loader\RootPackageLoader;

View File

@ -55,7 +55,8 @@ final class GithubActionError
* @param string $data * @param string $data
* @return string * @return string
*/ */
private function escapeData($data) { private function escapeData($data)
{
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L80-L85 // see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L80-L85
$data = str_replace("%", '%25', $data); $data = str_replace("%", '%25', $data);
$data = str_replace("\r", '%0D', $data); $data = str_replace("\r", '%0D', $data);
@ -68,7 +69,8 @@ final class GithubActionError
* @param string $property * @param string $property
* @return string * @return string
*/ */
private function escapeProperty($property) { private function escapeProperty($property)
{
// see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L87-L94 // see https://github.com/actions/toolkit/blob/4f7fb6513a355689f69f0849edeb369a4dc81729/packages/core/src/command.ts#L87-L94
$property = str_replace("%", '%25', $property); $property = str_replace("%", '%25', $property);
$property = str_replace("\r", '%0D', $property); $property = str_replace("\r", '%0D', $property);

View File

@ -704,7 +704,7 @@ class PoolBuilder
'<info>Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.</info>', '<info>Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.</info>',
number_format($total), number_format($total),
number_format($filtered), number_format($filtered),
round(100/$total*$filtered) round(100 / $total * $filtered)
), true, IOInterface::VERY_VERBOSE); ), true, IOInterface::VERY_VERBOSE);
return $pool; return $pool;

View File

@ -211,7 +211,6 @@ class PoolOptimizer
$dependencyHash = $this->calculateDependencyHash($package); $dependencyHash = $this->calculateDependencyHash($package);
foreach ($package->getNames(false) as $packageName) { foreach ($package->getNames(false) as $packageName) {
if (!isset($this->requireConstraintsPerPackage[$packageName])) { if (!isset($this->requireConstraintsPerPackage[$packageName])) {
continue; continue;
} }
@ -287,7 +286,7 @@ class PoolOptimizer
'requires' => $package->getRequires(), 'requires' => $package->getRequires(),
'conflicts' => $package->getConflicts(), 'conflicts' => $package->getConflicts(),
'replaces' => $package->getReplaces(), 'replaces' => $package->getReplaces(),
'provides' => $package->getProvides() 'provides' => $package->getProvides(),
); );
foreach ($hashRelevantLinks as $key => $links) { foreach ($hashRelevantLinks as $key => $links) {

View File

@ -261,7 +261,6 @@ abstract class Rule
} }
} }
/** /**
* @param bool $isVerbose * @param bool $isVerbose
* @param BasePackage[] $installedMap * @param BasePackage[] $installedMap

View File

@ -17,7 +17,6 @@ use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;
use Composer\Package\AliasPackage; use Composer\Package\AliasPackage;
use Composer\Repository\PlatformRepository;
/** /**
* @author Nils Adermann <naderman@naderman.de> * @author Nils Adermann <naderman@naderman.de>

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Filter\PlatformRequirementFilter; namespace Composer\Filter\PlatformRequirementFilter;
use Composer\Repository\PlatformRepository; use Composer\Repository\PlatformRepository;

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Filter\PlatformRequirementFilter; namespace Composer\Filter\PlatformRequirementFilter;
use Composer\Package\BasePackage; use Composer\Package\BasePackage;

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Filter\PlatformRequirementFilter; namespace Composer\Filter\PlatformRequirementFilter;
final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Filter\PlatformRequirementFilter; namespace Composer\Filter\PlatformRequirementFilter;
final class PlatformRequirementFilterFactory final class PlatformRequirementFilterFactory

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Filter\PlatformRequirementFilter; namespace Composer\Filter\PlatformRequirementFilter;
interface PlatformRequirementFilterInterface interface PlatformRequirementFilterInterface

View File

@ -167,6 +167,7 @@ class PluginManager
if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin)) { if (!$this->isPluginAllowed($package->getName(), $isGlobalPlugin)) {
$this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG); $this->io->writeError('Skipped loading "'.$package->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').'as it is not in config.allow-plugins', true, IOInterface::DEBUG);
return; return;
} }
@ -397,6 +398,7 @@ class PluginManager
trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED); trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED);
} elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin)) { } elseif (!$this->isPluginAllowed($sourcePackage->getName(), $isGlobalPlugin)) {
$this->io->writeError('Skipped loading "'.get_class($plugin).' from '.$sourcePackage->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').' as it is not in config.allow-plugins', true, IOInterface::DEBUG); $this->io->writeError('Skipped loading "'.get_class($plugin).' from '.$sourcePackage->getName() . '" '.($isGlobalPlugin ? '(installed globally) ' : '').' as it is not in config.allow-plugins', true, IOInterface::DEBUG);
return; return;
} }
@ -735,7 +737,7 @@ class PluginManager
'y - add package to allow-plugins in composer.json and let it run immediately', 'y - add package to allow-plugins in composer.json and let it run immediately',
'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts', 'n - add package (as disallowed) to allow-plugins in composer.json to suppress further prompts',
'd - discard this, do not change composer.json and do not allow the plugin to run', 'd - discard this, do not change composer.json and do not allow the plugin to run',
'? - print help' '? - print help',
)); ));
break; break;
} }

View File

@ -321,6 +321,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
if (!is_array($this->partialPackagesByName)) { if (!is_array($this->partialPackagesByName)) {
throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName'); throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName');
} }
return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages'); return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages');
} }

View File

@ -91,7 +91,7 @@ class PlatformRepository extends ArrayRepository
/** /**
* @param string $name * @param string $name
* @return boolean * @return bool
*/ */
public function isPlatformPackageDisabled($name) public function isPlatformPackageDisabled($name)
{ {
@ -541,6 +541,7 @@ class PlatformRepository extends ArrayRepository
if (isset($this->overrides[$package->getName()])) { if (isset($this->overrides[$package->getName()])) {
if ($this->overrides[$package->getName()]['version'] === false) { if ($this->overrides[$package->getName()]['version'] === false) {
$this->addDisabledPackage($package); $this->addDisabledPackage($package);
return; return;
} }
@ -561,6 +562,7 @@ class PlatformRepository extends ArrayRepository
if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) { if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
if (isset($this->overrides[$package->getName()]) && $this->overrides[$package->getName()]['version'] === false) { if (isset($this->overrides[$package->getName()]) && $this->overrides[$package->getName()]['version'] === false) {
$this->addDisabledPackage($package); $this->addDisabledPackage($package);
return; return;
} }

View File

@ -13,7 +13,6 @@
namespace Composer\Repository; namespace Composer\Repository;
use Composer\DependencyResolver\PoolOptimizer; use Composer\DependencyResolver\PoolOptimizer;
use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\PoolBuilder; use Composer\DependencyResolver\PoolBuilder;
use Composer\DependencyResolver\Request; use Composer\DependencyResolver\Request;

View File

@ -13,7 +13,6 @@
namespace Composer\Util; namespace Composer\Util;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Pcre\Preg;
/** /**
* Convert PHP errors into exceptions * Convert PHP errors into exceptions

View File

@ -16,7 +16,6 @@ use Composer\Config;
use Composer\Downloader\MaxFileSizeExceededException; use Composer\Downloader\MaxFileSizeExceededException;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Downloader\TransportException; use Composer\Downloader\TransportException;
use Composer\CaBundle\CaBundle;
use Composer\Pcre\Preg; use Composer\Pcre\Preg;
use Composer\Util\Http\Response; use Composer\Util\Http\Response;
use Composer\Util\Http\ProxyManager; use Composer\Util\Http\ProxyManager;

View File

@ -15,7 +15,6 @@ namespace Composer\Test;
use Composer\Console\Application; use Composer\Console\Application;
use Composer\XdebugHandler\XdebugHandler; use Composer\XdebugHandler\XdebugHandler;
use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\BufferedOutput;
use Symfony\Component\Console\Output\OutputInterface;
class ApplicationTest extends TestCase class ApplicationTest extends TestCase
{ {

View File

@ -86,7 +86,6 @@ class PoolOptimizerTest extends TestCase
$requestData = JsonFile::parseJson($testData['REQUEST']); $requestData = JsonFile::parseJson($testData['REQUEST']);
$packagesBefore = $this->loadPackages(JsonFile::parseJson($testData['POOL-BEFORE'])); $packagesBefore = $this->loadPackages(JsonFile::parseJson($testData['POOL-BEFORE']));
$expectedPackages = $this->loadPackages(JsonFile::parseJson($testData['POOL-AFTER'])); $expectedPackages = $this->loadPackages(JsonFile::parseJson($testData['POOL-AFTER']));
} catch (\Exception $e) { } catch (\Exception $e) {
die(sprintf('Test "%s" is not valid: '.$e->getMessage(), str_replace($fixturesDir.'/', '', $file))); die(sprintf('Test "%s" is not valid: '.$e->getMessage(), str_replace($fixturesDir.'/', '', $file)));
} }
@ -193,6 +192,7 @@ class PoolOptimizerTest extends TestCase
private function loadPackage(array $packageData) private function loadPackage(array $packageData)
{ {
$loader = new ArrayLoader(); $loader = new ArrayLoader();
return $loader->load($packageData); return $loader->load($packageData);
} }
} }

View File

@ -12,13 +12,11 @@
namespace Composer\Test\Downloader; namespace Composer\Test\Downloader;
use Composer\Config;
use Composer\Downloader\FileDownloader; use Composer\Downloader\FileDownloader;
use Composer\EventDispatcher\EventDispatcher; use Composer\EventDispatcher\EventDispatcher;
use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginEvents;
use Composer\Plugin\PreFileDownloadEvent; use Composer\Plugin\PreFileDownloadEvent;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Test\Mock\ProcessExecutorMock;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\Http\Response; use Composer\Util\Http\Response;
use Composer\Util\Loop; use Composer\Util\Loop;

View File

@ -15,7 +15,6 @@ namespace Composer\Test\Downloader;
use Composer\Downloader\FossilDownloader; use Composer\Downloader\FossilDownloader;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Test\Mock\ProcessExecutorMock;
class FossilDownloaderTest extends TestCase class FossilDownloaderTest extends TestCase
{ {

View File

@ -18,7 +18,6 @@ use Composer\Pcre\Preg;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\Platform; use Composer\Util\Platform;
use Composer\Test\Mock\ProcessExecutorMock;
class GitDownloaderTest extends TestCase class GitDownloaderTest extends TestCase
{ {

View File

@ -15,7 +15,6 @@ namespace Composer\Test\Downloader;
use Composer\Downloader\HgDownloader; use Composer\Downloader\HgDownloader;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Test\Mock\ProcessExecutorMock;
class HgDownloaderTest extends TestCase class HgDownloaderTest extends TestCase
{ {

View File

@ -18,8 +18,6 @@ use Composer\Repository\VcsRepository;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Factory; use Composer\Factory;
use Composer\Util\Filesystem;
use Composer\Test\Mock\ProcessExecutorMock;
/** /**
* @author Matt Whittom <Matt.Whittom@veteransunited.com> * @author Matt Whittom <Matt.Whittom@veteransunited.com>

View File

@ -23,7 +23,6 @@ use Composer\IO\BufferIO;
use Composer\Script\ScriptEvents; use Composer\Script\ScriptEvents;
use Composer\Script\Event as ScriptEvent; use Composer\Script\Event as ScriptEvent;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Test\Mock\ProcessExecutorMock;
use Composer\Util\Platform; use Composer\Util\Platform;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@ -148,7 +147,7 @@ class EventDispatcherTest extends TestCase
->will($this->returnValue(array())); ->will($this->returnValue(array()));
$generator $generator
->method('parseAutoloads') ->method('parseAutoloads')
->will($this->returnValue(array('psr-0' => array(), 'psr-4' => array(), 'classmap' => array(), 'files' => array(), 'exclude-from-classmap' => array(),))); ->will($this->returnValue(array('psr-0' => array(), 'psr-4' => array(), 'classmap' => array(), 'files' => array(), 'exclude-from-classmap' => array())));
$generator $generator
->method('createLoader') ->method('createLoader')
->will($this->returnValue($this->getMockBuilder('Composer\Autoload\ClassLoader')->getMock())); ->will($this->returnValue($this->getMockBuilder('Composer\Autoload\ClassLoader')->getMock()));

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Filter\PlatformRequirementFilter; namespace Composer\Test\Filter\PlatformRequirementFilter;
use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter;

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Filter\PlatformRequirementFilter; namespace Composer\Test\Filter\PlatformRequirementFilter;
use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter;

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Filter\PlatformRequirementFilter; namespace Composer\Test\Filter\PlatformRequirementFilter;
use Composer\Filter\PlatformRequirementFilter\IgnoreNothingPlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\IgnoreNothingPlatformRequirementFilter;

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Filter\PlatformRequirementFilter; namespace Composer\Test\Filter\PlatformRequirementFilter;
use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory;

View File

@ -15,8 +15,6 @@ namespace Composer\Test\Installer;
use Composer\Installer\BinaryInstaller; use Composer\Installer\BinaryInstaller;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Composer;
use Composer\Config;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
class BinaryInstallerTest extends TestCase class BinaryInstallerTest extends TestCase
@ -106,7 +104,7 @@ echo 'success '.$_SERVER['argv'][1];
EOL EOL
), ),
'phar file' => array( 'phar file' => array(
base64_decode('IyEvdXNyL2Jpbi9lbnYgcGhwCjw/cGhwCgpQaGFyOjptYXBQaGFyKCd0ZXN0LnBoYXInKTsKCnJlcXVpcmUgJ3BoYXI6Ly90ZXN0LnBoYXIvcnVuLnBocCc7CgpfX0hBTFRfQ09NUElMRVIoKTsgPz4NCj4AAAABAAAAEQAAAAEACQAAAHRlc3QucGhhcgAAAAAHAAAAcnVuLnBocCoAAADb9n9hKgAAAMUDDWGkAQAAAAAAADw/cGhwIGVjaG8gInN1Y2Nlc3MgIi4kX1NFUlZFUlsiYXJndiJdWzFdO1SOC0IE3+UN0yzrHIwyspp9slhmAgAAAEdCTUI=') base64_decode('IyEvdXNyL2Jpbi9lbnYgcGhwCjw/cGhwCgpQaGFyOjptYXBQaGFyKCd0ZXN0LnBoYXInKTsKCnJlcXVpcmUgJ3BoYXI6Ly90ZXN0LnBoYXIvcnVuLnBocCc7CgpfX0hBTFRfQ09NUElMRVIoKTsgPz4NCj4AAAABAAAAEQAAAAEACQAAAHRlc3QucGhhcgAAAAAHAAAAcnVuLnBocCoAAADb9n9hKgAAAMUDDWGkAQAAAAAAADw/cGhwIGVjaG8gInN1Y2Nlc3MgIi4kX1NFUlZFUlsiYXJndiJdWzFdO1SOC0IE3+UN0yzrHIwyspp9slhmAgAAAEdCTUI='),
), ),
'shebang with strict types declare' => array(<<<'EOL' 'shebang with strict types declare' => array(<<<'EOL'
#!/usr/bin/env php #!/usr/bin/env php

View File

@ -204,7 +204,7 @@ class SuggestedPackagesReporterTest extends TestCase
$this->suggestedPackagesReporter->addPackage('a', 'b', 'c'); $this->suggestedPackagesReporter->addPackage('a', 'b', 'c');
$this->suggestedPackagesReporter->addPackage('source package', 'target', 'because reasons'); $this->suggestedPackagesReporter->addPackage('source package', 'target', 'because reasons');
$this->io->expects($this->exactly(6)) $this->io->expects($this->exactly(6))
->method('write') ->method('write')
->withConsecutive( ->withConsecutive(
['<comment>a</comment> suggests:'], ['<comment>a</comment> suggests:'],

View File

@ -298,7 +298,6 @@ class JsonFileTest extends TestCase
public function testUnicode() public function testUnicode()
{ {
$data = array("Žluťoučký \" kůň" => "úpěl ďábelské ódy za €"); $data = array("Žluťoučký \" kůň" => "úpěl ďábelské ódy za €");
$json = '{ $json = '{
"Žluťoučký \" kůň": "úpěl ďábelské ódy za €" "Žluťoučký \" kůň": "úpěl ďábelské ódy za €"
@ -309,7 +308,6 @@ class JsonFileTest extends TestCase
public function testOnlyUnicode() public function testOnlyUnicode()
{ {
$data = "\\"; $data = "\\";
$this->assertJsonFormat('"\\\\\\/ƌ"', $data, JSON_UNESCAPED_UNICODE); $this->assertJsonFormat('"\\\\\\/ƌ"', $data, JSON_UNESCAPED_UNICODE);

View File

@ -15,7 +15,6 @@ namespace Composer\Test\Mock;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Util\Platform; use Composer\Util\Platform;
use PHPUnit\Framework\Assert; use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\AssertionFailedError;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
use React\Promise\Promise; use React\Promise\Promise;

View File

@ -117,7 +117,7 @@ class BasePackageTest extends TestCase
array('php'), '{^%s$}i', '{^php$}i', array('php'), '{^%s$}i', '{^php$}i',
array('*'), '{^%s$}i', '{^.*$}i', array('*'), '{^%s$}i', '{^.*$}i',
array('foo', 'bar'), '§%s§', '§foo|bar§', array('foo', 'bar'), '§%s§', '§foo|bar§',
) ),
); );
} }
} }

View File

@ -18,7 +18,6 @@ use Composer\Semver\VersionParser;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Git as GitUtil; use Composer\Util\Git as GitUtil;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use Composer\Test\Mock\ProcessExecutorMock;
class VersionGuesserTest extends TestCase class VersionGuesserTest extends TestCase
{ {

View File

@ -16,7 +16,6 @@ use Composer\Question\StrictConfirmationQuestion;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\StreamableInputInterface;
use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Output\StreamOutput;
/** /**

View File

@ -17,10 +17,8 @@ use Composer\Json\JsonFile;
use Composer\Repository\ComposerRepository; use Composer\Repository\ComposerRepository;
use Composer\Repository\RepositoryInterface; use Composer\Repository\RepositoryInterface;
use Composer\Test\Mock\FactoryMock; use Composer\Test\Mock\FactoryMock;
use Composer\Test\Mock\HttpDownloaderMock;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Version\VersionParser;
class ComposerRepositoryTest extends TestCase class ComposerRepositoryTest extends TestCase
{ {

View File

@ -1090,7 +1090,6 @@ Linked Version => 1.2.11',
* @param list<mixed> $constants * @param list<mixed> $constants
* @param list<mixed> $classDefinitions * @param list<mixed> $classDefinitions
*/ */
public function testLibraryInformation( public function testLibraryInformation(
$extensions, $extensions,
$info, $info,

View File

@ -12,13 +12,11 @@
namespace Composer\Test\Repository\Vcs; namespace Composer\Test\Repository\Vcs;
use Composer\Downloader\TransportException;
use Composer\Repository\Vcs\GitHubDriver; use Composer\Repository\Vcs\GitHubDriver;
use Composer\Test\Mock\ProcessExecutorMock; use Composer\Test\Mock\ProcessExecutorMock;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Config; use Composer\Config;
use Composer\Util\Http\Response;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
class GitHubDriverTest extends TestCase class GitHubDriverTest extends TestCase
@ -119,7 +117,6 @@ class GitHubDriverTest extends TestCase
->method('isInteractive') ->method('isInteractive')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$httpDownloader = $this->getHttpDownloaderMock($io, $this->config); $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
$httpDownloader->expects( $httpDownloader->expects(
[ [
@ -162,7 +159,6 @@ class GitHubDriverTest extends TestCase
->method('isInteractive') ->method('isInteractive')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$httpDownloader = $this->getHttpDownloaderMock($io, $this->config); $httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
$httpDownloader->expects( $httpDownloader->expects(
[ [

View File

@ -21,7 +21,6 @@ use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\MockObject\MockObject;
use Prophecy\Argument;
use Composer\Util\Http\Response; use Composer\Util\Http\Response;
/** /**

View File

@ -16,7 +16,6 @@ use Composer\Repository\Vcs\SvnDriver;
use Composer\Config; use Composer\Config;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Test\Mock\ProcessExecutorMock;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
class SvnDriverTest extends TestCase class SvnDriverTest extends TestCase

View File

@ -16,7 +16,6 @@ use Composer\Config;
use Composer\IO\IOInterface; use Composer\IO\IOInterface;
use Composer\Pcre\Preg; use Composer\Pcre\Preg;
use Composer\Semver\VersionParser; use Composer\Semver\VersionParser;
use Composer\Package\RootPackageInterface;
use Composer\Package\PackageInterface; use Composer\Package\PackageInterface;
use Composer\Semver\Constraint\Constraint; use Composer\Semver\Constraint\Constraint;
use Composer\Test\Mock\HttpDownloaderMock; use Composer\Test\Mock\HttpDownloaderMock;
@ -32,7 +31,6 @@ use Composer\Package\AliasPackage;
use Composer\Package\RootAliasPackage; use Composer\Package\RootAliasPackage;
use Composer\Package\CompletePackage; use Composer\Package\CompletePackage;
use Composer\Package\CompleteAliasPackage; use Composer\Package\CompleteAliasPackage;
use Composer\Package\CompletePackageInterface;
use Composer\Package\Package; use Composer\Package\Package;
abstract class TestCase extends \PHPUnit\Framework\TestCase abstract class TestCase extends \PHPUnit\Framework\TestCase

View File

@ -15,7 +15,6 @@ namespace Composer\Test\Util;
use Composer\Util\Bitbucket; use Composer\Util\Bitbucket;
use Composer\Util\Http\Response; use Composer\Util\Http\Response;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Test\Mock\ProcessExecutorMock;
/** /**
* @author Paul Wenke <wenke.paul@gmail.com> * @author Paul Wenke <wenke.paul@gmail.com>

View File

@ -12,10 +12,7 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use _PHPStan_c862bb974\Symfony\Component\Console\Output\BufferedOutput;
use Composer\Downloader\TransportException;
use Composer\Util\GitHub; use Composer\Util\GitHub;
use Composer\Util\Http\Response;
use Composer\Test\TestCase; use Composer\Test\TestCase;
/** /**

View File

@ -12,10 +12,7 @@
namespace Composer\Test\Util; namespace Composer\Test\Util;
use Composer\Downloader\TransportException;
use Composer\Test\Mock\HttpDownloaderMock;
use Composer\Util\GitLab; use Composer\Util\GitLab;
use Composer\Util\Http\Response;
use Composer\Test\TestCase; use Composer\Test\TestCase;
/** /**

View File

@ -195,7 +195,7 @@ class PerforceTest extends TestCase
$this->processExecutor->expects( $this->processExecutor->expects(
[ [
'p4 set', 'p4 set',
$expectedCommand $expectedCommand,
], ],
true true
); );
@ -216,7 +216,7 @@ class PerforceTest extends TestCase
$this->processExecutor->expects( $this->processExecutor->expects(
[ [
'echo $P4USER', 'echo $P4USER',
$expectedCommand $expectedCommand,
], ],
true true
); );
@ -348,11 +348,11 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port streams '.ProcessExecutor::escape('//depot/...'), 'cmd' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port streams '.ProcessExecutor::escape('//depot/...'),
'stdout' => 'Stream //depot/branch mainline none \'branch\'' . PHP_EOL 'stdout' => 'Stream //depot/branch mainline none \'branch\'' . PHP_EOL,
], ],
[ [
'cmd' => 'p4 -u user -p port changes '.ProcessExecutor::escape('//depot/branch/...'), 'cmd' => 'p4 -u user -p port changes '.ProcessExecutor::escape('//depot/branch/...'),
'stdout' => 'Change 1234 on 2014/03/19 by Clark.Stuth@Clark.Stuth_test_client \'test changelist\'' 'stdout' => 'Change 1234 on 2014/03/19 by Clark.Stuth@Clark.Stuth_test_client \'test changelist\'',
], ],
], ],
true true
@ -368,7 +368,7 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -p port changes '.ProcessExecutor::escape('//depot/...'), 'cmd' => 'p4 -u user -p port changes '.ProcessExecutor::escape('//depot/...'),
'stdout' => 'Change 5678 on 2014/03/19 by Clark.Stuth@Clark.Stuth_test_client \'test changelist\'' 'stdout' => 'Change 5678 on 2014/03/19 by Clark.Stuth@Clark.Stuth_test_client \'test changelist\'',
], ],
], ],
true true
@ -384,7 +384,7 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -c composer_perforce_TEST_depot -p port labels', 'cmd' => 'p4 -u user -c composer_perforce_TEST_depot -p port labels',
'stdout' => 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL 'stdout' => 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL,
], ],
], ],
true true
@ -403,7 +403,7 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port labels', 'cmd' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port labels',
'stdout' => 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL 'stdout' => 'Label 0.0.1 2013/07/31 \'First Label!\'' . PHP_EOL . 'Label 0.0.2 2013/08/01 \'Second Label!\'' . PHP_EOL,
], ],
], ],
true true
@ -427,7 +427,7 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -p port depots', 'cmd' => 'p4 -u user -p port depots',
'stdout' => 'Depot depot 2013/06/25 stream /p4/1/depots/depot/... \'Created by Me\'' 'stdout' => 'Depot depot 2013/06/25 stream /p4/1/depots/depot/... \'Created by Me\'',
], ],
], ],
true true
@ -444,7 +444,7 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -c composer_perforce_TEST_depot -p port print '.ProcessExecutor::escape('//depot/composer.json'), 'cmd' => 'p4 -u user -c composer_perforce_TEST_depot -p port print '.ProcessExecutor::escape('//depot/composer.json'),
'stdout' => PerforceTest::getComposerJson() 'stdout' => PerforceTest::getComposerJson(),
], ],
], ],
true true
@ -466,11 +466,11 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -p port files '.ProcessExecutor::escape('//depot/composer.json@0.0.1'), 'cmd' => 'p4 -u user -p port files '.ProcessExecutor::escape('//depot/composer.json@0.0.1'),
'stdout' => '//depot/composer.json#1 - branch change 10001 (text)' 'stdout' => '//depot/composer.json#1 - branch change 10001 (text)',
], ],
[ [
'cmd' => 'p4 -u user -c composer_perforce_TEST_depot -p port print '.ProcessExecutor::escape('//depot/composer.json@10001'), 'cmd' => 'p4 -u user -c composer_perforce_TEST_depot -p port print '.ProcessExecutor::escape('//depot/composer.json@10001'),
'stdout' => PerforceTest::getComposerJson() 'stdout' => PerforceTest::getComposerJson(),
], ],
], ],
true true
@ -495,7 +495,7 @@ class PerforceTest extends TestCase
[ [
[ [
'cmd' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port print '.ProcessExecutor::escape('//depot/branch/composer.json'), 'cmd' => 'p4 -u user -c composer_perforce_TEST_depot_branch -p port print '.ProcessExecutor::escape('//depot/branch/composer.json'),
'stdout' => PerforceTest::getComposerJson() 'stdout' => PerforceTest::getComposerJson(),
], ],
], ],
true true
@ -605,8 +605,8 @@ class PerforceTest extends TestCase
'description' => 'Basic project for testing', 'description' => 'Basic project for testing',
'minimum-stability' => 'dev', 'minimum-stability' => 'dev',
'autoload' => [ 'autoload' => [
'psr-0' => [] 'psr-0' => [],
] ],
], JSON_FORCE_OBJECT); ], JSON_FORCE_OBJECT);
} }

View File

@ -1,5 +1,15 @@
<?php <?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
return new \Composer\Console\Application(); return new \Composer\Console\Application();