Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.7.0 stubs #100

Merged
merged 1 commit into from
May 20, 2024
Merged
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
21 changes: 11 additions & 10 deletions src/Cli/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Phalcon\Cli\Router\Route;
use Phalcon\Cli\Router\Exception;
use Phalcon\Cli\Router\RouteInterface;
use Phalcon\Cli\RouterInterface;

/**
* Phalcon\Cli\Router is the standard framework router. Routing is the process
Expand All @@ -35,7 +36,7 @@
* echo $router->getTaskName();
* ```
*/
class Router extends AbstractInjectionAware
class Router extends AbstractInjectionAware implements \Phalcon\Cli\RouterInterface
{
/**
* @var string
Expand Down Expand Up @@ -113,8 +114,8 @@ public function __construct(bool $defaultRoutes = true)
* $router->add("/about", "About::main");
* ```
*
* @param string|array $paths
* @param string $pattern
* @param string $pattern
* @param mixed|null $paths
* @return RouteInterface
*/
public function add(string $pattern, $paths = null): RouteInterface
Expand Down Expand Up @@ -179,7 +180,7 @@ public function getParameters(): array
/**
* Returns a route object by its id
*
* @param int $id
* @param mixed $id
* @return bool|RouteInterface
*/
public function getRouteById($id): RouteInterface|bool
Expand Down Expand Up @@ -227,19 +228,19 @@ public function handle($arguments = null)
* Sets the default action name
*
* @param string $actionName
* @return Router
* @return RouterInterface
*/
public function setDefaultAction(string $actionName): Router
public function setDefaultAction(string $actionName): RouterInterface
{
}

/**
* Sets the name of the default module
*
* @param string $moduleName
* @return Router
* @return RouterInterface
*/
public function setDefaultModule(string $moduleName): Router
public function setDefaultModule(string $moduleName): RouterInterface
{
}

Expand All @@ -258,9 +259,9 @@ public function setDefaultModule(string $moduleName): Router
* ```
*
* @param array $defaults
* @return Router
* @return RouterInterface
*/
public function setDefaults(array $defaults): Router
public function setDefaults(array $defaults): RouterInterface
{
}

Expand Down
20 changes: 10 additions & 10 deletions src/Cli/RouterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ public function getParameters(): array;
* Returns a route object by its id
*
* @param mixed $id
* @return RouteInterface
* @return bool|RouteInterface
*/
public function getRouteById($id): RouteInterface;
public function getRouteById($id): RouteInterface|bool;

/**
* Returns a route object by its name
*
* @param string $name
* @return RouteInterface
* @return bool|RouteInterface
*/
public function getRouteByName(string $name): RouteInterface;
public function getRouteByName(string $name): RouteInterface|bool;

/**
* Return all the routes defined in the router
Expand All @@ -109,25 +109,25 @@ public function handle($arguments = null);
* Sets the default action name
*
* @param string $actionName
* @return void
* @return RouterInterface
*/
public function setDefaultAction(string $actionName): void;
public function setDefaultAction(string $actionName): RouterInterface;

/**
* Sets the name of the default module
*
* @param string $moduleName
* @return void
* @return RouterInterface
*/
public function setDefaultModule(string $moduleName): void;
public function setDefaultModule(string $moduleName): RouterInterface;

/**
* Sets an array of default paths
*
* @param array $defaults
* @return void
* @return RouterInterface
*/
public function setDefaults(array $defaults): void;
public function setDefaults(array $defaults): RouterInterface;

/**
* Sets the default task name
Expand Down
4 changes: 2 additions & 2 deletions src/Db/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Column implements \Phalcon\Db\ColumnInterface
/**
* Binary abstract data type
*/
const TYPE_BINARY = 26;
const TYPE_BINARY = 27;

/**
* Blob abstract data type
Expand Down Expand Up @@ -208,7 +208,7 @@ class Column implements \Phalcon\Db\ColumnInterface
/**
* Varbinary abstract data type
*/
const TYPE_VARBINARY = 27;
const TYPE_VARBINARY = 28;

/**
* Varchar abstract data type
Expand Down
44 changes: 22 additions & 22 deletions src/Filter/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@
/**
* Lazy loads, stores and exposes sanitizer objects
*
* @method absint(mixed $input): int
* @method alnum(mixed $input): string
* @method alpha(mixed $input): string
* @method bool(mixed $input): bool
* @method email(string $input): string
* @method float(mixed $input): float
* @method int(string $input): int
* @method lower(string $input): string
* @method lowerfirst(string $input): string
* @method regex(mixed $input, mixed $pattern, mixed $replace): mixed
* @method remove(mixed $input, mixed $replace): mixed
* @method replace(mixed $input, mixed $source, mixed $target): mixed
* @method special(string $input): string
* @method specialfull(string $input): string
* @method string(string $input): string
* @method stringlegacy(mixed $input): string
* @method striptags(string $input): string
* @method trim(string $input): string
* @method upper(string $input): string
* @method upperFirst(string $input): string
* @method upperWords(string $input): string|null
* @method url(string $input): string|null
* @method int absint(mixed $input)
* @method string alnum(mixed $input)
* @method string alpha(mixed $input)
* @method bool bool(mixed $input)
* @method string email(string $input)
* @method float float(mixed $input)
* @method int int(string $input)
* @method string lower(string $input)
* @method string lowerfirst(string $input)
* @method mixed regex(mixed $input, mixed $pattern, mixed $replace)
* @method mixed remove(mixed $input, mixed $replace)
* @method mixed replace(mixed $input, mixed $source, mixed $target)
* @method string special(string $input)
* @method string specialfull(string $input)
* @method string string(string $input)
* @method string stringlegacy(mixed $input)
* @method string striptags(string $input)
* @method string trim(string $input)
* @method string upper(string $input)
* @method string upperFirst(string $input)
* @method string|null upperWords(string $input)
* @method string|null url(string $input)
*
* @property array $mapper
* @property array $services
Expand Down
8 changes: 5 additions & 3 deletions src/Mvc/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
* echo "Great, a new robot was saved successfully!";
* }
* ```
*
* @template T of static
*/
abstract class Model extends AbstractInjectionAware implements \Phalcon\Mvc\EntityInterface, \Phalcon\Mvc\ModelInterface, \Phalcon\Mvc\Model\ResultInterface, \Serializable, \JsonSerializable
{
Expand Down Expand Up @@ -760,9 +762,9 @@ public function dump(): array
* ],
* 'hydration' => null
* ]
* @return ResultsetInterface
* @return T[]|\Phalcon\Mvc\Model\Resultset<int, T>
*/
public static function find($parameters = null): ResultsetInterface
public static function find($parameters = null)
{
}

