Improve documentation about object to be stdClass or specific type

Some classes still needs exclude for the sniff

Change-Id: I9536c2ee84f6fb4c83cf862a152cf6b00344cb97
This commit is contained in:
Umherirrender 2020-10-28 21:51:19 +01:00
parent 5ea451826e
commit 49efbfe2fb
15 changed files with 29 additions and 17 deletions

View file

@ -5,8 +5,6 @@
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn" />
<exclude name="MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPrivate" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.PropertyDocumentation.MissingDocumentationPublic" />

View file

@ -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 ) {

View file

@ -1,4 +1,8 @@
<?php
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
/**
* Delayed loading of global objects.
*

View file

@ -126,7 +126,7 @@ class TempFSFile extends FSFile {
/**
* Clean up the temporary file only after an object goes out of scope
*
* @param object $object
* @param mixed $object
* @return TempFSFile This object
*/
public function bind( $object ) {

View file

@ -87,7 +87,7 @@ abstract class ImageQueryPage extends QueryPage {
*
* @stable to override
*
* @param object $row Result row
* @param stdClass $row Result row
* @return string
*/
protected function getCellHtml( $row ) {

View file

@ -114,7 +114,7 @@ abstract class WantedQueryPage extends QueryPage {
* Make a "what links here" link for a given title
*
* @param Title $title Title to make the link for
* @param object $result Result row
* @param stdClass $result Result row
* @return string
*/
protected function makeWlhLink( $title, $result ) {

View file

@ -128,7 +128,7 @@ class SpecialMostLinkedTemplates extends QueryPage {
* Make a "what links here" link for a given title
*
* @param Title $title Title to make the link for
* @param object $result Result row
* @param stdClass $result Result row
* @return string
*/
private function makeWlhLink( $title, $result ) {

View file

@ -420,7 +420,7 @@ class SpecialNewpages extends IncludableSpecialPage {
* Format a row, providing the timestamp, links to the page/history,
* size, user links, and a comment
*
* @param object $result Result row
* @param stdClass $result Result row
* @return string
*/
public function formatRow( $result ) {
@ -541,7 +541,7 @@ class SpecialNewpages extends IncludableSpecialPage {
/**
* Should a specific result row provide "patrollable" links?
*
* @param object $result Result row
* @param stdClass $result Result row
* @return bool
*/
protected function patrollable( $result ) {

View file

@ -92,7 +92,7 @@ class SpecialProtectedtitles extends SpecialPage {
/**
* Callback function to output a restriction
*
* @param object $row Database row
* @param stdClass $row Database row
* @return string
*/
public function formatRow( $row ) {

View file

@ -34,7 +34,7 @@ trait MediaWikiTestCaseTrait {
* @param string $type
* @param string[] $allow methods to allow
*
* @return object|MockObject
* @return MockObject
*/
protected function createNoOpMock( $type, $allow = [] ) {
$mock = $this->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 )

View file

@ -1,5 +1,7 @@
<?php
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
namespace Wikimedia\Tests;
use Generator;

View file

@ -1,4 +1,7 @@
<?php
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -195,7 +198,7 @@ class SerializationTestUtils {
* @param string $class
* @param string $testCaseName
* @param string|null $version
* @return object
* @return \stdClass
*/
public function getStoredSerializedInstance(
string $class,

View file

@ -1,5 +1,7 @@
<?php
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
use MediaWiki\Block\DatabaseBlock;
/**
@ -78,7 +80,7 @@ abstract class FormSpecialPageTestCase extends SpecialPageTestBase {
* @param string $name
* @return callable
*/
protected function getMethod( $obj, $name ) {
protected function getMethod( object $obj, $name ) {
$method = new ReflectionMethod( $obj, $name );
$method->setAccessible( true );
return $method->getClosure( $obj );

View file

@ -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();

View file

@ -1,5 +1,8 @@
<?php
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintReturn
// phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam
/**
* Test that a factory class correctly forwards all arguments to the class it constructs. This is
* useful because sometimes a class' constructor will have more arguments added, and it's easy to