From 480a6439fd388361cfa9bbafcfe0d5eaa69f8bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20De=20la=20Cruz?= <31167513+adlacruzes@users.noreply.github.com> Date: Fri, 20 Nov 2020 09:28:09 +0100 Subject: [PATCH] Fix phpstan phpdocs issues (#9478) --- phpstan/config.neon | 23 +++++++++++++++++++ src/Composer/Command/SelfUpdateCommand.php | 2 +- .../Operation/OperationInterface.php | 2 +- src/Composer/Installer/PackageEvent.php | 1 - .../Repository/PlatformRepository.php | 2 +- src/Composer/Util/Bitbucket.php | 1 - src/Composer/Util/Http/ProxyManager.php | 2 +- src/Composer/Util/NoProxyPattern.php | 2 +- .../Repository/PlatformRepositoryTest.php | 2 +- tests/Composer/Test/Util/AuthHelperTest.php | 4 ++-- 10 files changed, 31 insertions(+), 10 deletions(-) diff --git a/phpstan/config.neon b/phpstan/config.neon index c08b7833a..e4f0d99e8 100644 --- a/phpstan/config.neon +++ b/phpstan/config.neon @@ -1,5 +1,6 @@ parameters: level: 1 + checkClassCaseSensitivity: true # Level 2 rule excludes_analyse: - '../tests/Composer/Test/Fixtures/*' - '../tests/Composer/Test/Autoload/Fixtures/*' @@ -34,3 +35,25 @@ parameters: rules: - Composer\PHPStanRules\AnonymousFunctionWithThisRule + # Level 2 rules + - PHPStan\Rules\Cast\EchoRule + - PHPStan\Rules\Cast\InvalidCastRule + - PHPStan\Rules\Cast\InvalidPartOfEncapsedStringRule + - PHPStan\Rules\Cast\PrintRule + - PHPStan\Rules\Functions\IncompatibleDefaultParameterTypeRule + - PHPStan\Rules\Generics\ClassAncestorsRule + - PHPStan\Rules\Generics\ClassTemplateTypeRule + - PHPStan\Rules\Generics\FunctionTemplateTypeRule + - PHPStan\Rules\Generics\FunctionSignatureVarianceRule + - PHPStan\Rules\Generics\InterfaceAncestorsRule + - PHPStan\Rules\Generics\InterfaceTemplateTypeRule + - PHPStan\Rules\Generics\MethodTemplateTypeRule + - PHPStan\Rules\Generics\MethodSignatureVarianceRule + - PHPStan\Rules\Generics\TraitTemplateTypeRule + - PHPStan\Rules\Operators\InvalidBinaryOperationRule + - PHPStan\Rules\Operators\InvalidUnaryOperationRule + - PHPStan\Rules\Operators\InvalidComparisonOperationRule + - PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule + - PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule + - PHPStan\Rules\PhpDoc\InvalidPhpDocTagValueRule + - PHPStan\Rules\PhpDoc\InvalidPHPStanDocTagRule diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index a50d9fdad..110fa9100 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -400,7 +400,7 @@ TAGSPUBKEY * @param string $localFilename The composer.phar location * @param string $newFilename The downloaded or backup phar * @param string $backupTarget The filename to use for the backup - * @throws \FilesystemException If the file cannot be moved + * @throws FilesystemException If the file cannot be moved * @return bool Whether the phar is valid and has been moved */ protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null) diff --git a/src/Composer/DependencyResolver/Operation/OperationInterface.php b/src/Composer/DependencyResolver/Operation/OperationInterface.php index dc61c3a94..363cf35a2 100644 --- a/src/Composer/DependencyResolver/Operation/OperationInterface.php +++ b/src/Composer/DependencyResolver/Operation/OperationInterface.php @@ -29,7 +29,7 @@ interface OperationInterface /** * Serializes the operation in a human readable format * - * @param $lock bool Whether this is an operation on the lock file + * @param bool $lock Whether this is an operation on the lock file * @return string */ public function show($lock); diff --git a/src/Composer/Installer/PackageEvent.php b/src/Composer/Installer/PackageEvent.php index 0be86a77c..c8ec333ba 100644 --- a/src/Composer/Installer/PackageEvent.php +++ b/src/Composer/Installer/PackageEvent.php @@ -66,7 +66,6 @@ class PackageEvent extends Event * @param IOInterface $io * @param bool $devMode * @param RepositoryInterface $localRepo - * @param Request $request * @param OperationInterface[] $operations * @param OperationInterface $operation */ diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index e5c6785e1..000735198 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -599,7 +599,7 @@ class PlatformRepository extends ArrayRepository /** * Check if a package name is a platform package. * - * @param $name + * @param string $name * @return bool */ public static function isPlatformPackage($name) diff --git a/src/Composer/Util/Bitbucket.php b/src/Composer/Util/Bitbucket.php index f91c2757e..c88c8311e 100644 --- a/src/Composer/Util/Bitbucket.php +++ b/src/Composer/Util/Bitbucket.php @@ -90,7 +90,6 @@ class Bitbucket } /** - * @param string $originUrl * @return bool */ private function requestAccessToken() diff --git a/src/Composer/Util/Http/ProxyManager.php b/src/Composer/Util/Http/ProxyManager.php index 1963f8fc2..6861c8833 100644 --- a/src/Composer/Util/Http/ProxyManager.php +++ b/src/Composer/Util/Http/ProxyManager.php @@ -152,7 +152,7 @@ class ProxyManager /** * Sets initial data * - * @param string $proxyUrl Proxy url + * @param string $url Proxy url * @param string $scheme Environment variable scheme */ private function setData($url, $scheme) diff --git a/src/Composer/Util/NoProxyPattern.php b/src/Composer/Util/NoProxyPattern.php index adf60f0f7..0ddf371b2 100644 --- a/src/Composer/Util/NoProxyPattern.php +++ b/src/Composer/Util/NoProxyPattern.php @@ -174,7 +174,7 @@ class NoProxyPattern * @param int $index * @param string $hostName * - * @return {null|stdClass} Null if the hostname is invalid + * @return null|stdClass Null if the hostname is invalid */ private function getRule($index, $hostName) { diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php index 2da09c1dd..caa5174db 100644 --- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php +++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php @@ -1073,7 +1073,7 @@ Linked Version => 1.2.11', * @param array $expectations * @param array $functions * @param array $constants - * @param array $classes + * @param array $classDefinitions */ public function testLibraryInformation( $extensions, diff --git a/tests/Composer/Test/Util/AuthHelperTest.php b/tests/Composer/Test/Util/AuthHelperTest.php index f26ba3d31..d198b26f2 100644 --- a/tests/Composer/Test/Util/AuthHelperTest.php +++ b/tests/Composer/Test/Util/AuthHelperTest.php @@ -514,8 +514,8 @@ class AuthHelperTest extends TestCase } /** - * @param $origin - * @param $auth + * @param string $origin + * @param array $auth */ private function expectsAuthentication($origin, $auth) {