Expand Down Expand Up @@ -850,7 +852,7 @@ public static function find($parameters = null): ResultsetInterface
* 'hydration' => null
* ]
*
* @return \Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
* @return T|\Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
*/
public static function findFirst($parameters = null): mixed
{
Expand Down
6 changes: 5 additions & 1 deletion src/Mvc/Model/Resultset.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
* $robots->next();
* }
* ```
*
* @template TKey
* @template TValue
* @implements Iterator<TKey, TValue>
*/
abstract class Resultset implements \Phalcon\Mvc\Model\ResultsetInterface, \Iterator, \SeekableIterator, \Countable, \ArrayAccess, \Serializable, \JsonSerializable
{
Expand Down Expand Up @@ -279,7 +283,7 @@ public function jsonSerialize(): array
/**
* Gets pointer number of active row in the resultset
*
* @return int|null
* @return TKey|null
*/
public function key(): int|null
{
Expand Down
5 changes: 4 additions & 1 deletion src/Mvc/Model/Resultset/Complex.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
*
* Complex resultsets may include complete objects and scalar values.
* This class builds every complex row as it is required
*
* @template TKey of int
* @template TValue of mixed
*/
class Complex extends Resultset implements \Phalcon\Mvc\Model\ResultsetInterface
class Complex extends Resultset
{
/**
* @var array
Expand Down
5 changes: 4 additions & 1 deletion src/Mvc/Model/Resultset/Simple.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
*
* Simple resultsets only contains a complete objects
* This class builds every complete object as it is required
*
* @template TKey of int
* @template TValue of \Phalcon\Mvc\ModelInterface
*/
class Simple extends Resultset
{
Expand Down Expand Up @@ -57,7 +60,7 @@ public function __construct($columnMap, $model, $result, $cache = null, bool $ke
/**
* Returns current row in the resultset
*
* @return ModelInterface|null
* @return TValue
*/
final public function current(): ModelInterface|null
{
Expand Down
9 changes: 6 additions & 3 deletions src/Mvc/ModelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@
use Phalcon\Messages\MessageInterface;
use Phalcon\Mvc\Model\CriteriaInterface;
use Phalcon\Mvc\Model\MetaDataInterface;
use Phalcon\Mvc\Model\Resultset;
use Phalcon\Mvc\Model\ResultsetInterface;
use Phalcon\Mvc\Model\TransactionInterface;

/**
* Phalcon\Mvc\ModelInterface
*
* Interface for Phalcon\Mvc\Model
*
* @template T
*/
interface ModelInterface
{
Expand Down Expand Up @@ -115,15 +118,15 @@ public function delete(): bool;
* Allows to query a set of records that match the specified conditions
*
* @param array|string|int|null $parameters *
* @return ResultsetInterface
* @return T[]|\Phalcon\Mvc\Model\Resultset<int, T>
*/
public static function find($parameters = null): ResultsetInterface;
public static function find($parameters = null);

/**
* Allows to query the first record that match the specified conditions
*
* @param array $parameters
* @return \Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
* @return T|\Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
*
* TODO: Current method signature must be reviewed in v5. As it must return only ?ModelInterface (it also returns Row).
* @see https://github.com/phalcon/cphalcon/issues/15212
Expand Down
3 changes: 2 additions & 1 deletion src/Mvc/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,8 @@ public function getParams(): array
/**
* Returns a route object by its id
*
* @param mixed $id *
* @param mixed $id
*
* @return RouteInterface|bool
*/
public function getRouteById($id): RouteInterface|bool
Expand Down
3 changes: 1 addition & 2 deletions src/Support/Helper/Str/Uncamelize.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ class Uncamelize
{
/**
* @param string $text
* @param string $delimiters
* @param string $delimiter
*
* @return string
* @param string $delimiter
*/
public function __invoke(string $text, string $delimiter = '_'): string
{
Expand Down
7 changes: 3 additions & 4 deletions src/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public static function javascriptInclude($parameters = null, bool $local = true)
/**
* Builds a HTML A tag using framework conventions
*
* @param parameters $array |string = [
* @param array|string $parameters = [
* 'action' => '',
* 'text' => '',
* 'local' => false,
Expand All @@ -433,9 +433,8 @@ public static function javascriptInclude($parameters = null, bool $local = true)
* 'href' => '',
* 'id' => ''
* ]
* @param mixed $parameters
* @param mixed $text
* @param mixed $local
* @param string $text
* @param bool $local
* @return string
*/
public static function linkTo($parameters, $text = null, $local = true): string
Expand Down
3 changes: 1 addition & 2 deletions src/Translate/Adapter/Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,10 @@ public function query(string $translateKey, array $placeholders = []): string
*
* @param string $file
* @param int $length
* @param string $separator
* @param string $delimiter
* @param string $enclosure
*
* @throws Exception
* @param string $delimiter
* @return void
*/
private function load(string $file, int $length, string $delimiter, string $enclosure): void
Expand Down
Loading
Loading