diff --git a/src/ApiRequester.php b/src/ApiRequester.php index 6a53bde..cc3c8bc 100644 --- a/src/ApiRequester.php +++ b/src/ApiRequester.php @@ -13,7 +13,7 @@ interface ApiRequester { /** * @since 2.2 * - * @param Request $request + * @param Request $request The GET request to send. * * @return mixed Normally an array */ @@ -22,7 +22,7 @@ public function getRequest( Request $request ); /** * @since 2.2 * - * @param Request $request + * @param Request $request The POST request to send. * * @return mixed Normally an array */ diff --git a/src/ApiUser.php b/src/ApiUser.php index e25d85d..b2f5915 100644 --- a/src/ApiUser.php +++ b/src/ApiUser.php @@ -31,9 +31,9 @@ class ApiUser { private $domain; /** - * @param string $username - * @param string $password - * @param string|null $domain + * @param string $username The username. + * @param string $password The user's password. + * @param string|null $domain The domain (for authentication systems that support domains). * * @throws \InvalidArgumentException */ @@ -76,7 +76,7 @@ public function getDomain() { /** * @since 0.1 - * @param mixed $other + * @param mixed $other Another ApiUser object to compare with. * * @return bool */ diff --git a/src/AsyncApiRequester.php b/src/AsyncApiRequester.php index f28f59c..6190ac7 100644 --- a/src/AsyncApiRequester.php +++ b/src/AsyncApiRequester.php @@ -15,7 +15,7 @@ interface AsyncApiRequester { /** * @since 2.2 * - * @param Request $request + * @param Request $request The GET request to send. * * @return PromiseInterface * Normally promising an array, though can be mixed (json_decode result) @@ -26,7 +26,7 @@ public function getRequestAsync( Request $request ); /** * @since 2.2 * - * @param Request $request + * @param Request $request The POST request to send. * * @return PromiseInterface * Normally promising an array, though can be mixed (json_decode result) diff --git a/src/FluentRequest.php b/src/FluentRequest.php index 5e2a3a3..1fcb964 100644 --- a/src/FluentRequest.php +++ b/src/FluentRequest.php @@ -49,7 +49,7 @@ public static function factory() { /** * @since 1.0 * - * @param string $action + * @param string $action The action name. * * @return $this */ @@ -63,7 +63,7 @@ public function setAction( $action ) { * * @since 1.0 * - * @param array $params + * @param array $params New parameters. * * @return $this */ @@ -77,7 +77,7 @@ public function setParams( array $params ) { * * @since 1.0 * - * @param array $params + * @param array $params Additional parameters. * * @return $this */ @@ -87,10 +87,12 @@ public function addParams( array $params ) { } /** + * Set a single parameter. + * * @since 1.0 * - * @param string $param - * @param string $value + * @param string $param The parameter name. + * @param string $value The parameter value. * * @return $this */ @@ -100,11 +102,11 @@ public function setParam( $param, $value ) { } /** - * Totally overwrite any previously set params + * Totally overwrite any previously set HTTP headers. * * @since 1.0 * - * @param array $headers + * @param array $headers New headers. * * @return $this */ diff --git a/src/Guzzle/ClientFactory.php b/src/Guzzle/ClientFactory.php index d4eac83..704a166 100644 --- a/src/Guzzle/ClientFactory.php +++ b/src/Guzzle/ClientFactory.php @@ -85,7 +85,7 @@ private function newClient() { * * @since 2.1 * - * @param LoggerInterface $logger + * @param LoggerInterface $logger The new Logger object. * * @return null */ diff --git a/src/Guzzle/MiddlewareFactory.php b/src/Guzzle/MiddlewareFactory.php index b1087c0..9e03c02 100644 --- a/src/Guzzle/MiddlewareFactory.php +++ b/src/Guzzle/MiddlewareFactory.php @@ -27,6 +27,9 @@ public function __construct() { $this->logger = new NullLogger(); } + /** + * @param LoggerInterface $logger The new Logger object. + */ public function setLogger( LoggerInterface $logger ) { $this->logger = $logger; } diff --git a/src/MediawikiApi.php b/src/MediawikiApi.php index 3c7ec49..0b41dde 100644 --- a/src/MediawikiApi.php +++ b/src/MediawikiApi.php @@ -161,7 +161,7 @@ private function getClient() { * * @since 1.1 * - * @param LoggerInterface $logger + * @param LoggerInterface $logger The new Logger object. * * @return null */ @@ -173,7 +173,7 @@ public function setLogger( LoggerInterface $logger ) { /** * @since 2.0 * - * @param Request $request + * @param Request $request The GET request to send. * * @return PromiseInterface * Normally promising an array, though can be mixed (json_decode result) @@ -194,7 +194,7 @@ public function getRequestAsync( Request $request ) { /** * @since 2.0 * - * @param Request $request + * @param Request $request The POST request to send. * * @return PromiseInterface * Normally promising an array, though can be mixed (json_decode result) @@ -215,7 +215,7 @@ public function postRequestAsync( Request $request ) { /** * @since 0.2 * - * @param Request $request + * @param Request $request The GET request to send. * * @return mixed Normally an array */ @@ -232,7 +232,7 @@ public function getRequest( Request $request ) { /** * @since 0.2 * - * @param Request $request + * @param Request $request The POST request to send. * * @return mixed Normally an array */ @@ -374,7 +374,7 @@ public function isLoggedin() { /** * @since 0.1 * - * @param ApiUser $apiUser + * @param ApiUser $apiUser The ApiUser to log in as. * * @throws UsageException * @return bool success @@ -451,7 +451,7 @@ public function logout() { /** * @since 0.1 * - * @param string $type + * @param string $type The token type to get. * * @return string */ @@ -460,9 +460,9 @@ public function getToken( $type = 'csrf' ) { } /** - * @since 0.1 + * Clear all tokens stored by the API. * - * Clears all tokens stored by the api + * @since 0.1 */ public function clearTokens() { $this->session->clearTokens(); diff --git a/src/MediawikiApiInterface.php b/src/MediawikiApiInterface.php index 6dfe625..8358067 100644 --- a/src/MediawikiApiInterface.php +++ b/src/MediawikiApiInterface.php @@ -20,7 +20,7 @@ public function isLoggedin(); /** * @since 2.2 * - * @param ApiUser $apiUser + * @param ApiUser $apiUser The ApiUser to log in as. * * @throws UsageException * @return bool success @@ -37,7 +37,7 @@ public function logout(); /** * @since 2.2 * - * @param string $type + * @param string $type The type of token to get. * * @return string */ diff --git a/src/MediawikiSession.php b/src/MediawikiSession.php index 707a06b..c430695 100644 --- a/src/MediawikiSession.php +++ b/src/MediawikiSession.php @@ -35,7 +35,7 @@ class MediawikiSession implements LoggerAwareInterface { private $logger; /** - * @param MediawikiApi $api + * @param MediawikiApi $api The API object to use for this session. */ public function __construct( MediawikiApi $api ) { $this->api = $api; @@ -47,7 +47,7 @@ public function __construct( MediawikiApi $api ) { * * @since 1.1 * - * @param LoggerInterface $logger + * @param LoggerInterface $logger The new Logger object. * * @return null */ @@ -60,7 +60,7 @@ public function setLogger( LoggerInterface $logger ) { * * @since 0.1 * - * @param string $type + * @param string $type The type of token to get. * * @return string */ diff --git a/src/SimpleRequest.php b/src/SimpleRequest.php index e7b241b..1e33348 100644 --- a/src/SimpleRequest.php +++ b/src/SimpleRequest.php @@ -29,17 +29,13 @@ class SimpleRequest implements Request { private $headers; /** - * @param string $action - * @param array $params - * @param array $headers + * @param string $action The API action. + * @param array $params The parameters for the action. + * @param array $headers Any extra HTTP headers to send. * * @throws InvalidArgumentException */ - public function __construct( - $action, - array $params = [], - array $headers = [] - ) { + public function __construct( $action, array $params = [], array $headers = [] ) { if ( !is_string( $action ) ) { throw new InvalidArgumentException( '$action must be string' ); } @@ -48,10 +44,16 @@ public function __construct( $this->headers = $headers; } + /** + * @return string[] + */ public function getParams() { return array_merge( [ 'action' => $this->action ], $this->params ); } + /** + * @return string[] + */ public function getHeaders() { return $this->headers; } diff --git a/src/UsageException.php b/src/UsageException.php index 8e07f86..77148f1 100644 --- a/src/UsageException.php +++ b/src/UsageException.php @@ -31,8 +31,8 @@ class UsageException extends Exception { /** * @since 0.1 * - * @param string $apiCode - * @param string $message + * @param string $apiCode The API error code. + * @param string $message The API error message. * @param array $result the result the exception was generated from */ public function __construct( $apiCode = '', $message = '', $result = [] ) { diff --git a/tests/Integration/TestEnvironment.php b/tests/Integration/TestEnvironment.php index 82c0caf..cb78150 100644 --- a/tests/Integration/TestEnvironment.php +++ b/tests/Integration/TestEnvironment.php @@ -11,6 +11,12 @@ */ class TestEnvironment { + /** + * Get a new TestEnvironment. + * This is identical to calling self::__construct() but is useful for fluent construction. + * + * @return TestEnvironment + */ public static function newInstance() { return new self(); } @@ -71,8 +77,8 @@ public function getApi() { /** * Save a wiki page. - * @param string $title - * @param string $content + * @param string $title The title of the page. + * @param string $content The complete page text to save. */ public function savePage( $title, $content ) { $params = [ diff --git a/tests/Unit/MediawikiSessionTest.php b/tests/Unit/MediawikiSessionTest.php index 5de45a6..667a526 100644 --- a/tests/Unit/MediawikiSessionTest.php +++ b/tests/Unit/MediawikiSessionTest.php @@ -57,7 +57,7 @@ public function testGetToken( $tokenType ) { /** * @dataProvider provideTokenTypes */ - public function testGetToken_pre125( $tokenType ) { + public function testGetTokenPre125( $tokenType ) { $mockApi = $this->getMockApi(); $mockApi->expects( $this->at( 0 ) ) ->method( 'postRequest' )