Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions system/Database/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ interface ResultInterface
* individual data rows, which can be either an 'array', an
* 'object', or a custom class name.
*
* @param string $type The row type. Either 'array', 'object', or a class name to use
* @template T of object
*
* @param 'array'|'object'|class-string<T> $type The row type. Either 'array', 'object', or a class name to use
*
* @return ($type is 'array' ? list<array<string, mixed>> : ($type is 'object' ? list<stdClass> : list<object>))
* @return ($type is 'array' ? list<array<string, mixed>> : ($type is 'object' ? list<stdClass> : list<T>))
*/
public function getResult(string $type = 'object'): array;

/**
* Returns the results as an array of custom objects.
*
* @param string $className The name of the class to use.
* @template T of object
*
* @param class-string<T> $className The name of the class to use.
*
* @return list<object>
* @return list<T>
*/
public function getCustomResultObject(string $className);

Expand Down Expand Up @@ -102,7 +106,7 @@ public function getRowArray(int $n = 0);
*
* If row doesn't exist, returns null.
*
* @return object|stdClass|null
* @return stdClass|null
*/
public function getRowObject(int $n = 0);

Expand Down
12 changes: 6 additions & 6 deletions system/HTTP/CLIRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function isCLI(): bool
* @param int|null $filter A filter name to apply.
* @param array<string, mixed>|int|null $flags
*
* @return array{}|null
* @return ($index is string ? null : array{})
*/
public function getGet($index = null, $filter = null, $flags = null)
{
Expand All @@ -250,7 +250,7 @@ public function getGet($index = null, $filter = null, $flags = null)
* @param int|null $filter A filter name to apply
* @param array<string, mixed>|int|null $flags
*
* @return array{}|null
* @return ($index is string ? null : array{})
*/
public function getPost($index = null, $filter = null, $flags = null)
{
Expand All @@ -264,7 +264,7 @@ public function getPost($index = null, $filter = null, $flags = null)
* @param int|null $filter A filter name to apply
* @param array<string, mixed>|int|null $flags
*
* @return array{}|null
* @return ($index is string ? null : array{})
*/
public function getPostGet($index = null, $filter = null, $flags = null)
{
Expand All @@ -278,7 +278,7 @@ public function getPostGet($index = null, $filter = null, $flags = null)
* @param int|null $filter A filter name to apply
* @param array<string, mixed>|int|null $flags
*
* @return array{}|null
* @return ($index is string ? null : array{})
*/
public function getGetPost($index = null, $filter = null, $flags = null)
{
Expand All @@ -292,7 +292,7 @@ public function getGetPost($index = null, $filter = null, $flags = null)
* @param int|null $filter A filter name to be applied
* @param mixed $flags
*
* @return array{}|null
* @return ($index is string ? null : array{})
*/
public function getCookie($index = null, $filter = null, $flags = null)
{
Expand All @@ -302,7 +302,7 @@ public function getCookie($index = null, $filter = null, $flags = null)
/**
* @param list<string>|string|null $index
*
* @return array{}|null
* @return ($index is string ? null : array{})
*/
private function returnNullOrEmptyArray($index)
{
Expand Down
4 changes: 2 additions & 2 deletions system/HTTP/IncomingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public function getVar($index = null, $filter = null, $flags = null)
*
* @see http://php.net/manual/en/function.json-decode.php
*
* @return array<array-key, mixed>|bool|float|int|stdClass|null
* @return ($assoc is true ? array<array-key, mixed>|bool|float|int|string|null : array<array-key, mixed>|bool|float|int|stdClass|string|null)
*
* @throws HTTPException When the body is invalid as JSON.
*/
Expand All @@ -430,7 +430,7 @@ public function getJSON(bool $assoc = false, int $depth = 512, int $options = 0)
* @param int|null $filter Filter Constant
* @param array<string, mixed>|int|null $flags Option
*
* @return array<array-key, mixed>|bool|float|int|stdClass|string|null
* @return ($assoc is true ? array<array-key, mixed>|bool|float|int|string|null : array<array-key, mixed>|bool|float|int|stdClass|string|null)
*/
public function getJsonVar($index = null, bool $assoc = false, ?int $filter = null, $flags = null)
{
Expand Down
6 changes: 4 additions & 2 deletions system/Helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ function base_url($relativePath = '', ?string $scheme = null): string
* @param bool $returnObject True to return an object instead of a string
* @param IncomingRequest|null $request A request to use when retrieving the path
*
* @return string|URI When returning string, the query and fragment parts are removed.
* When returning URI, the query and fragment parts are preserved.
* @return ($returnObject is true ? URI : string) When returning string, the query and fragment parts are removed.
* When returning URI, the query and fragment parts are preserved.
*/
function current_url(bool $returnObject = false, ?IncomingRequest $request = null): string|URI
{
Expand All @@ -87,6 +87,8 @@ function current_url(bool $returnObject = false, ?IncomingRequest $request = nul
* we first check in a saved session variable, if it exists, and use that.
* If that's not available, however, we'll use a sanitized url from $_SERVER['HTTP_REFERER']
* which can be set by the user so is untrusted and not set by certain browsers/servers.
*
* @return ($returnObject is true ? URI : string)
*/
function previous_url(bool $returnObject = false): string|URI
{
Expand Down
Loading