diff --git a/src/Composer/Command/BaseCommand.php b/src/Composer/Command/BaseCommand.php index baea928ce..22a290c1d 100644 --- a/src/Composer/Command/BaseCommand.php +++ b/src/Composer/Command/BaseCommand.php @@ -20,11 +20,9 @@ use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface; use Composer\IO\IOInterface; use Composer\IO\NullIO; -use Composer\Pcre\Preg; use Composer\Plugin\PreCommandRunEvent; use Composer\Package\Version\VersionParser; use Composer\Plugin\PluginEvents; -use Composer\Repository\PlatformRepository; use Composer\Util\Platform; use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Helper\TableSeparator; diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index bff2b67a9..332d7b4a8 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -455,7 +455,7 @@ EOT return 'php-only'; } - return $val !== 'false' && (bool)$val; + return $val !== 'false' && (bool) $val; }, ), 'use-parent-dir' => array( @@ -739,7 +739,7 @@ EOT return 0; } - $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]); + $this->configSource->addConfigSetting($settingKey, $values[0] === 'false' ? false : $values[0]); return 0; } diff --git a/src/Composer/Command/DumpAutoloadCommand.php b/src/Composer/Command/DumpAutoloadCommand.php index 33013d975..9eb81f699 100644 --- a/src/Composer/Command/DumpAutoloadCommand.php +++ b/src/Composer/Command/DumpAutoloadCommand.php @@ -12,7 +12,6 @@ namespace Composer\Command; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index a6b86a9e6..6869d4068 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -13,24 +13,15 @@ namespace Composer\Command; use Composer\Factory; -use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Json\JsonFile; use Composer\Json\JsonValidationException; use Composer\Package\BasePackage; -use Composer\Package\CompletePackageInterface; use Composer\Package\Package; -use Composer\Package\PackageInterface; -use Composer\Package\Version\VersionParser; -use Composer\Package\Version\VersionSelector; use Composer\Pcre\Preg; use Composer\Repository\CompositeRepository; use Composer\Repository\PlatformRepository; use Composer\Repository\RepositoryFactory; -use Composer\Repository\RepositorySet; use Composer\Util\Filesystem; -use Composer\Util\ProcessExecutor; -use Composer\Semver\Constraint\Constraint; use Composer\Util\Silencer; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\InputInterface; diff --git a/src/Composer/Command/InstallCommand.php b/src/Composer/Command/InstallCommand.php index 0dcbd8f92..b992758bb 100644 --- a/src/Composer/Command/InstallCommand.php +++ b/src/Composer/Command/InstallCommand.php @@ -12,7 +12,6 @@ namespace Composer\Command; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Installer; use Composer\Plugin\CommandEvent; use Composer\Plugin\PluginEvents; diff --git a/src/Composer/Command/PackageDiscoveryTrait.php b/src/Composer/Command/PackageDiscoveryTrait.php index 4a6bb14d5..c55e97612 100644 --- a/src/Composer/Command/PackageDiscoveryTrait.php +++ b/src/Composer/Command/PackageDiscoveryTrait.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Command; use Composer\Factory; diff --git a/src/Composer/Command/ReinstallCommand.php b/src/Composer/Command/ReinstallCommand.php index 9daec7643..7b8a00873 100644 --- a/src/Composer/Command/ReinstallCommand.php +++ b/src/Composer/Command/ReinstallCommand.php @@ -15,7 +15,6 @@ namespace Composer\Command; use Composer\DependencyResolver\Operation\InstallOperation; use Composer\DependencyResolver\Operation\UninstallOperation; use Composer\DependencyResolver\Transaction; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Package\AliasPackage; use Composer\Package\BasePackage; use Composer\Pcre\Preg; diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index 0f7e37806..e33675224 100644 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -14,7 +14,6 @@ namespace Composer\Command; use Composer\Config\JsonConfigSource; use Composer\DependencyResolver\Request; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Installer; use Composer\Pcre\Preg; use Composer\Plugin\CommandEvent; diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 7bd6b81ae..c46a96518 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -13,8 +13,6 @@ namespace Composer\Command; use Composer\DependencyResolver\Request; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; -use Composer\Repository\RepositorySet; use Composer\Util\Filesystem; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; diff --git a/src/Composer/Command/ShowCommand.php b/src/Composer/Command/ShowCommand.php index 920ad1116..5a80f1db9 100644 --- a/src/Composer/Command/ShowCommand.php +++ b/src/Composer/Command/ShowCommand.php @@ -14,7 +14,6 @@ namespace Composer\Command; use Composer\Composer; use Composer\DependencyResolver\DefaultPolicy; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface; use Composer\Json\JsonFile; use Composer\Package\BasePackage; diff --git a/src/Composer/Command/UpdateCommand.php b/src/Composer/Command/UpdateCommand.php index 4abeaf171..c2efd014b 100644 --- a/src/Composer/Command/UpdateCommand.php +++ b/src/Composer/Command/UpdateCommand.php @@ -14,7 +14,6 @@ namespace Composer\Command; use Composer\Composer; use Composer\DependencyResolver\Request; -use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Installer; use Composer\IO\IOInterface; use Composer\Package\Loader\RootPackageLoader; diff --git a/src/Composer/Console/GithubActionError.php b/src/Composer/Console/GithubActionError.php index 9ccb8221d..6cd49c20d 100644 --- a/src/Composer/Console/GithubActionError.php +++ b/src/Composer/Console/GithubActionError.php @@ -50,12 +50,13 @@ final class GithubActionError } } } - + /** * @param string $data * @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 $data = str_replace("%", '%25', $data); $data = str_replace("\r", '%0D', $data); @@ -63,12 +64,13 @@ final class GithubActionError return $data; } - + /** * @param string $property * @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 $property = str_replace("%", '%25', $property); $property = str_replace("\r", '%0D', $property); diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index de7626fe4..2b2240fa7 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -704,7 +704,7 @@ class PoolBuilder 'Found %s package versions referenced in your dependency graph. %s (%d%%) were optimized away.', number_format($total), number_format($filtered), - round(100/$total*$filtered) + round(100 / $total * $filtered) ), true, IOInterface::VERY_VERBOSE); return $pool; diff --git a/src/Composer/DependencyResolver/PoolOptimizer.php b/src/Composer/DependencyResolver/PoolOptimizer.php index 841a2e9c6..7e1e32fdc 100644 --- a/src/Composer/DependencyResolver/PoolOptimizer.php +++ b/src/Composer/DependencyResolver/PoolOptimizer.php @@ -211,7 +211,6 @@ class PoolOptimizer $dependencyHash = $this->calculateDependencyHash($package); foreach ($package->getNames(false) as $packageName) { - if (!isset($this->requireConstraintsPerPackage[$packageName])) { continue; } @@ -287,7 +286,7 @@ class PoolOptimizer 'requires' => $package->getRequires(), 'conflicts' => $package->getConflicts(), 'replaces' => $package->getReplaces(), - 'provides' => $package->getProvides() + 'provides' => $package->getProvides(), ); foreach ($hashRelevantLinks as $key => $links) { diff --git a/src/Composer/DependencyResolver/Rule.php b/src/Composer/DependencyResolver/Rule.php index b5777a8e4..133e7f7a0 100644 --- a/src/Composer/DependencyResolver/Rule.php +++ b/src/Composer/DependencyResolver/Rule.php @@ -261,7 +261,6 @@ abstract class Rule } } - /** * @param bool $isVerbose * @param BasePackage[] $installedMap diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index 9164c333a..fef50b0eb 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -17,7 +17,6 @@ use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterInterface; use Composer\Package\BasePackage; use Composer\Package\AliasPackage; -use Composer\Repository\PlatformRepository; /** * @author Nils Adermann diff --git a/src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.php b/src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.php index 0d64d8236..d1fb51b8f 100644 --- a/src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.php +++ b/src/Composer/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilter.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Filter\PlatformRequirementFilter; use Composer\Repository\PlatformRepository; diff --git a/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php b/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php index d6d95a287..6c3adf14b 100644 --- a/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php +++ b/src/Composer/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilter.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Filter\PlatformRequirementFilter; use Composer\Package\BasePackage; diff --git a/src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.php b/src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.php index 94c1a9a97..7c4bddbab 100644 --- a/src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.php +++ b/src/Composer/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilter.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Filter\PlatformRequirementFilter; final class IgnoreNothingPlatformRequirementFilter implements PlatformRequirementFilterInterface diff --git a/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.php b/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.php index 3dff764fb..ac8a83cd7 100644 --- a/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.php +++ b/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactory.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Filter\PlatformRequirementFilter; final class PlatformRequirementFilterFactory diff --git a/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.php b/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.php index 5efd70a8b..89e858152 100644 --- a/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.php +++ b/src/Composer/Filter/PlatformRequirementFilter/PlatformRequirementFilterInterface.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Filter\PlatformRequirementFilter; interface PlatformRequirementFilterInterface diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index b1068b090..4f974d9f8 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -167,6 +167,7 @@ class PluginManager 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); + 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); } 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); + return; } @@ -735,7 +737,7 @@ class PluginManager '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', 'd - discard this, do not change composer.json and do not allow the plugin to run', - '? - print help' + '? - print help', )); break; } diff --git a/src/Composer/Repository/ComposerRepository.php b/src/Composer/Repository/ComposerRepository.php index 34c8dd2a4..3e22df054 100644 --- a/src/Composer/Repository/ComposerRepository.php +++ b/src/Composer/Repository/ComposerRepository.php @@ -321,6 +321,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito if (!is_array($this->partialPackagesByName)) { throw new \LogicException('hasPartialPackages failed to initialize $this->partialPackagesByName'); } + return $this->createPackages($this->partialPackagesByName, 'packages.json inline packages'); } diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index 916145ee1..b1c98b61c 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -91,7 +91,7 @@ class PlatformRepository extends ArrayRepository /** * @param string $name - * @return boolean + * @return bool */ public function isPlatformPackageDisabled($name) { @@ -541,6 +541,7 @@ class PlatformRepository extends ArrayRepository if (isset($this->overrides[$package->getName()])) { if ($this->overrides[$package->getName()]['version'] === false) { $this->addDisabledPackage($package); + return; } @@ -561,6 +562,7 @@ class PlatformRepository extends ArrayRepository if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) { if (isset($this->overrides[$package->getName()]) && $this->overrides[$package->getName()]['version'] === false) { $this->addDisabledPackage($package); + return; } diff --git a/src/Composer/Repository/RepositorySet.php b/src/Composer/Repository/RepositorySet.php index 31028f271..eb640df2b 100644 --- a/src/Composer/Repository/RepositorySet.php +++ b/src/Composer/Repository/RepositorySet.php @@ -13,7 +13,6 @@ namespace Composer\Repository; use Composer\DependencyResolver\PoolOptimizer; -use Composer\DependencyResolver\PolicyInterface; use Composer\DependencyResolver\Pool; use Composer\DependencyResolver\PoolBuilder; use Composer\DependencyResolver\Request; diff --git a/src/Composer/Util/ErrorHandler.php b/src/Composer/Util/ErrorHandler.php index 4a7901b41..5e2bc1790 100644 --- a/src/Composer/Util/ErrorHandler.php +++ b/src/Composer/Util/ErrorHandler.php @@ -13,7 +13,6 @@ namespace Composer\Util; use Composer\IO\IOInterface; -use Composer\Pcre\Preg; /** * Convert PHP errors into exceptions diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index 7455ec7a9..f07ccf824 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -16,7 +16,6 @@ use Composer\Config; use Composer\Downloader\MaxFileSizeExceededException; use Composer\IO\IOInterface; use Composer\Downloader\TransportException; -use Composer\CaBundle\CaBundle; use Composer\Pcre\Preg; use Composer\Util\Http\Response; use Composer\Util\Http\ProxyManager; diff --git a/tests/Composer/Test/ApplicationTest.php b/tests/Composer/Test/ApplicationTest.php index caeadf9a4..ed182360e 100644 --- a/tests/Composer/Test/ApplicationTest.php +++ b/tests/Composer/Test/ApplicationTest.php @@ -15,7 +15,6 @@ namespace Composer\Test; use Composer\Console\Application; use Composer\XdebugHandler\XdebugHandler; use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\Console\Output\OutputInterface; class ApplicationTest extends TestCase { diff --git a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php index 85d70d6f6..2023811aa 100644 --- a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php @@ -86,7 +86,6 @@ class PoolOptimizerTest extends TestCase $requestData = JsonFile::parseJson($testData['REQUEST']); $packagesBefore = $this->loadPackages(JsonFile::parseJson($testData['POOL-BEFORE'])); $expectedPackages = $this->loadPackages(JsonFile::parseJson($testData['POOL-AFTER'])); - } catch (\Exception $e) { 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) { $loader = new ArrayLoader(); + return $loader->load($packageData); } } diff --git a/tests/Composer/Test/Downloader/FileDownloaderTest.php b/tests/Composer/Test/Downloader/FileDownloaderTest.php index 1a7ed8d24..2ade50ce3 100644 --- a/tests/Composer/Test/Downloader/FileDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FileDownloaderTest.php @@ -12,13 +12,11 @@ namespace Composer\Test\Downloader; -use Composer\Config; use Composer\Downloader\FileDownloader; use Composer\EventDispatcher\EventDispatcher; use Composer\Plugin\PluginEvents; use Composer\Plugin\PreFileDownloadEvent; use Composer\Test\TestCase; -use Composer\Test\Mock\ProcessExecutorMock; use Composer\Util\Filesystem; use Composer\Util\Http\Response; use Composer\Util\Loop; diff --git a/tests/Composer/Test/Downloader/FossilDownloaderTest.php b/tests/Composer/Test/Downloader/FossilDownloaderTest.php index da9b04c5d..7a5e84e61 100644 --- a/tests/Composer/Test/Downloader/FossilDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FossilDownloaderTest.php @@ -15,7 +15,6 @@ namespace Composer\Test\Downloader; use Composer\Downloader\FossilDownloader; use Composer\Test\TestCase; use Composer\Util\Filesystem; -use Composer\Test\Mock\ProcessExecutorMock; class FossilDownloaderTest extends TestCase { diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index d5494564d..9791fd1ee 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -18,7 +18,6 @@ use Composer\Pcre\Preg; use Composer\Test\TestCase; use Composer\Util\Filesystem; use Composer\Util\Platform; -use Composer\Test\Mock\ProcessExecutorMock; class GitDownloaderTest extends TestCase { diff --git a/tests/Composer/Test/Downloader/HgDownloaderTest.php b/tests/Composer/Test/Downloader/HgDownloaderTest.php index dbe816bd2..b2e555bab 100644 --- a/tests/Composer/Test/Downloader/HgDownloaderTest.php +++ b/tests/Composer/Test/Downloader/HgDownloaderTest.php @@ -15,7 +15,6 @@ namespace Composer\Test\Downloader; use Composer\Downloader\HgDownloader; use Composer\Test\TestCase; use Composer\Util\Filesystem; -use Composer\Test\Mock\ProcessExecutorMock; class HgDownloaderTest extends TestCase { diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index 9590e3133..ebcc0b662 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -18,8 +18,6 @@ use Composer\Repository\VcsRepository; use Composer\IO\IOInterface; use Composer\Test\TestCase; use Composer\Factory; -use Composer\Util\Filesystem; -use Composer\Test\Mock\ProcessExecutorMock; /** * @author Matt Whittom diff --git a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php index 6b164781a..3217d8bf4 100644 --- a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php +++ b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php @@ -23,7 +23,6 @@ use Composer\IO\BufferIO; use Composer\Script\ScriptEvents; use Composer\Script\Event as ScriptEvent; use Composer\Util\ProcessExecutor; -use Composer\Test\Mock\ProcessExecutorMock; use Composer\Util\Platform; use Symfony\Component\Console\Output\OutputInterface; @@ -148,7 +147,7 @@ class EventDispatcherTest extends TestCase ->will($this->returnValue(array())); $generator ->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 ->method('createLoader') ->will($this->returnValue($this->getMockBuilder('Composer\Autoload\ClassLoader')->getMock())); diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php index 2208ca9b3..8d97636a9 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Test\Filter\PlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter; diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php index 6e043c48c..3cf7469a4 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Test\Filter\PlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\IgnoreListPlatformRequirementFilter; diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php index dacc498f9..4698e94fa 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Test\Filter\PlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\IgnoreNothingPlatformRequirementFilter; diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php index 5db37cacf..44bcfce9e 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Test\Filter\PlatformRequirementFilter; use Composer\Filter\PlatformRequirementFilter\PlatformRequirementFilterFactory; diff --git a/tests/Composer/Test/Installer/BinaryInstallerTest.php b/tests/Composer/Test/Installer/BinaryInstallerTest.php index fd0ec0aac..5bb991f90 100644 --- a/tests/Composer/Test/Installer/BinaryInstallerTest.php +++ b/tests/Composer/Test/Installer/BinaryInstallerTest.php @@ -15,8 +15,6 @@ namespace Composer\Test\Installer; use Composer\Installer\BinaryInstaller; use Composer\Util\Filesystem; use Composer\Test\TestCase; -use Composer\Composer; -use Composer\Config; use Composer\Util\ProcessExecutor; class BinaryInstallerTest extends TestCase @@ -106,7 +104,7 @@ echo 'success '.$_SERVER['argv'][1]; EOL ), 'phar file' => array( - base64_decode('IyEvdXNyL2Jpbi9lbnYgcGhwCjw/cGhwCgpQaGFyOjptYXBQaGFyKCd0ZXN0LnBoYXInKTsKCnJlcXVpcmUgJ3BoYXI6Ly90ZXN0LnBoYXIvcnVuLnBocCc7CgpfX0hBTFRfQ09NUElMRVIoKTsgPz4NCj4AAAABAAAAEQAAAAEACQAAAHRlc3QucGhhcgAAAAAHAAAAcnVuLnBocCoAAADb9n9hKgAAAMUDDWGkAQAAAAAAADw/cGhwIGVjaG8gInN1Y2Nlc3MgIi4kX1NFUlZFUlsiYXJndiJdWzFdO1SOC0IE3+UN0yzrHIwyspp9slhmAgAAAEdCTUI=') + base64_decode('IyEvdXNyL2Jpbi9lbnYgcGhwCjw/cGhwCgpQaGFyOjptYXBQaGFyKCd0ZXN0LnBoYXInKTsKCnJlcXVpcmUgJ3BoYXI6Ly90ZXN0LnBoYXIvcnVuLnBocCc7CgpfX0hBTFRfQ09NUElMRVIoKTsgPz4NCj4AAAABAAAAEQAAAAEACQAAAHRlc3QucGhhcgAAAAAHAAAAcnVuLnBocCoAAADb9n9hKgAAAMUDDWGkAQAAAAAAADw/cGhwIGVjaG8gInN1Y2Nlc3MgIi4kX1NFUlZFUlsiYXJndiJdWzFdO1SOC0IE3+UN0yzrHIwyspp9slhmAgAAAEdCTUI='), ), 'shebang with strict types declare' => array(<<<'EOL' #!/usr/bin/env php diff --git a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php index e251a6d9a..47152ff90 100644 --- a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php +++ b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php @@ -204,7 +204,7 @@ class SuggestedPackagesReporterTest extends TestCase $this->suggestedPackagesReporter->addPackage('a', 'b', 'c'); $this->suggestedPackagesReporter->addPackage('source package', 'target', 'because reasons'); - $this->io->expects($this->exactly(6)) + $this->io->expects($this->exactly(6)) ->method('write') ->withConsecutive( ['a suggests:'], diff --git a/tests/Composer/Test/Json/JsonFileTest.php b/tests/Composer/Test/Json/JsonFileTest.php index 894db2cfe..b0242622f 100644 --- a/tests/Composer/Test/Json/JsonFileTest.php +++ b/tests/Composer/Test/Json/JsonFileTest.php @@ -298,7 +298,6 @@ class JsonFileTest extends TestCase public function testUnicode() { - $data = array("Žluťoučký \" kůň" => "úpěl ďábelské ódy za €"); $json = '{ "Žluťoučký \" kůň": "úpěl ďábelské ódy za €" @@ -309,7 +308,6 @@ class JsonFileTest extends TestCase public function testOnlyUnicode() { - $data = "\\/ƌ"; $this->assertJsonFormat('"\\\\\\/ƌ"', $data, JSON_UNESCAPED_UNICODE); diff --git a/tests/Composer/Test/Mock/ProcessExecutorMock.php b/tests/Composer/Test/Mock/ProcessExecutorMock.php index 778799744..9228c1310 100644 --- a/tests/Composer/Test/Mock/ProcessExecutorMock.php +++ b/tests/Composer/Test/Mock/ProcessExecutorMock.php @@ -15,7 +15,6 @@ namespace Composer\Test\Mock; use Composer\Util\ProcessExecutor; use Composer\Util\Platform; use PHPUnit\Framework\Assert; -use PHPUnit\Framework\TestCase; use PHPUnit\Framework\AssertionFailedError; use Symfony\Component\Process\Process; use React\Promise\Promise; diff --git a/tests/Composer/Test/Package/BasePackageTest.php b/tests/Composer/Test/Package/BasePackageTest.php index d620efdcf..627bbfb62 100644 --- a/tests/Composer/Test/Package/BasePackageTest.php +++ b/tests/Composer/Test/Package/BasePackageTest.php @@ -117,7 +117,7 @@ class BasePackageTest extends TestCase array('php'), '{^%s$}i', '{^php$}i', array('*'), '{^%s$}i', '{^.*$}i', array('foo', 'bar'), '§%s§', '§foo|bar§', - ) + ), ); } } diff --git a/tests/Composer/Test/Package/Version/VersionGuesserTest.php b/tests/Composer/Test/Package/Version/VersionGuesserTest.php index 58f5d20cb..5bb666180 100644 --- a/tests/Composer/Test/Package/Version/VersionGuesserTest.php +++ b/tests/Composer/Test/Package/Version/VersionGuesserTest.php @@ -18,7 +18,6 @@ use Composer\Semver\VersionParser; use Composer\Test\TestCase; use Composer\Util\Git as GitUtil; use Composer\Util\ProcessExecutor; -use Composer\Test\Mock\ProcessExecutorMock; class VersionGuesserTest extends TestCase { diff --git a/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php b/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php index 6d82d4ab8..925f278bb 100644 --- a/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php +++ b/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php @@ -16,7 +16,6 @@ use Composer\Question\StrictConfirmationQuestion; use Composer\Test\TestCase; use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Output\StreamOutput; /** diff --git a/tests/Composer/Test/Repository/ComposerRepositoryTest.php b/tests/Composer/Test/Repository/ComposerRepositoryTest.php index 50954f73c..21b9f56be 100644 --- a/tests/Composer/Test/Repository/ComposerRepositoryTest.php +++ b/tests/Composer/Test/Repository/ComposerRepositoryTest.php @@ -17,10 +17,8 @@ use Composer\Json\JsonFile; use Composer\Repository\ComposerRepository; use Composer\Repository\RepositoryInterface; use Composer\Test\Mock\FactoryMock; -use Composer\Test\Mock\HttpDownloaderMock; use Composer\Test\TestCase; use Composer\Package\Loader\ArrayLoader; -use Composer\Package\Version\VersionParser; class ComposerRepositoryTest extends TestCase { diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php index ec8ea8379..05f030eac 100644 --- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php +++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php @@ -1090,7 +1090,6 @@ Linked Version => 1.2.11', * @param list $constants * @param list $classDefinitions */ - public function testLibraryInformation( $extensions, $info, diff --git a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php index ad7d15896..7a721a1be 100644 --- a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php @@ -12,13 +12,11 @@ namespace Composer\Test\Repository\Vcs; -use Composer\Downloader\TransportException; use Composer\Repository\Vcs\GitHubDriver; use Composer\Test\Mock\ProcessExecutorMock; use Composer\Test\TestCase; use Composer\Util\Filesystem; use Composer\Config; -use Composer\Util\Http\Response; use Composer\Util\ProcessExecutor; class GitHubDriverTest extends TestCase @@ -119,7 +117,6 @@ class GitHubDriverTest extends TestCase ->method('isInteractive') ->will($this->returnValue(true)); - $httpDownloader = $this->getHttpDownloaderMock($io, $this->config); $httpDownloader->expects( [ @@ -162,7 +159,6 @@ class GitHubDriverTest extends TestCase ->method('isInteractive') ->will($this->returnValue(true)); - $httpDownloader = $this->getHttpDownloaderMock($io, $this->config); $httpDownloader->expects( [ diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php index 26df3a4e7..e2b79774d 100644 --- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php @@ -21,7 +21,6 @@ use Composer\Test\TestCase; use Composer\Util\Filesystem; use Composer\Util\ProcessExecutor; use PHPUnit\Framework\MockObject\MockObject; -use Prophecy\Argument; use Composer\Util\Http\Response; /** diff --git a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php index 17f9f3d7f..e3b32b9bf 100644 --- a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php @@ -16,7 +16,6 @@ use Composer\Repository\Vcs\SvnDriver; use Composer\Config; use Composer\Test\TestCase; use Composer\Util\Filesystem; -use Composer\Test\Mock\ProcessExecutorMock; use Composer\Util\ProcessExecutor; class SvnDriverTest extends TestCase diff --git a/tests/Composer/Test/TestCase.php b/tests/Composer/Test/TestCase.php index cc6a34229..153bad697 100644 --- a/tests/Composer/Test/TestCase.php +++ b/tests/Composer/Test/TestCase.php @@ -16,7 +16,6 @@ use Composer\Config; use Composer\IO\IOInterface; use Composer\Pcre\Preg; use Composer\Semver\VersionParser; -use Composer\Package\RootPackageInterface; use Composer\Package\PackageInterface; use Composer\Semver\Constraint\Constraint; use Composer\Test\Mock\HttpDownloaderMock; @@ -32,7 +31,6 @@ use Composer\Package\AliasPackage; use Composer\Package\RootAliasPackage; use Composer\Package\CompletePackage; use Composer\Package\CompleteAliasPackage; -use Composer\Package\CompletePackageInterface; use Composer\Package\Package; abstract class TestCase extends \PHPUnit\Framework\TestCase diff --git a/tests/Composer/Test/Util/BitbucketTest.php b/tests/Composer/Test/Util/BitbucketTest.php index e7fbf4eed..afc7f7aa2 100644 --- a/tests/Composer/Test/Util/BitbucketTest.php +++ b/tests/Composer/Test/Util/BitbucketTest.php @@ -15,7 +15,6 @@ namespace Composer\Test\Util; use Composer\Util\Bitbucket; use Composer\Util\Http\Response; use Composer\Test\TestCase; -use Composer\Test\Mock\ProcessExecutorMock; /** * @author Paul Wenke diff --git a/tests/Composer/Test/Util/GitHubTest.php b/tests/Composer/Test/Util/GitHubTest.php index b82b8e1d3..0da22733a 100644 --- a/tests/Composer/Test/Util/GitHubTest.php +++ b/tests/Composer/Test/Util/GitHubTest.php @@ -12,10 +12,7 @@ namespace Composer\Test\Util; -use _PHPStan_c862bb974\Symfony\Component\Console\Output\BufferedOutput; -use Composer\Downloader\TransportException; use Composer\Util\GitHub; -use Composer\Util\Http\Response; use Composer\Test\TestCase; /** diff --git a/tests/Composer/Test/Util/GitLabTest.php b/tests/Composer/Test/Util/GitLabTest.php index e7ef0b94b..397b164ad 100644 --- a/tests/Composer/Test/Util/GitLabTest.php +++ b/tests/Composer/Test/Util/GitLabTest.php @@ -12,10 +12,7 @@ namespace Composer\Test\Util; -use Composer\Downloader\TransportException; -use Composer\Test\Mock\HttpDownloaderMock; use Composer\Util\GitLab; -use Composer\Util\Http\Response; use Composer\Test\TestCase; /** diff --git a/tests/Composer/Test/Util/PerforceTest.php b/tests/Composer/Test/Util/PerforceTest.php index d7d2c416f..817e4fe48 100644 --- a/tests/Composer/Test/Util/PerforceTest.php +++ b/tests/Composer/Test/Util/PerforceTest.php @@ -195,7 +195,7 @@ class PerforceTest extends TestCase $this->processExecutor->expects( [ 'p4 set', - $expectedCommand + $expectedCommand, ], true ); @@ -216,7 +216,7 @@ class PerforceTest extends TestCase $this->processExecutor->expects( [ 'echo $P4USER', - $expectedCommand + $expectedCommand, ], 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/...'), - '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/...'), - '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 @@ -368,7 +368,7 @@ class PerforceTest extends TestCase [ [ '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 @@ -384,7 +384,7 @@ class PerforceTest extends TestCase [ [ '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 @@ -403,7 +403,7 @@ class PerforceTest extends TestCase [ [ '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 @@ -427,7 +427,7 @@ class PerforceTest extends TestCase [ [ '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 @@ -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'), - 'stdout' => PerforceTest::getComposerJson() + 'stdout' => PerforceTest::getComposerJson(), ], ], true @@ -466,11 +466,11 @@ class PerforceTest extends TestCase [ [ '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'), - 'stdout' => PerforceTest::getComposerJson() + 'stdout' => PerforceTest::getComposerJson(), ], ], 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'), - 'stdout' => PerforceTest::getComposerJson() + 'stdout' => PerforceTest::getComposerJson(), ], ], true @@ -605,8 +605,8 @@ class PerforceTest extends TestCase 'description' => 'Basic project for testing', 'minimum-stability' => 'dev', 'autoload' => [ - 'psr-0' => [] - ] + 'psr-0' => [], + ], ], JSON_FORCE_OBJECT); } diff --git a/tests/console-application.php b/tests/console-application.php index f795a549e..4ee45c8ee 100644 --- a/tests/console-application.php +++ b/tests/console-application.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + require __DIR__ . '/../vendor/autoload.php'; return new \Composer\Console\Application();