From 4b67a97a25a428381924f95621cbbd0a124ca624 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 4 Feb 2022 16:50:01 +0100 Subject: [PATCH] Update baseline --- phpstan/baseline-8.1.neon | 387 +----------------- .../Repository/ComposerRepositoryTest.php | 23 +- 2 files changed, 11 insertions(+), 399 deletions(-) diff --git a/phpstan/baseline-8.1.neon b/phpstan/baseline-8.1.neon index 1b93dddd8..204c842c7 100644 --- a/phpstan/baseline-8.1.neon +++ b/phpstan/baseline-8.1.neon @@ -1,392 +1,7 @@ parameters: ignoreErrors: - - message: "#^Parameter \\#1 \\$callback of function spl_autoload_register expects \\(callable\\(string\\)\\: void\\)\\|null, array\\{\\$this\\(Composer\\\\Autoload\\\\ClassLoader\\), 'loadClass'\\} given\\.$#" - count: 1 - path: ../src/Composer/Autoload/ClassLoader.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\\\|null given\\.$#" - count: 2 - path: ../src/Composer/Command/BaseDependencyCommand.php - - - - message: "#^Only booleans are allowed in an if condition, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/ConfigCommand.php - - - - message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Config\\\\JsonConfigSource, string\\} given\\.$#" - count: 2 - path: ../src/Composer/Command/ConfigCommand.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/DiagnoseCommand.php - - - - message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/ExecCommand.php - - - - message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/InitCommand.php - - - - message: "#^Parameter \\#1 \\$from of function rename expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/SelfUpdateCommand.php - - - - message: "#^Parameter \\#1 \\$user_id of function posix_getpwuid expects int, int\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/SelfUpdateCommand.php - - - - message: "#^Parameter \\#2 \\$permissions of function chmod expects int, int\\|false given\\.$#" - count: 1 - path: ../src/Composer/Command/SelfUpdateCommand.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\\\>\\|string given\\.$#" - count: 1 - path: ../src/Composer/Command/ShowCommand.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\|string given\\.$#" - count: 1 - path: ../src/Composer/Command/ShowCommand.php - - - - message: "#^Parameter \\#2 \\$callback of function uasort expects callable\\(string, string\\)\\: int, 'version_compare' given\\.$#" - count: 1 - path: ../src/Composer/Command/ShowCommand.php - - - - message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, array\\{Composer\\\\Package\\\\RootPackageInterface, 'getDevRequires'\\|'getRequires'\\} given\\.$#" - count: 1 - path: ../src/Composer/Command/ValidateCommand.php - - - - message: "#^Parameter \\#1 \\$string of function substr_replace expects array\\|string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Compiler.php - - - - message: "#^Parameter \\#1 \\$string of function rtrim expects string, int\\|string\\|null given\\.$#" - count: 1 - path: ../src/Composer/Config.php - - - - message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Config.php - - - - message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Composer\\\\Json\\\\JsonManipulator, string\\} given\\.$#" - count: 1 - path: ../src/Composer/Config/JsonConfigSource.php - - - - message: "#^Parameter \\#2 \\$callback of function uksort expects callable\\(string, string\\)\\: int, 'version_compare' given\\.$#" - count: 2 - path: ../src/Composer/DependencyResolver/Problem.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, array\\\\>\\|string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Downloader/FileDownloader.php - - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Downloader/GzipDownloader.php - - - - message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Downloader/GzipDownloader.php - - - - message: "#^Parameter \\#1 \\$stream of function gzclose expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Downloader/GzipDownloader.php - - - - message: "#^Parameter \\#1 \\$stream of function gzread expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Downloader/GzipDownloader.php - - - - message: "#^Parameter \\#3 \\$length of function fwrite expects int\\<0, max\\>\\|null, int given\\.$#" - count: 1 - path: ../src/Composer/Downloader/GzipDownloader.php - - - - message: "#^Parameter \\#1 \\$string of function rawurldecode expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Downloader/VcsDownloader.php - - - - message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#" - count: 1 - path: ../src/Composer/EventDispatcher/EventDispatcher.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Factory.php - - - - message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/IO/BufferIO.php - - - - message: "#^Parameter \\#1 \\$stream of function rewind expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/IO/BufferIO.php - - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Installer/BinaryInstaller.php - - - - message: "#^Parameter \\#1 \\$stream of function fgets expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Installer/BinaryInstaller.php - - - - message: "#^Parameter \\#1 \\$callback of function call_user_func expects callable\\(\\)\\: mixed, int\\\\|int\\<2, max\\>\\|string given\\.$#" - count: 1 - path: ../src/Composer/Installer/InstallationManager.php - - - - message: "#^Parameter \\#2 \\$handler of function pcntl_signal expects \\(callable\\(\\)\\: mixed\\)\\|int, int\\|string given\\.$#" - count: 2 - path: ../src/Composer/Installer/InstallationManager.php - - - - message: "#^Only numeric types are allowed in \\-, int\\|false given on the left side\\.$#" - count: 1 - path: ../src/Composer/Package/Archiver/PharArchiver.php - - - - message: "#^Parameter \\#2 \\$baseDirectory of method Phar\\:\\:buildFromIterator\\(\\) expects string\\|null, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Package/Archiver/PharArchiver.php - - - - message: "#^Parameter \\#1 \\$array of function ksort expects array, array\\\\|string given\\.$#" - count: 1 - path: ../src/Composer/Package/Dumper/ArrayDumper.php - - - - message: "#^Only booleans are allowed in an if condition, int\\|false given\\.$#" - count: 1 - path: ../src/Composer/Plugin/PluginManager.php - - - - message: "#^Parameter \\#1 \\$array of function array_splice expects array, array\\\\|null given\\.$#" - count: 1 - path: ../src/Composer/Repository/ArrayRepository.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\\\|null given\\.$#" - count: 1 - path: ../src/Composer/Repository/ArrayRepository.php - - - - message: "#^Parameter \\#1 \\$array of function array_keys expects array, array\\\\>\\|null given\\.$#" - count: 1 - path: ../src/Composer/Repository/ComposerRepository.php - - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, array\\\\|null given\\.$#" - count: 1 - path: ../src/Composer/Repository/ComposerRepository.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, string\\|null given\\.$#" - count: 1 - path: ../src/Composer/Repository/Vcs/GitLabDriver.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/SelfUpdate/Versions.php - - - - message: "#^Parameter \\#2 \\$string of function explode expects string, string\\|false\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/AuthHelper.php - - - - message: "#^Parameter \\#1 \\$from of function stream_copy_to_stream expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/Filesystem.php - - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 4 - path: ../src/Composer/Util/Filesystem.php - - - - message: "#^Parameter \\#1 \\$stream of function feof expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/Filesystem.php - - - - message: "#^Parameter \\#1 \\$stream of function fread expects resource, resource\\|false given\\.$#" - count: 2 - path: ../src/Composer/Util/Filesystem.php - - - - message: "#^Parameter \\#2 \\$to of function stream_copy_to_stream expects resource, resource\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/Filesystem.php - - - - message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, string\\|null given\\.$#" - count: 17 - path: ../src/Composer/Util/Git.php - - - - message: "#^Parameter \\#1 \\$string of function trim expects string, string\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/GitHub.php - - - - message: "#^Parameter \\#1 \\$string of function rawurlencode expects string, string\\|null given\\.$#" - count: 2 - path: ../src/Composer/Util/Hg.php - - - - message: "#^Parameter \\#1 \\$handle of function curl_close expects CurlHandle, resource given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$handle of function curl_getinfo expects CurlHandle, resource given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$haystack of function strpos expects string, string\\|null given\\.$#" + message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$jobs \\(array\\\\) does not accept non\\-empty\\-array\\, options\\: array, progress\\: array, curlHandle\\: CurlHandle\\|resource, filename\\: string\\|false\\|null, headerHandle\\: resource, \\.\\.\\.\\}\\>\\.$#" count: 1 path: ../src/Composer/Util/Http/CurlDownloader.php - - - message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_add_handle expects CurlMultiHandle, resource\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_exec expects CurlMultiHandle, resource\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_info_read expects CurlMultiHandle, resource\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_remove_handle expects CurlMultiHandle, resource\\|null given\\.$#" - count: 2 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$multi_handle of function curl_multi_select expects CurlMultiHandle, resource\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#2 \\$handle of function curl_multi_remove_handle expects CurlHandle, resource given\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$multiHandle \\(resource\\|null\\) does not accept CurlMultiHandle\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Property Composer\\\\Util\\\\Http\\\\CurlDownloader\\:\\:\\$shareHandle \\(resource\\|null\\) does not accept CurlShareHandle\\.$#" - count: 1 - path: ../src/Composer/Util/Http/CurlDownloader.php - - - - message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/NoProxyPattern.php - - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 2 - path: ../src/Composer/Util/Perforce.php - - - - message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#" - count: 13 - path: ../src/Composer/Util/Perforce.php - - - - message: "#^Parameter \\#1 \\$string1 of function strcmp expects string, string\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Perforce.php - - - - message: "#^Parameter \\#2 \\$needle of function strpos expects string, string\\|null given\\.$#" - count: 1 - path: ../src/Composer/Util/Perforce.php - - - - message: "#^Parameter \\#3 \\$length of function substr expects int\\|null, int\\<0, max\\>\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/Perforce.php - - - - message: "#^Parameter \\#1 \\$string of function base64_encode expects string, string\\|false given\\.$#" - count: 1 - path: ../src/Composer/Util/RemoteFilesystem.php - - - - message: "#^Parameter \\#5 \\$length of function file_get_contents expects int\\<0, max\\>\\|null, int given\\.$#" - count: 1 - path: ../src/Composer/Util/RemoteFilesystem.php - - - - message: "#^Parameter \\#1 \\$include_path of function set_include_path expects string, string\\|false given\\.$#" - count: 2 - path: ../tests/Composer/Test/Autoload/AutoloadGeneratorTest.php - - - - message: "#^Parameter \\#1 \\$string of function rtrim expects string, string\\|false given\\.$#" - count: 2 - path: ../tests/Composer/Test/ConfigTest.php - - - - message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{Composer\\\\Repository\\\\CompositeRepository, string\\} given\\.$#" - count: 1 - path: ../tests/Composer/Test/Repository/CompositeRepositoryTest.php - - - - message: "#^Parameter \\#1 \\$object of method ReflectionProperty\\:\\:getValue\\(\\) expects object\\|null, object\\|string given\\.$#" - count: 1 - path: ../tests/Composer/Test/Util/RemoteFilesystemTest.php - diff --git a/tests/Composer/Test/Repository/ComposerRepositoryTest.php b/tests/Composer/Test/Repository/ComposerRepositoryTest.php index 266dcf3c6..50954f73c 100644 --- a/tests/Composer/Test/Repository/ComposerRepositoryTest.php +++ b/tests/Composer/Test/Repository/ComposerRepositoryTest.php @@ -206,24 +206,21 @@ class ComposerRepositoryTest extends TestCase 'url' => 'http://example.org', ); - $result = array( - 'results' => array( - array( - 'name' => 'foo', - 'description' => null, - ), - ), + $httpDownloader = $this->getHttpDownloaderMock(); + $httpDownloader->expects( + [ + ['url' => 'http://example.org/packages.json', 'body' => JsonFile::encode(array('search' => '/search.json?q=%query%&type=%type%'))], + ['url' => 'http://example.org/search.json?q=foo+bar&type=', 'body' => JsonFile::encode(array())], + ], + true ); - - $httpDownloader = new HttpDownloaderMock(array( - 'http://example.org/packages.json' => JsonFile::encode(array('search' => '/search.json?q=%query%&type=%type%')), - 'http://example.org/search.json?q=foo+bar&type=' => JsonFile::encode(array()), - )); $eventDispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher') ->disableOriginalConstructor() ->getMock(); - $repository = new ComposerRepository($repoConfig, new NullIO, FactoryMock::createConfig(), $httpDownloader, $eventDispatcher); + $config = FactoryMock::createConfig(); + $config->merge(['config' => ['cache-read-only' => true]]); + $repository = new ComposerRepository($repoConfig, new NullIO, $config, $httpDownloader, $eventDispatcher); $this->assertEmpty( $repository->search('foo bar', RepositoryInterface::SEARCH_FULLTEXT)