@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | /** |
| 415 | 415 | * Handle an HTTP request, defined with a SS_HTTPRequest object. |
| 416 | 416 | * |
| 417 | - * @param SS_HTTPRequest $request |
|
| 417 | + * @param HTTPRequest $request |
|
| 418 | 418 | * @param Session $session |
| 419 | 419 | * @param DataModel $model |
| 420 | 420 | * |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | * Returns the domain part of the URL 'http://www.mysite.com'. Returns FALSE is this environment |
| 561 | 561 | * variable isn't set. |
| 562 | 562 | * |
| 563 | - * @return bool|string |
|
| 563 | + * @return string|false |
|
| 564 | 564 | */ |
| 565 | 565 | public static function protocolAndHost() { |
| 566 | 566 | $alternate = Config::inst()->get('SilverStripe\Control\Director', 'alternate_base_url'); |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | /** |
| 894 | 894 | * Returns true if the given file exists. Filename should be relative to the site root. |
| 895 | 895 | * |
| 896 | - * @param $file |
|
| 896 | + * @param string $file |
|
| 897 | 897 | * |
| 898 | 898 | * @return bool |
| 899 | 899 | */ |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | * Can also be checked with {@link Director::isDev()}, {@link Director::isTest()}, and |
| 1112 | 1112 | * {@link Director::isLive()}. |
| 1113 | 1113 | * |
| 1114 | - * @return bool|string |
|
| 1114 | + * @return string|false |
|
| 1115 | 1115 | */ |
| 1116 | 1116 | public static function get_environment_type() { |
| 1117 | 1117 | if (Director::isLive()) { |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @param string The new URL |
| 133 | 133 | * |
| 134 | - * @return SS_HTTPRequest The updated request |
|
| 134 | + * @return HTTPRequest The updated request |
|
| 135 | 135 | */ |
| 136 | 136 | public function setUrl($url) { |
| 137 | 137 | $this->url = $url; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * @param string $body |
| 190 | - * @return SS_HTTPRequest $this |
|
| 190 | + * @return HTTPRequest $this |
|
| 191 | 191 | */ |
| 192 | 192 | public function setBody($body) { |
| 193 | 193 | $this->body = $body; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
| 198 | - * @return null|string |
|
| 198 | + * @return string |
|
| 199 | 199 | */ |
| 200 | 200 | public function getBody() { |
| 201 | 201 | return $this->body; |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * @param string $name |
| 247 | - * @return mixed |
|
| 247 | + * @return string |
|
| 248 | 248 | */ |
| 249 | 249 | public function requestVar($name) { |
| 250 | 250 | if(isset($this->postVars[$name])) return $this->postVars[$name]; |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * Remove an existing HTTP header |
| 298 | 298 | * |
| 299 | 299 | * @param string $header |
| 300 | - * @return mixed |
|
| 300 | + * @return string |
|
| 301 | 301 | */ |
| 302 | 302 | public function getHeader($header) { |
| 303 | 303 | return (isset($this->headers[$header])) ? $this->headers[$header] : null; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * e.g. "Content-Type". |
| 309 | 309 | * |
| 310 | 310 | * @param string $header |
| 311 | - * @return SS_HTTPRequest $this |
|
| 311 | + * @return HTTPRequest $this |
|
| 312 | 312 | */ |
| 313 | 313 | public function removeHeader($header) { |
| 314 | 314 | if(isset($this->headers[$header])) unset($this->headers[$header]); |
@@ -394,10 +394,10 @@ discard block |
||
| 394 | 394 | * it's only advisable to send small files through this method. |
| 395 | 395 | * |
| 396 | 396 | * @static |
| 397 | - * @param $fileData |
|
| 397 | + * @param string $fileData |
|
| 398 | 398 | * @param $fileName |
| 399 | - * @param null $mimeType |
|
| 400 | - * @return SS_HTTPResponse |
|
| 399 | + * @param string $mimeType |
|
| 400 | + * @return HTTPResponse |
|
| 401 | 401 | */ |
| 402 | 402 | public static function send_file($fileData, $fileName, $mimeType = null) { |
| 403 | 403 | if(!$mimeType) { |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | /** |
| 573 | 573 | * @param $params |
| 574 | - * @return SS_HTTPRequest $this |
|
| 574 | + * @return HTTPRequest $this |
|
| 575 | 575 | */ |
| 576 | 576 | public function setRouteParams($params) { |
| 577 | 577 | $this->routeParams = $params; |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | * This is used by the request handler to prevent infinite parsing loops. |
| 615 | 615 | * |
| 616 | 616 | * @param $pattern |
| 617 | - * @return bool |
|
| 617 | + * @return boolean|null |
|
| 618 | 618 | */ |
| 619 | 619 | public function isEmptyPattern($pattern) { |
| 620 | 620 | if(preg_match('/^([A-Za-z]+) +(.*)$/', $pattern, $matches)) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * No newlines are allowed in the description. |
| 121 | 121 | * If omitted, will default to the standard HTTP description |
| 122 | 122 | * for the given $code value (see {@link $status_codes}). |
| 123 | - * @return SS_HTTPRequest $this |
|
| 123 | + * @return HTTPResponse $this |
|
| 124 | 124 | */ |
| 125 | 125 | public function setStatusCode($code, $description = null) { |
| 126 | 126 | if(isset(self::$status_codes[$code])) $this->statusCode = $code; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * Caution: Will be overwritten by {@link setStatusCode()}. |
| 137 | 137 | * |
| 138 | 138 | * @param string $description |
| 139 | - * @return SS_HTTPRequest $this |
|
| 139 | + * @return HTTPResponse $this |
|
| 140 | 140 | */ |
| 141 | 141 | public function setStatusDescription($description) { |
| 142 | 142 | $this->statusDescription = $description; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * @param string $body |
| 171 | - * @return SS_HTTPRequest $this |
|
| 171 | + * @return HTTPResponse $this |
|
| 172 | 172 | */ |
| 173 | 173 | public function setBody($body) { |
| 174 | 174 | $this->body = $body ? (string) $body : $body; // Don't type-cast false-ish values, eg null is null not '' |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | - * @return null|string |
|
| 179 | + * @return string |
|
| 180 | 180 | */ |
| 181 | 181 | public function getBody() { |
| 182 | 182 | return $this->body; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * |
| 188 | 188 | * @param string $header Example: "Content-Type" |
| 189 | 189 | * @param string $value Example: "text/xml" |
| 190 | - * @return SS_HTTPRequest $this |
|
| 190 | + * @return HTTPResponse $this |
|
| 191 | 191 | */ |
| 192 | 192 | public function addHeader($header, $value) { |
| 193 | 193 | $this->headers[$header] = $value; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * e.g. "Content-Type". |
| 218 | 218 | * |
| 219 | 219 | * @param string $header |
| 220 | - * @return SS_HTTPRequest $this |
|
| 220 | + * @return HTTPResponse $this |
|
| 221 | 221 | */ |
| 222 | 222 | public function removeHeader($header) { |
| 223 | 223 | if(isset($this->headers[$header])) unset($this->headers[$header]); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | /** |
| 228 | 228 | * @param string $dest |
| 229 | 229 | * @param int $code |
| 230 | - * @return SS_HTTPRequest $this |
|
| 230 | + * @return HTTPResponse $this |
|
| 231 | 231 | */ |
| 232 | 232 | public function redirect($dest, $code=302) { |
| 233 | 233 | if(!in_array($code, self::$redirect_codes)) $code = 302; |
@@ -327,6 +327,7 @@ discard block |
||
| 327 | 327 | * @param string|SS_HTTPResponse body Either the plaintext content of the error message, or an SS_HTTPResponse |
| 328 | 328 | * object representing it. In either case, the $statusCode and |
| 329 | 329 | * $statusDescription will be the HTTP status of the resulting response. |
| 330 | + * @param string $statusDescription |
|
| 330 | 331 | * @see SS_HTTPResponse::__construct(); |
| 331 | 332 | */ |
| 332 | 333 | public function __construct($body = null, $statusCode = null, $statusDescription = null) { |
@@ -349,14 +350,14 @@ discard block |
||
| 349 | 350 | } |
| 350 | 351 | |
| 351 | 352 | /** |
| 352 | - * @return SS_HTTPResponse |
|
| 353 | + * @return HTTPResponse |
|
| 353 | 354 | */ |
| 354 | 355 | public function getResponse() { |
| 355 | 356 | return $this->response; |
| 356 | 357 | } |
| 357 | 358 | |
| 358 | 359 | /** |
| 359 | - * @param SS_HTTPResponse $response |
|
| 360 | + * @param HTTPResponse $response |
|
| 360 | 361 | */ |
| 361 | 362 | public function setResponse(HTTPResponse $response) { |
| 362 | 363 | $this->response = $response; |
@@ -49,7 +49,6 @@ discard block |
||
| 49 | 49 | protected $fragmentOverride = null; |
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | - * @param RequestHandler $controller |
|
| 53 | 52 | * @param SS_HTTPResponse An existing response to reuse (optional) |
| 54 | 53 | * @param Array $callbacks |
| 55 | 54 | */ |
@@ -71,12 +70,11 @@ discard block |
||
| 71 | 70 | * Out of the box, the handler "CurrentForm" value, which will return the rendered form. |
| 72 | 71 | * Non-Ajax calls will redirect back. |
| 73 | 72 | * |
| 74 | - * @param SS_HTTPRequest $request |
|
| 73 | + * @param HTTPRequest $request |
|
| 75 | 74 | * @param array $extraCallbacks List of anonymous functions or callables returning either a string |
| 76 | 75 | * or SS_HTTPResponse, keyed by their fragment identifier. The 'default' key can |
| 77 | 76 | * be used as a fallback for non-ajax responses. |
| 78 | - * @param array $fragmentOverride Change the response fragments. |
|
| 79 | - * @return SS_HTTPResponse |
|
| 77 | + * @return string |
|
| 80 | 78 | */ |
| 81 | 79 | public function respond(HTTPRequest $request, $extraCallbacks = array()) { |
| 82 | 80 | // Prepare the default options and combine with the others |
@@ -123,7 +121,7 @@ discard block |
||
| 123 | 121 | /** |
| 124 | 122 | * Set up fragment overriding - will completely replace the incoming fragments. |
| 125 | 123 | * |
| 126 | - * @param array $fragments Fragments to insert. |
|
| 124 | + * @param string[] $fragments Fragments to insert. |
|
| 127 | 125 | */ |
| 128 | 126 | public function setFragmentOverride($fragments) { |
| 129 | 127 | if (!is_array($fragments)) throw new InvalidArgumentException(); |
@@ -142,6 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * Set the DataModel for this request. |
| 145 | + * @param DataModel $model |
|
| 145 | 146 | */ |
| 146 | 147 | public function setDataModel($model) { |
| 147 | 148 | $this->model = $model; |
@@ -259,6 +260,9 @@ discard block |
||
| 259 | 260 | return $this; |
| 260 | 261 | } |
| 261 | 262 | |
| 263 | + /** |
|
| 264 | + * @param HTTPRequest $request |
|
| 265 | + */ |
|
| 262 | 266 | protected function findAction($request) { |
| 263 | 267 | $handlerClass = ($this->class) ? $this->class : get_class($this); |
| 264 | 268 | |
@@ -405,6 +409,7 @@ discard block |
||
| 405 | 409 | |
| 406 | 410 | /** |
| 407 | 411 | * Return the class that defines the given action, so that we know where to check allowed_actions. |
| 412 | + * @return string|null |
|
| 408 | 413 | */ |
| 409 | 414 | protected function definingClassForAction($actionOrigCasing) { |
| 410 | 415 | $action = strtolower($actionOrigCasing); |
@@ -514,6 +519,7 @@ discard block |
||
| 514 | 519 | * or {@link handleRequest()}, but in some based we want to set it manually. |
| 515 | 520 | * |
| 516 | 521 | * @param SS_HTTPRequest |
| 522 | + * @param HTTPRequest $request |
|
| 517 | 523 | */ |
| 518 | 524 | public function setRequest($request) { |
| 519 | 525 | $this->request = $request; |
@@ -280,7 +280,6 @@ discard block |
||
| 280 | 280 | * |
| 281 | 281 | * @deprecated 4.0 Use the "Session.timeout_ips" config setting instead |
| 282 | 282 | * |
| 283 | - * @param array $session_ips Array of IPv4 rules. |
|
| 284 | 283 | */ |
| 285 | 284 | public static function set_timeout_ips($ips) { |
| 286 | 285 | Deprecation::notice('4.0', 'Use the "Session.timeout_ips" config setting instead'); |
@@ -417,6 +416,9 @@ discard block |
||
| 417 | 416 | } |
| 418 | 417 | } |
| 419 | 418 | |
| 419 | + /** |
|
| 420 | + * @param string $name |
|
| 421 | + */ |
|
| 420 | 422 | public function inst_set($name, $val) { |
| 421 | 423 | // Quicker execution path for "."-free names |
| 422 | 424 | if(strpos($name, '.') === false) { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * Returns the {@link Session} object for this test |
| 70 | 70 | * |
| 71 | - * @return Session |
|
| 71 | + * @return Session|null |
|
| 72 | 72 | */ |
| 73 | 73 | public function session() { |
| 74 | 74 | return $this->mainSession->session(); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @param Session $session |
| 145 | 145 | * @param array $headers |
| 146 | 146 | * @param array $cookies |
| 147 | - * @return SS_HTTPResponse |
|
| 147 | + * @return SilverStripe\Control\SS_HTTPResponse|null |
|
| 148 | 148 | */ |
| 149 | 149 | public function get($url, $session = null, $headers = null, $cookies = null) { |
| 150 | 150 | $this->cssParser = null; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @param Session $session |
| 166 | 166 | * @param string $body |
| 167 | 167 | * @param array $cookies |
| 168 | - * @return SS_HTTPResponse |
|
| 168 | + * @return SilverStripe\Control\SS_HTTPResponse|null |
|
| 169 | 169 | */ |
| 170 | 170 | public function post($url, $data, $headers = null, $session = null, $body = null, $cookies = null) { |
| 171 | 171 | $this->cssParser = null; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param string $formID HTML 'id' attribute of a form (loaded through a previous response) |
| 194 | 194 | * @param string $button HTML 'name' attribute of the button (NOT the 'id' attribute) |
| 195 | 195 | * @param array $data Map of GET/POST data. |
| 196 | - * @return SS_HTTPResponse |
|
| 196 | + * @return SilverStripe\Control\SS_HTTPResponse|null |
|
| 197 | 197 | */ |
| 198 | 198 | public function submitForm($formID, $button = null, $data = array()) { |
| 199 | 199 | $this->cssParser = null; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * Find an attribute in a SimpleXMLElement object by name. |
| 218 | 218 | * @param SimpleXMLElement $object |
| 219 | 219 | * @param string $attribute Name of attribute to find |
| 220 | - * @return SimpleXMLElement object of the attribute |
|
| 220 | + * @return boolean object of the attribute |
|
| 221 | 221 | */ |
| 222 | 222 | public function findAttribute($object, $attribute) { |
| 223 | 223 | $found = false; |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * Note: characters are stripped from the content; make sure that your assertions take this into account. |
| 248 | 248 | * |
| 249 | 249 | * @param string $selector A basic CSS selector, e.g. 'li.jobs h3' |
| 250 | - * @param array|string $expectedMatches The content of at least one of the matched tags |
|
| 250 | + * @param string[] $expectedMatches The content of at least one of the matched tags |
|
| 251 | 251 | * @throws PHPUnit_Framework_AssertionFailedError |
| 252 | 252 | * @return boolean |
| 253 | 253 | */ |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * @param string $selector A basic CSS selector, e.g. 'li.jobs h3' |
| 345 | 345 | * @param array|string $expectedMatches The content of *all* matched tags as an array |
| 346 | 346 | * @throws PHPUnit_Framework_AssertionFailedError |
| 347 | - * @return boolean |
|
| 347 | + * @return boolean|null |
|
| 348 | 348 | */ |
| 349 | 349 | public function assertExactHTMLMatchBySelector($selector, $expectedMatches) { |
| 350 | 350 | $items = $this->cssParser()->getBySelector($selector); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @param string $formID HTML 'id' attribute of a form (loaded through a previous response) |
| 133 | 133 | * @param string $button HTML 'name' attribute of the button (NOT the 'id' attribute) |
| 134 | 134 | * @param array $data Map of GET/POST data. |
| 135 | - * @return SS_HTTPResponse |
|
| 135 | + * @return SilverStripe\Control\SS_HTTPResponse|null |
|
| 136 | 136 | */ |
| 137 | 137 | public function submitForm($formID, $button = null, $data = array()) { |
| 138 | 138 | $page = $this->lastPage(); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | /** |
| 169 | 169 | * If the last request was a 3xx response, then follow the redirection |
| 170 | 170 | * |
| 171 | - * @return SS_HTTPResponse The response given, or null if no redirect occurred |
|
| 171 | + * @return SilverStripe\Control\SS_HTTPResponse|null The response given, or null if no redirect occurred |
|
| 172 | 172 | */ |
| 173 | 173 | public function followRedirection() { |
| 174 | 174 | if($this->lastResponse->getHeader('Location')) { |
@@ -812,7 +812,7 @@ discard block |
||
| 812 | 812 | * Generate an {@see SS_HTTPResponse} for the given file from the source filesystem |
| 813 | 813 | * @param FilesystemInterface $flysystem |
| 814 | 814 | * @param string $fileID |
| 815 | - * @return SS_HTTPResponse |
|
| 815 | + * @return HTTPResponse |
|
| 816 | 816 | */ |
| 817 | 817 | protected function createResponseFor(FilesystemInterface $flysystem, $fileID) { |
| 818 | 818 | // Build response body |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | /** |
| 834 | 834 | * Generate a response for requests to a denied protected file |
| 835 | 835 | * |
| 836 | - * @return SS_HTTPResponse |
|
| 836 | + * @return HTTPResponse |
|
| 837 | 837 | */ |
| 838 | 838 | protected function createDeniedResponse() { |
| 839 | 839 | $code = (int)Config::inst()->get(get_class($this), 'denied_response_code'); |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | /** |
| 844 | 844 | * Generate a response for missing file requests |
| 845 | 845 | * |
| 846 | - * @return SS_HTTPResponse |
|
| 846 | + * @return HTTPResponse |
|
| 847 | 847 | */ |
| 848 | 848 | protected function createMissingResponse() { |
| 849 | 849 | $code = (int)Config::inst()->get(get_class($this), 'missing_response_code'); |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | * Create a response with the given error code |
| 855 | 855 | * |
| 856 | 856 | * @param int $code |
| 857 | - * @return SS_HTTPResponse |
|
| 857 | + * @return HTTPResponse |
|
| 858 | 858 | */ |
| 859 | 859 | protected function createErrorResponse($code) { |
| 860 | 860 | $response = new HTTPResponse('', $code); |