Skip to content

Commit a0554f3

Browse files
authored
Merge pull request #6959 from kenjis/fix-phpdoc-types
docs: fix phpdoc types
2 parents 60ebe6c + e90b414 commit a0554f3

12 files changed

Lines changed: 36 additions & 25 deletions

File tree

system/API/ResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ trait ResponseTrait
6666
/**
6767
* How to format the response data.
6868
* Either 'json' or 'xml'. If blank will be
69-
* determine through content negotiation.
69+
* determined through content negotiation.
7070
*
7171
* @var string
7272
*/

system/Common.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function app_timezone(): string
6363
* $foo = cache('bar');
6464
*
6565
* @return CacheInterface|mixed
66+
* @phpstan-return ($key is null ? CacheInterface : mixed)
6667
*/
6768
function cache(?string $key = null)
6869
{
@@ -196,7 +197,7 @@ function command(string $command)
196197
/**
197198
* More simple way of getting config instances from Factories
198199
*
199-
* @return mixed
200+
* @return object|null
200201
*/
201202
function config(string $name, bool $getShared = true)
202203
{
@@ -376,7 +377,7 @@ function dd(...$vars)
376377
*
377378
* @param string|null $default
378379
*
379-
* @return mixed
380+
* @return bool|string|null
380381
*/
381382
function env(string $key, $default = null)
382383
{
@@ -952,7 +953,7 @@ function session(?string $val = null)
952953
*
953954
* @param mixed ...$params
954955
*
955-
* @return mixed
956+
* @return object
956957
*/
957958
function service(string $name, ...$params)
958959
{
@@ -966,7 +967,7 @@ function service(string $name, ...$params)
966967
*
967968
* @param mixed ...$params
968969
*
969-
* @return mixed
970+
* @return object|null
970971
*/
971972
function single_service(string $name, ...$params)
972973
{
@@ -1076,7 +1077,7 @@ function stringify_attributes($attributes, bool $js = false): string
10761077
* If no parameter is passed, it will return the timer instance,
10771078
* otherwise will start or stop the timer intelligently.
10781079
*
1079-
* @return mixed|Timer
1080+
* @return Timer
10801081
*/
10811082
function timer(?string $name = null)
10821083
{

system/Config/Factories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* large performance boost and helps keep code clean of lengthy
2424
* instantiation checks.
2525
*
26-
* @method static BaseConfig config(...$arguments)
26+
* @method static BaseConfig|null config(...$arguments)
2727
*/
2828
class Factories
2929
{

system/Database/Database.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Database
3535
* Parses the connection binds and returns an instance of the driver
3636
* ready to go.
3737
*
38-
* @return mixed
38+
* @return BaseConnection
3939
*
4040
* @throws InvalidArgumentException
4141
*/

system/Debug/Timer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ class Timer
3434
* Multiple calls can be made to this method so that several
3535
* execution points can be measured.
3636
*
37-
* @param string $name The name of this timer.
38-
* @param float $time Allows user to provide time.
37+
* @param string $name The name of this timer.
38+
* @param float|null $time Allows user to provide time.
3939
*
4040
* @return Timer
4141
*/

system/Email/Email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ class Email
392392
protected static $func_overload;
393393

394394
/**
395-
* @param array|null $config
395+
* @param array|\Config\Email|null $config
396396
*/
397397
public function __construct($config = null)
398398
{
@@ -405,7 +405,7 @@ public function __construct($config = null)
405405
/**
406406
* Initialize preferences
407407
*
408-
* @param array|\Config\Email $config
408+
* @param array|\Config\Email|null $config
409409
*
410410
* @return Email
411411
*/

system/HTTP/IncomingRequest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Config\Services;
1919
use InvalidArgumentException;
2020
use Locale;
21+
use stdClass;
2122

2223
/**
2324
* Class IncomingRequest
@@ -478,7 +479,7 @@ public function getDefaultLocale(): string
478479
* @param int|null $filter Filter constant
479480
* @param mixed $flags
480481
*
481-
* @return mixed
482+
* @return array|bool|float|int|stdClass|string|null
482483
*/
483484
public function getVar($index = null, $filter = null, $flags = null)
484485
{
@@ -516,7 +517,7 @@ public function getVar($index = null, $filter = null, $flags = null)
516517
*
517518
* @see http://php.net/manual/en/function.json-decode.php
518519
*
519-
* @return mixed
520+
* @return array|bool|float|int|stdClass|null
520521
*/
521522
public function getJSON(bool $assoc = false, int $depth = 512, int $options = 0)
522523
{
@@ -531,7 +532,7 @@ public function getJSON(bool $assoc = false, int $depth = 512, int $options = 0)
531532
* @param int|null $filter Filter Constant
532533
* @param array|int|null $flags Option
533534
*
534-
* @return mixed
535+
* @return array|bool|float|int|stdClass|string|null
535536
*/
536537
public function getJsonVar(string $index, bool $assoc = false, ?int $filter = null, $flags = null)
537538
{
@@ -565,7 +566,7 @@ public function getJsonVar(string $index, bool $assoc = false, ?int $filter = nu
565566
* A convenience method that grabs the raw input stream(send method in PUT, PATCH, DELETE) and decodes
566567
* the String into an array.
567568
*
568-
* @return mixed
569+
* @return array
569570
*/
570571
public function getRawInput()
571572
{

system/HTTP/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function getMethod(bool $upper = false): string
9898
/**
9999
* Sets the request method. Used when spoofing the request.
100100
*
101-
* @return Request
101+
* @return $this
102102
*
103103
* @deprecated Use withMethod() instead for immutability
104104
*

system/HTTP/URI.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,11 @@ class URI
138138
/**
139139
* Builds a representation of the string from the component parts.
140140
*
141-
* @param string $scheme
142-
* @param string $authority
143-
* @param string $path
144-
* @param string $query
145-
* @param string $fragment
141+
* @param string|null $scheme URI scheme. E.g., http, ftp
142+
* @param string $authority
143+
* @param string $path
144+
* @param string $query
145+
* @param string $fragment
146146
*/
147147
public static function createURIString(?string $scheme = null, ?string $authority = null, ?string $path = null, ?string $query = null, ?string $fragment = null): string
148148
{

system/Helpers/url_helper.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function _get_uri(string $relativePath = '', ?App $config = null): URI
7575
* Returns a site URL as defined by the App config.
7676
*
7777
* @param array|string $relativePath URI string or array of URI segments
78+
* @param string|null $scheme URI scheme. E.g., http, ftp
7879
* @param App|null $config Alternate configuration to use
7980
*/
8081
function site_url($relativePath = '', ?string $scheme = null, ?App $config = null): string
@@ -96,6 +97,7 @@ function site_url($relativePath = '', ?string $scheme = null, ?App $config = nul
9697
* Base URLs are trimmed site URLs without the index page.
9798
*
9899
* @param array|string $relativePath URI string or array of URI segments
100+
* @param string|null $scheme URI scheme. E.g., http, ftp
99101
*/
100102
function base_url($relativePath = '', ?string $scheme = null): string
101103
{

0 commit comments

Comments
 (0)