From 49efbfe2fb4dd275b7a25a53d507e2aafb136fec Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Wed, 28 Oct 2020 21:51:19 +0100 Subject: [PATCH] Improve documentation about object to be stdClass or specific type Some classes still needs exclude for the sniff Change-Id: I9536c2ee84f6fb4c83cf862a152cf6b00344cb97 --- .phpcs.xml | 2 -- includes/PathRouter.php | 6 +++--- includes/StubObject.php | 4 ++++ includes/libs/filebackend/fsfile/TempFSFile.php | 2 +- includes/specialpage/ImageQueryPage.php | 2 +- includes/specialpage/WantedQueryPage.php | 2 +- includes/specials/SpecialMostLinkedTemplates.php | 2 +- includes/specials/SpecialNewpages.php | 4 ++-- includes/specials/SpecialProtectedtitles.php | 2 +- tests/phpunit/MediaWikiTestCaseTrait.php | 4 ++-- .../includes/libs/serialization/SerializationTestTrait.php | 2 ++ .../includes/libs/serialization/SerializationTestUtils.php | 5 ++++- .../includes/specialpage/FormSpecialPageTestCase.php | 4 +++- tests/phpunit/maintenance/MaintenanceBaseTestCase.php | 2 +- tests/phpunit/unit/includes/FactoryArgTestTrait.php | 3 +++ 15 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index dd1128d0da6..b7d4e3eb43e 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -5,8 +5,6 @@ - - diff --git a/includes/PathRouter.php b/includes/PathRouter.php index b0eb5aa5c42..eb88d84a1b0 100644 --- a/includes/PathRouter.php +++ b/includes/PathRouter.php @@ -73,7 +73,7 @@ class PathRouter { /** - * @var array + * @var stdClass[] */ private $patterns = []; @@ -209,7 +209,7 @@ class PathRouter { } /** - * @param object $pattern + * @param stdClass $pattern * @return float|int */ protected static function makeWeight( $pattern ) { @@ -292,7 +292,7 @@ class PathRouter { /** * @param string $path - * @param object $pattern + * @param stdClass $pattern * @return array|null */ protected static function extractTitle( $path, $pattern ) { diff --git a/includes/StubObject.php b/includes/StubObject.php index 1d50b785d30..3b6ece793d9 100644 --- a/includes/StubObject.php +++ b/includes/StubObject.php @@ -1,4 +1,8 @@ createMock( $type ); @@ -46,7 +46,7 @@ trait MediaWikiTestCaseTrait { * Return a PHPUnit mock that is expected to never have any methods called on it. * * @param string $type - * @return object + * @return MockObject */ protected function createNoOpAbstractMock( $type ) { $mock = $this->getMockBuilder( $type ) diff --git a/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php b/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php index 5b595be60b8..3f68bc70990 100644 --- a/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php +++ b/tests/phpunit/includes/libs/serialization/SerializationTestTrait.php @@ -1,5 +1,7 @@ setAccessible( true ); return $method->getClosure( $obj ); diff --git a/tests/phpunit/maintenance/MaintenanceBaseTestCase.php b/tests/phpunit/maintenance/MaintenanceBaseTestCase.php index efee48f3ee2..d5b60374d74 100644 --- a/tests/phpunit/maintenance/MaintenanceBaseTestCase.php +++ b/tests/phpunit/maintenance/MaintenanceBaseTestCase.php @@ -57,7 +57,7 @@ abstract class MaintenanceBaseTestCase extends MediaWikiIntegrationTestCase { /** * Called by setUp to initialize $this->maintenance. * - * @return object The Maintenance instance to test. + * @return Maintenance The Maintenance instance to test. */ protected function createMaintenance() { $className = $this->getMaintenanceClass(); diff --git a/tests/phpunit/unit/includes/FactoryArgTestTrait.php b/tests/phpunit/unit/includes/FactoryArgTestTrait.php index b014c29a227..8a586b4f3d7 100644 --- a/tests/phpunit/unit/includes/FactoryArgTestTrait.php +++ b/tests/phpunit/unit/includes/FactoryArgTestTrait.php @@ -1,5 +1,8 @@