From 62065fd2c5ad09633d17ab8d97b6b11fa94d5771 Mon Sep 17 00:00:00 2001 From: Ruud Boon Date: Mon, 18 May 2020 20:47:47 +0200 Subject: [PATCH] Bumbed stubs to 4.0.6 --- src/Phalcon/Acl/Adapter/AbstractAdapter.php | 25 +++++----- src/Phalcon/Acl/Adapter/AdapterInterface.php | 12 ++--- src/Phalcon/Annotations/Adapter/Apcu.php | 2 +- src/Phalcon/Annotations/Adapter/Memory.php | 2 +- src/Phalcon/Annotations/Adapter/Stream.php | 2 +- src/Phalcon/Annotations/Annotation.php | 14 +++--- src/Phalcon/Annotations/Collection.php | 2 +- src/Phalcon/Annotations/Reflection.php | 2 +- src/Phalcon/Cli/Router.php | 4 +- src/Phalcon/Cli/Task.php | 2 +- src/Phalcon/Config.php | 2 +- src/Phalcon/Config/ConfigFactory.php | 9 ++-- src/Phalcon/Crypt.php | 2 +- src/Phalcon/Db/Adapter/AbstractAdapter.php | 5 +- src/Phalcon/Db/Adapter/AdapterInterface.php | 3 +- src/Phalcon/Db/Adapter/Pdo/AbstractPdo.php | 2 +- src/Phalcon/Db/Column.php | 12 ++--- src/Phalcon/Db/ColumnInterface.php | 8 ++-- src/Phalcon/Di.php | 18 ++++--- src/Phalcon/Di/DiInterface.php | 4 +- src/Phalcon/Dispatcher/AbstractDispatcher.php | 2 +- .../Dispatcher/DispatcherInterface.php | 2 +- src/Phalcon/Events/EventsAwareInterface.php | 2 +- src/Phalcon/Factory/AbstractFactory.php | 20 ++++---- src/Phalcon/Filter.php | 2 +- src/Phalcon/Flash/AbstractFlash.php | 18 +++---- src/Phalcon/Flash/Direct.php | 6 +-- src/Phalcon/Flash/Exception.php | 2 +- src/Phalcon/Flash/FlashInterface.php | 22 ++++----- src/Phalcon/Flash/Session.php | 7 +-- src/Phalcon/Forms/Form.php | 4 +- src/Phalcon/Http/Message/AbstractCommon.php | 4 +- src/Phalcon/Http/Message/AbstractMessage.php | 10 ++-- src/Phalcon/Http/Message/AbstractRequest.php | 7 ++- src/Phalcon/Http/Message/Response.php | 32 ++++++------- src/Phalcon/Http/Message/ServerRequest.php | 12 ++--- src/Phalcon/Http/Message/Uri.php | 12 ++--- src/Phalcon/Http/Request.php | 2 +- src/Phalcon/Http/RequestInterface.php | 2 +- src/Phalcon/Http/Response.php | 6 +-- src/Phalcon/Http/Response/Cookies.php | 4 +- src/Phalcon/Http/ResponseInterface.php | 2 +- src/Phalcon/Logger/Item.php | 7 ++- src/Phalcon/Mvc/Application.php | 2 +- src/Phalcon/Mvc/Micro.php | 4 +- src/Phalcon/Mvc/Model.php | 47 +++++++++++++------ src/Phalcon/Mvc/Model/Binder.php | 4 +- src/Phalcon/Mvc/Model/Criteria.php | 16 ++++--- src/Phalcon/Mvc/Model/CriteriaInterface.php | 16 ++++--- src/Phalcon/Mvc/Model/Manager.php | 47 ++++++++++++++----- src/Phalcon/Mvc/Model/ManagerInterface.php | 16 ++++--- src/Phalcon/Mvc/Model/MetaData.php | 10 ++-- src/Phalcon/Mvc/Model/MetaDataInterface.php | 8 ++-- src/Phalcon/Mvc/Model/Query.php | 2 +- src/Phalcon/Mvc/Model/ResultInterface.php | 2 +- src/Phalcon/Mvc/Model/Resultset.php | 34 +++++++++++--- src/Phalcon/Mvc/Model/Resultset/Complex.php | 2 +- src/Phalcon/Mvc/Model/Resultset/Simple.php | 2 +- src/Phalcon/Mvc/Model/ResultsetInterface.php | 6 +-- src/Phalcon/Mvc/Model/Row.php | 2 +- src/Phalcon/Mvc/Model/Transaction.php | 2 +- src/Phalcon/Mvc/Model/ValidationFailed.php | 2 +- src/Phalcon/Mvc/ModelInterface.php | 20 ++++---- src/Phalcon/Mvc/Router.php | 4 +- src/Phalcon/Mvc/Router/Route.php | 2 +- src/Phalcon/Mvc/RouterInterface.php | 4 +- src/Phalcon/Mvc/View.php | 4 +- src/Phalcon/Mvc/View/Engine/Volt.php | 2 +- src/Phalcon/Mvc/View/Simple.php | 2 +- src/Phalcon/Mvc/ViewInterface.php | 2 +- src/Phalcon/Security.php | 4 +- src/Phalcon/Tag.php | 2 +- src/Phalcon/Translate/InterpolatorFactory.php | 20 ++------ 73 files changed, 339 insertions(+), 270 deletions(-) diff --git a/src/Phalcon/Acl/Adapter/AbstractAdapter.php b/src/Phalcon/Acl/Adapter/AbstractAdapter.php index d7ea0d05..cf73bf0b 100644 --- a/src/Phalcon/Acl/Adapter/AbstractAdapter.php +++ b/src/Phalcon/Acl/Adapter/AbstractAdapter.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Acl\Adapter; +use Phalcon\Acl\Enum; use Phalcon\Events\ManagerInterface; /** @@ -19,7 +20,7 @@ abstract class AbstractAdapter implements \Phalcon\Acl\Adapter\AdapterInterface, /** * Active access which the list is checking if some role can access it * - * @var string + * @var string|null */ protected $activeAccess; @@ -34,28 +35,28 @@ abstract class AbstractAdapter implements \Phalcon\Acl\Adapter\AdapterInterface, * Role which the list is checking if it's allowed to certain * component/access * - * @var string + * @var string|null */ protected $activeRole; /** * Component which the list is checking if some role can access it * - * @var string + * @var string|null */ protected $activeComponent; /** * Default access * - * @var bool + * @var int */ - protected $defaultAccess = false; + protected $defaultAccess = Enum::DENY; /** * Events manager * - * @var mixed + * @var ManagerInterface|null */ protected $eventsManager; @@ -63,9 +64,9 @@ abstract class AbstractAdapter implements \Phalcon\Acl\Adapter\AdapterInterface, /** * Active access which the list is checking if some role can access it * - * @return string + * @return string|null */ - public function getActiveAccess(): string + public function getActiveAccess(): ?string { } @@ -74,18 +75,18 @@ public function getActiveAccess(): string * * component/access * - * @return string + * @return string|null */ - public function getActiveRole(): string + public function getActiveRole(): ?string { } /** * Component which the list is checking if some role can access it * - * @return string + * @return string|null */ - public function getActiveComponent(): string + public function getActiveComponent(): ?string { } diff --git a/src/Phalcon/Acl/Adapter/AdapterInterface.php b/src/Phalcon/Acl/Adapter/AdapterInterface.php index 4d7067e0..93231786 100644 --- a/src/Phalcon/Acl/Adapter/AdapterInterface.php +++ b/src/Phalcon/Acl/Adapter/AdapterInterface.php @@ -89,25 +89,25 @@ public function dropComponentAccess(string $componentName, $accessList); /** * Returns the access which the list is checking if some role can access it * - * @return string + * @return string|null */ - public function getActiveAccess(): string; + public function getActiveAccess(): ?string; /** * Returns the role which the list is checking if it's allowed to certain * component/access * - * @return string + * @return string|null */ - public function getActiveRole(): string; + public function getActiveRole(): ?string; /** * Returns the component which the list is checking if some role can access * it * - * @return string + * @return string|null */ - public function getActiveComponent(): string; + public function getActiveComponent(): ?string; /** * Returns the default ACL access level diff --git a/src/Phalcon/Annotations/Adapter/Apcu.php b/src/Phalcon/Annotations/Adapter/Apcu.php index eba79b1b..7b9bea29 100644 --- a/src/Phalcon/Annotations/Adapter/Apcu.php +++ b/src/Phalcon/Annotations/Adapter/Apcu.php @@ -47,7 +47,7 @@ public function __construct(array $options = array()) * Reads parsed annotations from APCu * * @param string $key - * @return mixed + * @return bool|\Phalcon\Annotations\Reflection */ public function read(string $key) { diff --git a/src/Phalcon/Annotations/Adapter/Memory.php b/src/Phalcon/Annotations/Adapter/Memory.php index cce0444f..dbbb475a 100644 --- a/src/Phalcon/Annotations/Adapter/Memory.php +++ b/src/Phalcon/Annotations/Adapter/Memory.php @@ -25,7 +25,7 @@ class Memory extends \Phalcon\Annotations\Adapter\AbstractAdapter * Reads parsed annotations from memory * * @param string $key - * @return mixed + * @return bool|\Phalcon\Annotations\Reflection */ public function read(string $key) { diff --git a/src/Phalcon/Annotations/Adapter/Stream.php b/src/Phalcon/Annotations/Adapter/Stream.php index 3e47be77..758856fe 100644 --- a/src/Phalcon/Annotations/Adapter/Stream.php +++ b/src/Phalcon/Annotations/Adapter/Stream.php @@ -45,7 +45,7 @@ public function __construct(array $options = array()) * Reads parsed annotations from files * * @param string $key - * @return mixed + * @return bool|int|\Phalcon\Annotations\Reflection */ public function read(string $key) { diff --git a/src/Phalcon/Annotations/Annotation.php b/src/Phalcon/Annotations/Annotation.php index 243f63a8..5f7602c2 100644 --- a/src/Phalcon/Annotations/Annotation.php +++ b/src/Phalcon/Annotations/Annotation.php @@ -19,19 +19,19 @@ class Annotation * * @var array */ - protected $arguments; + protected $arguments = array(); /** * Annotation ExprArguments * - * @var string + * @var array */ - protected $exprArguments; + protected $exprArguments = array(); /** * Annotation Name * - * @var string + * @var string|null */ protected $name; @@ -49,6 +49,7 @@ public function __construct(array $reflectionData) * Returns an argument in a specific position * * @param mixed $position + * @return mixed|null */ public function getArgument($position) { @@ -85,9 +86,9 @@ public function getExpression(array $expr) /** * Returns the annotation's name * - * @return string + * @return string|null */ - public function getName(): string + public function getName(): ?string { } @@ -95,6 +96,7 @@ public function getName(): string * Returns a named argument * * @param string $name + * @return mixed|null */ public function getNamedArgument(string $name) { diff --git a/src/Phalcon/Annotations/Collection.php b/src/Phalcon/Annotations/Collection.php index 5bcb82e2..de4b4d50 100644 --- a/src/Phalcon/Annotations/Collection.php +++ b/src/Phalcon/Annotations/Collection.php @@ -60,7 +60,7 @@ public function count(): int /** * Returns the current annotation in the iterator * - * @return mixed + * @return bool|Annotation */ public function current() { diff --git a/src/Phalcon/Annotations/Reflection.php b/src/Phalcon/Annotations/Reflection.php index 83bb43fa..f1285b35 100644 --- a/src/Phalcon/Annotations/Reflection.php +++ b/src/Phalcon/Annotations/Reflection.php @@ -56,7 +56,7 @@ public function __construct(array $reflectionData = array()) /** * Returns the annotations found in the class docblock * - * @return mixed + * @return bool|Collection */ public function getClassAnnotations() { diff --git a/src/Phalcon/Cli/Router.php b/src/Phalcon/Cli/Router.php index 79745c4c..40f62fe8 100644 --- a/src/Phalcon/Cli/Router.php +++ b/src/Phalcon/Cli/Router.php @@ -148,7 +148,7 @@ public function getParams(): array * Returns a route object by its id * * @param int $id - * @return mixed + * @return bool|\Phalcon\Cli\Router\RouteInterface */ public function getRouteById($id) { @@ -158,7 +158,7 @@ public function getRouteById($id) * Returns a route object by its name * * @param string $name - * @return mixed + * @return bool|\Phalcon\Cli\Router\RouteInterface */ public function getRouteByName(string $name) { diff --git a/src/Phalcon/Cli/Task.php b/src/Phalcon/Cli/Task.php index 02010ee6..1e918278 100644 --- a/src/Phalcon/Cli/Task.php +++ b/src/Phalcon/Cli/Task.php @@ -52,7 +52,7 @@ final public function __construct() /** * Returns the internal event manager * - * @return mixed + * @return \Phalcon\Events\ManagerInterface|null */ public function getEventsManager(): ?ManagerInterface { diff --git a/src/Phalcon/Config.php b/src/Phalcon/Config.php index 2f0e9993..a439b09b 100644 --- a/src/Phalcon/Config.php +++ b/src/Phalcon/Config.php @@ -86,7 +86,7 @@ public function merge($toMerge): Config * @param string $path * @param mixed $defaultValue * @param mixed $delimiter - * @return mixed + * @return mixed|null */ public function path(string $path, $defaultValue = null, $delimiter = null) { diff --git a/src/Phalcon/Config/ConfigFactory.php b/src/Phalcon/Config/ConfigFactory.php index a08c4b62..4b1df61e 100644 --- a/src/Phalcon/Config/ConfigFactory.php +++ b/src/Phalcon/Config/ConfigFactory.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Config; +use Phalcon\Config; use Phalcon\Factory\AbstractFactory; /** @@ -47,9 +48,9 @@ public function __construct(array $services = array()) * 'mode' => null, * 'callbacks' => null * ] - * @return object + * @return Config */ - public function load($config) + public function load($config): Config { } @@ -59,9 +60,9 @@ public function load($config) * @param string $name * @param string $fileName * @param mixed $params - * @return object + * @return Config */ - public function newInstance(string $name, string $fileName, $params = null) + public function newInstance(string $name, string $fileName, $params = null): Config { } diff --git a/src/Phalcon/Crypt.php b/src/Phalcon/Crypt.php index add83cf9..ecc21978 100644 --- a/src/Phalcon/Crypt.php +++ b/src/Phalcon/Crypt.php @@ -70,7 +70,7 @@ class Crypt implements \Phalcon\Crypt\CryptInterface /** * @var string */ - protected $key; + protected $key = ''; /** * @var int diff --git a/src/Phalcon/Db/Adapter/AbstractAdapter.php b/src/Phalcon/Db/Adapter/AbstractAdapter.php index 3aac1f6b..f1d974fc 100644 --- a/src/Phalcon/Db/Adapter/AbstractAdapter.php +++ b/src/Phalcon/Db/Adapter/AbstractAdapter.php @@ -13,10 +13,9 @@ use Phalcon\Db\Enum; use Phalcon\Db\RawValue; use Phalcon\Events\ManagerInterface; -use Phalcon\Events\Manager; /** - * Base class for Phalcon\Db adapters + * Base class for Phalcon\Db\Adapter adapters */ abstract class AbstractAdapter implements \Phalcon\Db\Adapter\AdapterInterface, \Phalcon\Events\EventsAwareInterface { @@ -52,7 +51,7 @@ abstract class AbstractAdapter implements \Phalcon\Db\Adapter\AdapterInterface, /** * Event Manager * - * @var Manager + * @var ManagerInterface */ protected $eventsManager; diff --git a/src/Phalcon/Db/Adapter/AdapterInterface.php b/src/Phalcon/Db/Adapter/AdapterInterface.php index d0e8ccd6..aff45a02 100644 --- a/src/Phalcon/Db/Adapter/AdapterInterface.php +++ b/src/Phalcon/Db/Adapter/AdapterInterface.php @@ -11,7 +11,6 @@ use Phalcon\Db\DialectInterface; use Phalcon\Db\RawValue; -use Phalcon\Db\ResultInterface; /** * Interface for Phalcon\Db adapters @@ -505,7 +504,7 @@ public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ * @param string $sqlStatement * @param mixed $placeholders * @param mixed $dataTypes - * @return ResultInterface|bool + * @return bool|\Phalcon\Db\ResultInterface */ public function query(string $sqlStatement, $placeholders = null, $dataTypes = null); diff --git a/src/Phalcon/Db/Adapter/Pdo/AbstractPdo.php b/src/Phalcon/Db/Adapter/Pdo/AbstractPdo.php index 6be2d961..c6ea5233 100644 --- a/src/Phalcon/Db/Adapter/Pdo/AbstractPdo.php +++ b/src/Phalcon/Db/Adapter/Pdo/AbstractPdo.php @@ -361,7 +361,7 @@ public function prepare(string $sqlStatement): \PDOStatement * @param string $sqlStatement * @param mixed $bindParams * @param mixed $bindTypes - * @return mixed + * @return bool|\Phalcon\Db\ResultInterface */ public function query(string $sqlStatement, $bindParams = null, $bindTypes = null) { diff --git a/src/Phalcon/Db/Column.php b/src/Phalcon/Db/Column.php index 956a644c..051e4b8c 100644 --- a/src/Phalcon/Db/Column.php +++ b/src/Phalcon/Db/Column.php @@ -207,7 +207,7 @@ class Column implements \Phalcon\Db\ColumnInterface /** * Column Position * - * @var string + * @var string|null */ protected $after; @@ -271,7 +271,7 @@ class Column implements \Phalcon\Db\ColumnInterface /** * Integer column size * - * @var int + * @var int | string */ protected $size = 0; @@ -332,9 +332,9 @@ public function getScale(): int /** * Integer column size * - * @return int + * @return int|string */ - public function getSize(): int + public function getSize() { } @@ -378,9 +378,9 @@ public function __construct(string $name, array $definition) /** * Check whether field absolute to position in table * - * @return string + * @return string|null */ - public function getAfterPosition(): string + public function getAfterPosition(): ?string { } diff --git a/src/Phalcon/Db/ColumnInterface.php b/src/Phalcon/Db/ColumnInterface.php index 4860a22b..b4745255 100644 --- a/src/Phalcon/Db/ColumnInterface.php +++ b/src/Phalcon/Db/ColumnInterface.php @@ -18,9 +18,9 @@ interface ColumnInterface /** * Check whether field absolute to position in table * - * @return string + * @return string|null */ - public function getAfterPosition(): string; + public function getAfterPosition(): ?string; /** * Returns the type of bind handling @@ -53,9 +53,9 @@ public function getScale(): int; /** * Returns column size * - * @return int + * @return int|string */ - public function getSize(): int; + public function getSize(); /** * Returns column type diff --git a/src/Phalcon/Di.php b/src/Phalcon/Di.php index b7d54e62..55876e9d 100644 --- a/src/Phalcon/Di.php +++ b/src/Phalcon/Di.php @@ -55,23 +55,27 @@ class Di implements \Phalcon\Di\DiInterface { /** * List of registered services + * + * @var ServiceInterface[] */ - protected $services; + protected $services = array(); /** * List of shared instances */ - protected $sharedInstances; + protected $sharedInstances = array(); /** * Events Manager * - * @var ManagerInterface + * @var ManagerInterface | null */ protected $eventsManager; /** * Latest DI build + * + * @var DiInterface | null */ protected static $_default; @@ -102,7 +106,7 @@ public function __call(string $method, array $arguments = array()) * @param string $name * @param mixed $definition * @param bool $shared - * @return mixed + * @return bool|\Phalcon\Di\ServiceInterface */ public function attempt(string $name, $definition, bool $shared = false) { @@ -122,7 +126,7 @@ public function get(string $name, $parameters = null) /** * Return the latest DI created * - * @return mixed + * @return \Phalcon\Di\DiInterface|null */ public static function getDefault(): ?DiInterface { @@ -131,9 +135,9 @@ public static function getDefault(): ?DiInterface /** * Returns the internal event manager * - * @return ManagerInterface + * @return \Phalcon\Events\ManagerInterface|null */ - public function getInternalEventsManager(): ManagerInterface + public function getInternalEventsManager(): ?ManagerInterface { } diff --git a/src/Phalcon/Di/DiInterface.php b/src/Phalcon/Di/DiInterface.php index 6c47e9f4..4a6baa72 100644 --- a/src/Phalcon/Di/DiInterface.php +++ b/src/Phalcon/Di/DiInterface.php @@ -23,7 +23,7 @@ interface DiInterface extends \ArrayAccess * @param mixed $definition * @param string $name * @param bool $shared - * @return mixed + * @return bool|ServiceInterface */ public function attempt(string $name, $definition, bool $shared = false); @@ -39,7 +39,7 @@ public function get(string $name, $parameters = null); /** * Return the last DI created * - * @return mixed + * @return DiInterface|null */ public static function getDefault(): ?DiInterface; diff --git a/src/Phalcon/Dispatcher/AbstractDispatcher.php b/src/Phalcon/Dispatcher/AbstractDispatcher.php index 7b307449..fbc48c61 100644 --- a/src/Phalcon/Dispatcher/AbstractDispatcher.php +++ b/src/Phalcon/Dispatcher/AbstractDispatcher.php @@ -238,7 +238,7 @@ public function getHandlerSuffix(): string /** * Gets model binder * - * @return mixed + * @return \Phalcon\Mvc\Model\BinderInterface|null */ public function getModelBinder(): ?BinderInterface { diff --git a/src/Phalcon/Dispatcher/DispatcherInterface.php b/src/Phalcon/Dispatcher/DispatcherInterface.php index 8b7244f9..ca3c0918 100644 --- a/src/Phalcon/Dispatcher/DispatcherInterface.php +++ b/src/Phalcon/Dispatcher/DispatcherInterface.php @@ -18,7 +18,7 @@ interface DispatcherInterface /** * Dispatches a handle action taking into account the routing parameters * - * @return object|bool + * @return object|false */ public function dispatch(): bool; diff --git a/src/Phalcon/Events/EventsAwareInterface.php b/src/Phalcon/Events/EventsAwareInterface.php index f35d4f45..1504e5d6 100644 --- a/src/Phalcon/Events/EventsAwareInterface.php +++ b/src/Phalcon/Events/EventsAwareInterface.php @@ -21,7 +21,7 @@ interface EventsAwareInterface /** * Returns the internal event manager * - * @return mixed + * @return ManagerInterface|null */ public function getEventsManager(): ?ManagerInterface; diff --git a/src/Phalcon/Factory/AbstractFactory.php b/src/Phalcon/Factory/AbstractFactory.php index d4feaa9b..2f604c31 100644 --- a/src/Phalcon/Factory/AbstractFactory.php +++ b/src/Phalcon/Factory/AbstractFactory.php @@ -30,16 +30,6 @@ abstract class AbstractFactory protected $services = array(); - /** - * Checks if a service exists and throws an exception - * - * @param string $name - * @return void - */ - protected function checkService(string $name) - { - } - /** * Checks the config if it is a valid object * @@ -57,6 +47,16 @@ protected function checkConfig($config): array */ abstract protected function getAdapters(): array; + /** + * Checks if a service exists and throws an exception + * + * @param string $name + * @return mixed + */ + protected function getService(string $name) + { + } + /** * AdapterFactory constructor. * diff --git a/src/Phalcon/Filter.php b/src/Phalcon/Filter.php index cf5fcae8..7982bcc1 100644 --- a/src/Phalcon/Filter.php +++ b/src/Phalcon/Filter.php @@ -102,8 +102,8 @@ public function __construct(array $mapper = array()) * Get a service. If it is not in the mapper array, create a new object, * set it and then return it. * - * @param string $name * @return object + * @param string $name */ public function get(string $name) { diff --git a/src/Phalcon/Flash/AbstractFlash.php b/src/Phalcon/Flash/AbstractFlash.php index d8f3b026..ba47a1f3 100644 --- a/src/Phalcon/Flash/AbstractFlash.php +++ b/src/Phalcon/Flash/AbstractFlash.php @@ -112,10 +112,10 @@ public function clear() * $flash->error("This is an error"); * ``` * + * @return null|string|void * @param string $message - * @return string */ - public function error(string $message): string + public function error(string $message): ?string { } @@ -135,10 +135,10 @@ public function getEscaperService(): EscaperInterface * $flash->notice("This is an information"); * ``` * + * @return null|string|void * @param string $message - * @return string */ - public function notice(string $message): string + public function notice(string $message): ?string { } @@ -210,10 +210,10 @@ public function setImplicitFlush(bool $implicitFlush): FlashInterface * $flash->success("The process was finished successfully"); * ``` * + * @return null|string|void * @param string $message - * @return string */ - public function success(string $message): string + public function success(string $message): ?string { } @@ -225,7 +225,7 @@ public function success(string $message): string * ``` * * @param string|array $message - * @return string|void + * @return null|string|void * @param string $type */ public function outputMessage(string $type, $message) @@ -239,10 +239,10 @@ public function outputMessage(string $type, $message) * $flash->warning("Hey, this is important"); * ``` * + * @return null|string|void * @param string $message - * @return string */ - public function warning(string $message): string + public function warning(string $message): ?string { } diff --git a/src/Phalcon/Flash/Direct.php b/src/Phalcon/Flash/Direct.php index e4a809ee..2031665f 100644 --- a/src/Phalcon/Flash/Direct.php +++ b/src/Phalcon/Flash/Direct.php @@ -10,8 +10,8 @@ namespace Phalcon\Flash; /** - * This is a variant of the Phalcon\Flash that immediately outputs any message - * passed to it + * This is an implementation of the Phalcon\Flash\FlashInterface that + * immediately outputs any message passed to it. */ class Direct extends \Phalcon\Flash\AbstractFlash { @@ -19,9 +19,9 @@ class Direct extends \Phalcon\Flash\AbstractFlash /** * Outputs a message * + * @return null|string|void * @param string $type * @param mixed $message - * @return string|null */ public function message(string $type, $message): ?string { diff --git a/src/Phalcon/Flash/Exception.php b/src/Phalcon/Flash/Exception.php index cc2e3fea..f2ddec13 100644 --- a/src/Phalcon/Flash/Exception.php +++ b/src/Phalcon/Flash/Exception.php @@ -10,7 +10,7 @@ namespace Phalcon\Flash; /** - * Exceptions thrown in Phalcon\Flash will use this class + * Exceptions thrown in Phalcon\Flash calsses will use this class */ class Exception extends \Phalcon\Exception { diff --git a/src/Phalcon/Flash/FlashInterface.php b/src/Phalcon/Flash/FlashInterface.php index d311b268..5e5824bf 100644 --- a/src/Phalcon/Flash/FlashInterface.php +++ b/src/Phalcon/Flash/FlashInterface.php @@ -10,9 +10,9 @@ namespace Phalcon\Flash; /** - * Phalcon\FlashInterface + * Phalcon\Flash\FlashInterface * - * Interface for Phalcon\Flash + * Interface for Phalcon\Flash classes */ interface FlashInterface { @@ -20,41 +20,41 @@ interface FlashInterface /** * Shows a HTML error message * + * @return null|string|void * @param string $message - * @return string */ - public function error(string $message): string; + public function error(string $message): ?string; /** * Outputs a message * + * @return null|string|void * @param string $type * @param string $message - * @return string|null */ public function message(string $type, string $message): ?string; /** * Shows a HTML notice/information message * + * @return null|string|void * @param string $message - * @return string */ - public function notice(string $message): string; + public function notice(string $message): ?string; /** * Shows a HTML success message * + * @return null|string|void * @param string $message - * @return string */ - public function success(string $message): string; + public function success(string $message): ?string; /** * Shows a HTML warning message * + * @return null|string|void * @param string $message - * @return string */ - public function warning(string $message): string; + public function warning(string $message): ?string; } diff --git a/src/Phalcon/Flash/Session.php b/src/Phalcon/Flash/Session.php index 4bf0687f..f204ed7f 100644 --- a/src/Phalcon/Flash/Session.php +++ b/src/Phalcon/Flash/Session.php @@ -12,8 +12,9 @@ use Phalcon\Session\ManagerInterface; /** - * Temporarily stores the messages in session, then messages can be printed in - * the next request + * This is an implementation of the Phalcon\Flash\FlashInterface that + * temporarily stores the messages in session, then messages can be printed in + * the next request. */ class Session extends \Phalcon\Flash\AbstractFlash { @@ -51,9 +52,9 @@ public function has($type = null): bool /** * Adds a message to the session flasher * + * @return null|string|void * @param string $type * @param string $message - * @return string|null */ public function message(string $type, string $message): ?string { diff --git a/src/Phalcon/Forms/Form.php b/src/Phalcon/Forms/Form.php index dcf85e29..6d8bffe9 100644 --- a/src/Phalcon/Forms/Form.php +++ b/src/Phalcon/Forms/Form.php @@ -118,7 +118,7 @@ public function count(): int /** * Returns the current element in the iterator * - * @return mixed + * @return bool|\Phalcon\Forms\Element\ElementInterface */ public function current() { @@ -193,7 +193,7 @@ public function getLabel(string $name): string * } * ``` * - * @return mixed + * @return array|\Phalcon\Messages\Messages */ public function getMessages() { diff --git a/src/Phalcon/Http/Message/AbstractCommon.php b/src/Phalcon/Http/Message/AbstractCommon.php index 91c209e8..020e9e42 100644 --- a/src/Phalcon/Http/Message/AbstractCommon.php +++ b/src/Phalcon/Http/Message/AbstractCommon.php @@ -21,7 +21,7 @@ abstract class AbstractCommon * @param mixed $element * @param string $property * - * @return mixed + * @return static */ final protected function cloneInstance($element, string $property) { @@ -44,7 +44,7 @@ final protected function checkStringParameter($element) * @param mixed $element * @param string $property * - * @return mixed + * @return static */ final protected function processWith($element, string $property) { diff --git a/src/Phalcon/Http/Message/AbstractMessage.php b/src/Phalcon/Http/Message/AbstractMessage.php index 8073f424..290030c4 100644 --- a/src/Phalcon/Http/Message/AbstractMessage.php +++ b/src/Phalcon/Http/Message/AbstractMessage.php @@ -179,7 +179,7 @@ public function hasHeader($name): bool * @param string $name * @param string|string[] $value * - * @return self + * @return static * @param mixed $value * @param string|string [] $value * @@ -199,7 +199,7 @@ public function withAddedHeader($name, $value) * * @param StreamInterface $body * - * @return self + * @return static * @throws InvalidArgumentException When the body is not valid. * */ @@ -221,7 +221,7 @@ public function withBody(\Psr\Http\Message\StreamInterface $body) * @param string $name * @param string|string[] $value * - * @return self + * @return static * @throws InvalidArgumentException for invalid header names or values. * * @param mixed $value @@ -244,7 +244,7 @@ public function withHeader($name, $value) * * @param string $version * - * @return self + * @return static */ public function withProtocolVersion($version) { @@ -261,7 +261,7 @@ public function withProtocolVersion($version) * * @param string $name * - * @return self + * @return static */ public function withoutHeader($name) { diff --git a/src/Phalcon/Http/Message/AbstractRequest.php b/src/Phalcon/Http/Message/AbstractRequest.php index fd605d15..c5808555 100644 --- a/src/Phalcon/Http/Message/AbstractRequest.php +++ b/src/Phalcon/Http/Message/AbstractRequest.php @@ -93,9 +93,8 @@ public function getRequestTarget(): string * * @param string $method * - * @return object + * @return static * @throws InvalidArgumentException for invalid HTTP methods. - * */ public function withMethod($method) { @@ -118,7 +117,7 @@ public function withMethod($method) * * @param mixed $requestTarget * - * @return object + * @return static */ public function withRequestTarget($requestTarget) { @@ -155,7 +154,7 @@ public function withRequestTarget($requestTarget) * @param UriInterface $uri * @param bool $preserveHost * - * @return object + * @return static */ public function withUri(\Psr\Http\Message\UriInterface $uri, $preserveHost = false) { diff --git a/src/Phalcon/Http/Message/Response.php b/src/Phalcon/Http/Message/Response.php index cfb4ec27..d15eb1ee 100644 --- a/src/Phalcon/Http/Message/Response.php +++ b/src/Phalcon/Http/Message/Response.php @@ -31,7 +31,7 @@ final class Response extends AbstractMessage implements \Psr\Http\Message\Respon * * @var string */ - private $reasonPhrase = ''; + protected $reasonPhrase = ''; /** * Gets the response status code. @@ -41,7 +41,7 @@ final class Response extends AbstractMessage implements \Psr\Http\Message\Respon * * @var int */ - private $statusCode = 200; + protected $statusCode = 200; /** @@ -108,42 +108,42 @@ public function withStatus($code, $reasonPhrase = ''): Response } /** - * Checks if a code is integer or string + * Returns the list of status codes available * - * @param mixed $code - * @return void + * @return array */ - private function checkCodeType($code) + protected function getPhrases(): array { } /** - * Checks if a code is integer or string + * Set a valid status code and phrase * - * @param int $code + * @param mixed $code + * @param mixed $phrase * @return void */ - private function checkCodeValue(int $code) + protected function processCode($code, $phrase = '') { } /** - * Returns the list of status codes available + * Checks if a code is integer or string * - * @return array + * @param mixed $code + * @return void */ - private function getPhrases(): array + private function checkCodeType($code) { } /** - * Set a valid status code and phrase + * Checks if a code is integer or string * - * @param mixed $code - * @param mixed $phrase + * @param int $code * @return void */ - private function processCode($code, $phrase = '') + private function checkCodeValue(int $code) { } } diff --git a/src/Phalcon/Http/Message/ServerRequest.php b/src/Phalcon/Http/Message/ServerRequest.php index e11cfb58..d6da1619 100644 --- a/src/Phalcon/Http/Message/ServerRequest.php +++ b/src/Phalcon/Http/Message/ServerRequest.php @@ -24,7 +24,7 @@ final class ServerRequest extends \Phalcon\Http\Message\AbstractRequest implemen /** * @var Collection */ - private $attributes; + protected $attributes; /** * Retrieve cookies. @@ -36,7 +36,7 @@ final class ServerRequest extends \Phalcon\Http\Message\AbstractRequest implemen * * @var array */ - private $cookieParams = array(); + protected $cookieParams = array(); /** * Retrieve any parameters provided in the request body. @@ -52,7 +52,7 @@ final class ServerRequest extends \Phalcon\Http\Message\AbstractRequest implemen * * @var mixed */ - private $parsedBody; + protected $parsedBody; /** * Retrieve query string arguments. @@ -66,7 +66,7 @@ final class ServerRequest extends \Phalcon\Http\Message\AbstractRequest implemen * * @var array */ - private $queryParams = array(); + protected $queryParams = array(); /** * Retrieve server parameters. @@ -77,7 +77,7 @@ final class ServerRequest extends \Phalcon\Http\Message\AbstractRequest implemen * * @var array */ - private $serverParams = array(); + protected $serverParams = array(); /** * Retrieve normalized file upload data. @@ -90,7 +90,7 @@ final class ServerRequest extends \Phalcon\Http\Message\AbstractRequest implemen * * @var array */ - private $uploadedFiles = array(); + protected $uploadedFiles = array(); /** diff --git a/src/Phalcon/Http/Message/Uri.php b/src/Phalcon/Http/Message/Uri.php index 2b20450a..29434daf 100644 --- a/src/Phalcon/Http/Message/Uri.php +++ b/src/Phalcon/Http/Message/Uri.php @@ -22,7 +22,7 @@ final class Uri extends \Phalcon\Http\Message\AbstractCommon implements \Psr\Htt * * @return string */ - private $fragment = ''; + protected $fragment = ''; /** * Retrieve the host component of the URI. @@ -36,19 +36,19 @@ final class Uri extends \Phalcon\Http\Message\AbstractCommon implements \Psr\Htt * * @return string */ - private $host = ''; + protected $host = ''; /** * @var string */ - private $pass = ''; + protected $pass = ''; /** * Returns the path of the URL * * @return string */ - private $path = ''; + protected $path = ''; /** * Retrieve the port component of the URI. @@ -65,14 +65,14 @@ final class Uri extends \Phalcon\Http\Message\AbstractCommon implements \Psr\Htt * * @return int|null */ - private $port = null; + protected $port = null; /** * Returns the query of the URL * * @return string */ - private $query = ''; + protected $query = ''; /** * Retrieve the scheme component of the URI. diff --git a/src/Phalcon/Http/Request.php b/src/Phalcon/Http/Request.php index fa2cf8ba..fdc1022f 100644 --- a/src/Phalcon/Http/Request.php +++ b/src/Phalcon/Http/Request.php @@ -315,7 +315,7 @@ public function getHTTPReferer(): string * Gets decoded JSON HTTP raw request body * * @param bool $associative - * @return mixed + * @return array|bool|\stdClass */ public function getJsonRawBody(bool $associative = false) { diff --git a/src/Phalcon/Http/RequestInterface.php b/src/Phalcon/Http/RequestInterface.php index 8c96e2e2..44d54fd1 100644 --- a/src/Phalcon/Http/RequestInterface.php +++ b/src/Phalcon/Http/RequestInterface.php @@ -184,7 +184,7 @@ public function getHTTPReferer(): string; * Gets decoded JSON HTTP raw request body * * @param bool $associative - * @return mixed + * @return array|bool|\stdClass */ public function getJsonRawBody(bool $associative = false); diff --git a/src/Phalcon/Http/Response.php b/src/Phalcon/Http/Response.php index bb19e53d..ae62f691 100644 --- a/src/Phalcon/Http/Response.php +++ b/src/Phalcon/Http/Response.php @@ -60,11 +60,11 @@ class Response implements \Phalcon\Http\ResponseInterface, \Phalcon\Di\Injection /** * Phalcon\Http\Response constructor * - * @param mixed $content + * @param string $content * @param mixed $code * @param mixed $status */ - public function __construct($content = null, $code = null, $status = null) + public function __construct(string $content = null, $code = null, $status = null) { } @@ -244,7 +244,7 @@ public function sendCookies(): ResponseInterface /** * Sends headers to the client * - * @return mixed + * @return bool|ResponseInterface */ public function sendHeaders() { diff --git a/src/Phalcon/Http/Response/Cookies.php b/src/Phalcon/Http/Response/Cookies.php index 79e2a2fc..65e8d588 100644 --- a/src/Phalcon/Http/Response/Cookies.php +++ b/src/Phalcon/Http/Response/Cookies.php @@ -201,9 +201,9 @@ public function set(string $name, $value = null, int $expire = 0, string $path = * * @see \Phalcon\Security\Random * @param string $signKey - * @return CookieInterface + * @return CookiesInterface */ - public function setSignKey(string $signKey = null): CookieInterface + public function setSignKey(string $signKey = null): CookiesInterface { } diff --git a/src/Phalcon/Http/ResponseInterface.php b/src/Phalcon/Http/ResponseInterface.php index effb2543..d0a7668f 100644 --- a/src/Phalcon/Http/ResponseInterface.php +++ b/src/Phalcon/Http/ResponseInterface.php @@ -188,7 +188,7 @@ public function sendCookies(): ResponseInterface; /** * Sends headers to the client * - * @return mixed + * @return bool|ResponseInterface */ public function sendHeaders(); } diff --git a/src/Phalcon/Logger/Item.php b/src/Phalcon/Logger/Item.php index da63c75f..094977e5 100644 --- a/src/Phalcon/Logger/Item.php +++ b/src/Phalcon/Logger/Item.php @@ -16,7 +16,11 @@ */ class Item { - + /** + * Log Context + * + * @return mixed + */ protected $context; /** @@ -50,7 +54,6 @@ class Item /** * Log Context - * @return mixed */ public function getContext() { diff --git a/src/Phalcon/Mvc/Application.php b/src/Phalcon/Mvc/Application.php index ec4e78c0..1c2c3a56 100644 --- a/src/Phalcon/Mvc/Application.php +++ b/src/Phalcon/Mvc/Application.php @@ -73,7 +73,7 @@ class Application extends AbstractApplication * Handles a MVC request * * @param string $uri - * @return mixed + * @return bool|\Phalcon\Http\ResponseInterface */ public function handle(string $uri) { diff --git a/src/Phalcon/Mvc/Micro.php b/src/Phalcon/Mvc/Micro.php index ba0606f0..5a51c953 100644 --- a/src/Phalcon/Mvc/Micro.php +++ b/src/Phalcon/Mvc/Micro.php @@ -187,7 +187,7 @@ public function getBoundModels(): array /** * Returns the internal event manager * - * @return mixed + * @return \Phalcon\Events\ManagerInterface|null */ public function getEventsManager(): ?ManagerInterface { @@ -215,7 +215,7 @@ public function getHandlers(): array /** * Gets model binder * - * @return mixed + * @return \Phalcon\Mvc\Model\BinderInterface|null */ public function getModelBinder(): ?BinderInterface { diff --git a/src/Phalcon/Mvc/Model.php b/src/Phalcon/Mvc/Model.php index 921dffbd..beece83c 100644 --- a/src/Phalcon/Mvc/Model.php +++ b/src/Phalcon/Mvc/Model.php @@ -218,13 +218,24 @@ public function __set(string $property, $value) * $this->addBehavior( * new Timestampable( * [ - * "onCreate" => [ + * "beforeCreate" => [ * "field" => "created_at", * "format" => "Y-m-d", * ], * ] * ) * ); + * + * $this->addBehavior( + * new Timestampable( + * [ + * "beforeUpdate" => [ + * "field" => "updated_at", + * "format" => "Y-m-d", + * ], + * ] + * ) + * ); * } * } * ``` @@ -320,7 +331,11 @@ public function assign(array $data, $whiteList = null, $dataColumnMap = null): M /** * Returns the average value on a column for a result-set of rows matching - * the specified conditions + * the specified conditions. + * + * Returned value will be a float for simple queries or a ResultsetInterface + * instance for when the GROUP condition is used. The results will + * contain the average of each group. * * ```php * // What's the average price of robots? @@ -344,9 +359,9 @@ public function assign(array $data, $whiteList = null, $dataColumnMap = null): M * ``` * * @param array $parameters - * @return double + * @return double | ResultsetInterface */ - public static function average($parameters = null): float + public static function average($parameters = null) { } @@ -411,7 +426,11 @@ public static function cloneResultMapHydrate(array $data, $columnMap, int $hydra } /** - * Counts how many records match the specified conditions + * Counts how many records match the specified conditions. + * + * Returns an integer for simple queries or a ResultsetInterface + * instance for when the GROUP condition is used. The results will + * contain the count of each group. * * ```php * // How many robots are there? @@ -426,9 +445,9 @@ public static function cloneResultMapHydrate(array $data, $columnMap, int $hydra * ``` * * @param array $parameters - * @return mixed + * @return int|\Phalcon\Mvc\Model\ResultsetInterface */ - public static function count($parameters = null): int + public static function count($parameters = null) { } @@ -769,7 +788,7 @@ public static function find($parameters = null): ResultsetInterface * ], * 'hydration' => null * ] - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public static function findFirst($parameters = null) { @@ -828,11 +847,11 @@ public function getDirtyState(): int } /** - * Returns the custom events manager + * Returns the custom events manager or null if there is no custom events manager * - * @return EventsManagerInterface + * @return \Phalcon\Events\ManagerInterface|null */ - public function getEventsManager(): EventsManagerInterface + public function getEventsManager(): ?EventsManagerInterface { } @@ -1248,7 +1267,7 @@ final public function setConnectionService(string $connectionService) * Sets the dirty state of the object using one of the DIRTY_STATE_ constants * * @param int $dirtyState - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public function setDirtyState(int $dirtyState) { @@ -1400,9 +1419,9 @@ public function skipOperation(bool $skip) * ``` * * @param array $parameters - * @return double + * @return double | ResultsetInterface */ - public static function sum($parameters = null): float + public static function sum($parameters = null) { } diff --git a/src/Phalcon/Mvc/Model/Binder.php b/src/Phalcon/Mvc/Model/Binder.php index 980c7340..2c02aae2 100644 --- a/src/Phalcon/Mvc/Model/Binder.php +++ b/src/Phalcon/Mvc/Model/Binder.php @@ -12,7 +12,7 @@ use Phalcon\Cache\Adapter\AdapterInterface; /** - * Phalcon\Mvc\Model\Binding + * Phalcon\Mvc\Model\Binder * * This is an class for binding models into params for handler */ @@ -82,9 +82,9 @@ public function bindToHandler($handler, array $params, string $cacheKey, string /** * Find the model by param value. * + * @return object|false * @param mixed $paramValue * @param string $className - * @return object|bool */ protected function findBoundModel($paramValue, string $className): bool { diff --git a/src/Phalcon/Mvc/Model/Criteria.php b/src/Phalcon/Mvc/Model/Criteria.php index 53767d7e..7214c6e4 100644 --- a/src/Phalcon/Mvc/Model/Criteria.php +++ b/src/Phalcon/Mvc/Model/Criteria.php @@ -199,9 +199,9 @@ public static function fromInput(\Phalcon\Di\DiInterface $container, string $mod /** * Returns the columns to be queried * - * @return string|null + * @return string|array|null */ - public function getColumns(): ?string + public function getColumns() { } @@ -238,13 +238,15 @@ public function getHaving() } /** - * Returns the limit parameter in the criteria, which will be an integer if - * limit was set without an offset, an array with 'number' and 'offset' keys - * if an offset was set with the limit, or null if limit has not been set. + * Returns the limit parameter in the criteria, which will be * - * @return string|null + * - An integer if 'limit' was set without an 'offset' + * - An array with 'number' and 'offset' keys if an offset was set with the limit + * - NULL if limit has not been set + * + * @return int|array|null */ - public function getLimit(): ?string + public function getLimit() { } diff --git a/src/Phalcon/Mvc/Model/CriteriaInterface.php b/src/Phalcon/Mvc/Model/CriteriaInterface.php index 419e17a5..b75a366e 100644 --- a/src/Phalcon/Mvc/Model/CriteriaInterface.php +++ b/src/Phalcon/Mvc/Model/CriteriaInterface.php @@ -102,9 +102,9 @@ public function forUpdate(bool $forUpdate = true): CriteriaInterface; /** * Returns the columns to be queried * - * @return string|null + * @return string|array|null */ - public function getColumns(): ?string; + public function getColumns(); /** * Returns the conditions parameter in the criteria @@ -124,13 +124,15 @@ public function getGroupBy(); public function getHaving(); /** - * Returns the limit parameter in the criteria, which will be an integer if - * limit was set without an offset, an array with 'number' and 'offset' keys - * if an offset was set with the limit, or null if limit has not been set. + * Returns the limit parameter in the criteria, which will be * - * @return string|null + * - An integer if 'limit' was set without an 'offset' + * - An array with 'number' and 'offset' keys if an offset was set with the limit + * - NULL if limit has not been set + * + * @return int|array|null */ - public function getLimit(): ?string; + public function getLimit(); /** * Returns an internal model name on which the criteria will be applied diff --git a/src/Phalcon/Mvc/Model/Manager.php b/src/Phalcon/Mvc/Model/Manager.php index 9af259ba..df8d5cfb 100644 --- a/src/Phalcon/Mvc/Model/Manager.php +++ b/src/Phalcon/Mvc/Model/Manager.php @@ -13,6 +13,7 @@ use Phalcon\Di\DiInterface; use Phalcon\Events\ManagerInterface as EventsManagerInterface; use Phalcon\Mvc\Model\Query\BuilderInterface; +use Phalcon\Mvc\Model\Query\StatusInterface; use Phalcon\Mvc\ModelInterface; /** @@ -206,12 +207,12 @@ public function setCustomEventsManager(\Phalcon\Mvc\ModelInterface $model, \Phal } /** - * Returns a custom events manager related to a model + * Returns a custom events manager related to a model or null if there is no related events manager * * @param \Phalcon\Mvc\ModelInterface $model - * @return mixed + * @return \Phalcon\Events\ManagerInterface|null */ - public function getCustomEventsManager(\Phalcon\Mvc\ModelInterface $model) + public function getCustomEventsManager(\Phalcon\Mvc\ModelInterface $model): ?EventsManagerInterface { } @@ -477,10 +478,10 @@ public function missingMethod(\Phalcon\Mvc\ModelInterface $model, string $eventN * Binds a behavior to a model * * @param \Phalcon\Mvc\ModelInterface $model - * @param \Phalcon\Mvc\Model\BehaviorInterface $behavior + * @param BehaviorInterface $behavior * @return void */ - public function addBehavior(\Phalcon\Mvc\ModelInterface $model, \Phalcon\Mvc\Model\BehaviorInterface $behavior) + public function addBehavior(\Phalcon\Mvc\ModelInterface $model, BehaviorInterface $behavior) { } @@ -662,7 +663,7 @@ public function existsHasManyToMany(string $modelName, string $modelRelation): b * * @param string $modelName * @param string $alias - * @return mixed + * @return bool|RelationInterface */ public function getRelationByAlias(string $modelName, string $alias) { @@ -731,7 +732,7 @@ public function clearReusableObjects() * @param \Phalcon\Mvc\ModelInterface $record * @param mixed $parameters * @param string $method - * @return mixed + * @return bool|ResultsetInterface */ public function getBelongsToRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null) { @@ -745,7 +746,7 @@ public function getBelongsToRecords(string $modelName, string $modelRelation, \P * @param \Phalcon\Mvc\ModelInterface $record * @param mixed $parameters * @param string $method - * @return mixed + * @return bool|ResultsetInterface */ public function getHasManyRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null) { @@ -759,7 +760,7 @@ public function getHasManyRecords(string $modelName, string $modelRelation, \Pha * @param \Phalcon\Mvc\ModelInterface $record * @param mixed $parameters * @param string $method - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public function getHasOneRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null) { @@ -865,12 +866,32 @@ public function createQuery(string $phql): QueryInterface /** * Creates a Phalcon\Mvc\Model\Query and execute it * + * ```php + * $model = new Robots(); + * $manager = $model->getModelsManager(); + * + * // \Phalcon\Mvc\Model\Resultset\Simple + * $manager->executeQuery('SELECT FROM Robots'); + * + * // \Phalcon\Mvc\Model\Resultset\Complex + * $manager->executeQuery('SELECT COUNT(type) FROM Robots GROUP BY type'); + * + * // \Phalcon\Mvc\Model\Query\StatusInterface + * $manager->executeQuery('INSERT INTO Robots (id) VALUES (1)'); + * + * // \Phalcon\Mvc\Model\Query\StatusInterface + * $manager->executeQuery('UPDATE Robots SET id = 0 WHERE id = :id:', ['id' => 1]); + * + * // \Phalcon\Mvc\Model\Query\StatusInterface + * $manager->executeQuery('DELETE FROM Robots WHERE id = :id:', ['id' => 1]); + * ``` + * + * @param array|null $placeholders + * @param array|null $types + * @return ResultsetInterface|StatusInterface * @param string $phql - * @param mixed $placeholders - * @param mixed $types - * @return QueryInterface */ - public function executeQuery(string $phql, $placeholders = null, $types = null): QueryInterface + public function executeQuery(string $phql, $placeholders = null, $types = null) { } diff --git a/src/Phalcon/Mvc/Model/ManagerInterface.php b/src/Phalcon/Mvc/Model/ManagerInterface.php index 1e1193c5..c6b9256e 100644 --- a/src/Phalcon/Mvc/Model/ManagerInterface.php +++ b/src/Phalcon/Mvc/Model/ManagerInterface.php @@ -11,6 +11,7 @@ use Phalcon\Db\Adapter\AdapterInterface; use Phalcon\Mvc\Model\Query\BuilderInterface; +use Phalcon\Mvc\Model\Query\StatusInterface; use Phalcon\Mvc\ModelInterface; /** @@ -115,11 +116,12 @@ public function createQuery(string $phql): QueryInterface; /** * Creates a Phalcon\Mvc\Model\Query and execute it * - * @param array $placeholders + * @param array|null $placeholders + * @param array|null $types + * @return ResultsetInterface|StatusInterface * @param string $phql - * @return QueryInterface */ - public function executeQuery(string $phql, $placeholders = null): QueryInterface; + public function executeQuery(string $phql, $placeholders = null, $types = null); /** * Checks whether a model has a belongsTo relation with another model @@ -182,7 +184,7 @@ public function getBelongsTo(\Phalcon\Mvc\ModelInterface $model): array; * @param array|string|null $parameters * @param ModelInterface $record * @param string|null $method - * @return mixed + * @return bool|ResultsetInterface */ public function getBelongsToRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null); @@ -202,7 +204,7 @@ public function getHasMany(\Phalcon\Mvc\ModelInterface $model): array; * @param array|string|null $parameters * @param ModelInterface $record * @param string|null $method - * @return mixed + * @return bool|ResultsetInterface */ public function getHasManyRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null); @@ -246,7 +248,7 @@ public function getHasOneAndHasMany(\Phalcon\Mvc\ModelInterface $model): array; * @param array|string|null $parameters * @param ModelInterface $record * @param string|null $method - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public function getHasOneRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null); @@ -301,7 +303,7 @@ public function getReadConnectionService(\Phalcon\Mvc\ModelInterface $model): st * * @param string $modelName * @param string $alias - * @return mixed + * @return bool|Relation */ public function getRelationByAlias(string $modelName, string $alias); diff --git a/src/Phalcon/Mvc/Model/MetaData.php b/src/Phalcon/Mvc/Model/MetaData.php index e6e6309b..64ac785e 100644 --- a/src/Phalcon/Mvc/Model/MetaData.php +++ b/src/Phalcon/Mvc/Model/MetaData.php @@ -89,7 +89,7 @@ abstract class MetaData implements \Phalcon\Di\InjectionAwareInterface, \Phalcon protected $adapter; - protected $columnMap; + protected $columnMap = array(); protected $container; @@ -185,9 +185,9 @@ public function getBindTypes(\Phalcon\Mvc\ModelInterface $model): array * ``` * * @param \Phalcon\Mvc\ModelInterface $model - * @return array + * @return array|null */ - public function getColumnMap(\Phalcon\Mvc\ModelInterface $model): array + public function getColumnMap(\Phalcon\Mvc\ModelInterface $model): ?array { } @@ -356,9 +356,9 @@ public function getPrimaryKeyAttributes(\Phalcon\Mvc\ModelInterface $model): arr * ``` * * @param \Phalcon\Mvc\ModelInterface $model - * @return array + * @return array|null */ - public function getReverseColumnMap(\Phalcon\Mvc\ModelInterface $model): array + public function getReverseColumnMap(\Phalcon\Mvc\ModelInterface $model): ?array { } diff --git a/src/Phalcon/Mvc/Model/MetaDataInterface.php b/src/Phalcon/Mvc/Model/MetaDataInterface.php index 40abad22..fe06aef5 100644 --- a/src/Phalcon/Mvc/Model/MetaDataInterface.php +++ b/src/Phalcon/Mvc/Model/MetaDataInterface.php @@ -55,9 +55,9 @@ public function getBindTypes(\Phalcon\Mvc\ModelInterface $model): array; * Returns the column map if any * * @param \Phalcon\Mvc\ModelInterface $model - * @return array + * @return array|null */ - public function getColumnMap(\Phalcon\Mvc\ModelInterface $model): array; + public function getColumnMap(\Phalcon\Mvc\ModelInterface $model): ?array; /** * Returns attributes (which have default values) and their default values @@ -127,9 +127,9 @@ public function getPrimaryKeyAttributes(\Phalcon\Mvc\ModelInterface $model): arr * Returns the reverse column map if any * * @param \Phalcon\Mvc\ModelInterface $model - * @return array + * @return array|null */ - public function getReverseColumnMap(\Phalcon\Mvc\ModelInterface $model): array; + public function getReverseColumnMap(\Phalcon\Mvc\ModelInterface $model): ?array; /** * Return the strategy to obtain the meta-data diff --git a/src/Phalcon/Mvc/Model/Query.php b/src/Phalcon/Mvc/Model/Query.php index 31d41240..ce02e1aa 100644 --- a/src/Phalcon/Mvc/Model/Query.php +++ b/src/Phalcon/Mvc/Model/Query.php @@ -451,7 +451,7 @@ public function getCache(): AdapterInterface * @param array $bindParams * @param array $bindTypes * @param bool $simulate - * @return mixed + * @return array|\Phalcon\Mvc\Model\ResultsetInterface */ final protected function _executeSelect(array $intermediate, array $bindParams, array $bindTypes, bool $simulate = false) { diff --git a/src/Phalcon/Mvc/Model/ResultInterface.php b/src/Phalcon/Mvc/Model/ResultInterface.php index 3f71406f..9e83d6bf 100644 --- a/src/Phalcon/Mvc/Model/ResultInterface.php +++ b/src/Phalcon/Mvc/Model/ResultInterface.php @@ -21,7 +21,7 @@ interface ResultInterface * Sets the object's state * * @param int $dirtyState - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public function setDirtyState(int $dirtyState); } diff --git a/src/Phalcon/Mvc/Model/Resultset.php b/src/Phalcon/Mvc/Model/Resultset.php index c5f57173..71a31004 100644 --- a/src/Phalcon/Mvc/Model/Resultset.php +++ b/src/Phalcon/Mvc/Model/Resultset.php @@ -74,13 +74,13 @@ abstract class Resultset implements \Phalcon\Mvc\Model\ResultsetInterface, \Iter protected $activeRow = null; - protected $cache; + protected $cache = null; - protected $count; + protected $count = 0; - protected $errorMessages; + protected $errorMessages = array(); protected $hydrateMode = 0; @@ -164,9 +164,29 @@ public function getCache(): AdapterInterface /** * Get first row in the resultset * - * @return mixed + * ```php + * $model = new Robots(); + * $manager = $model->getModelsManager(); + * + * // \Robots + * $manager->createQuery('SELECT FROM Robots') + * ->execute() + * ->getFirst(); + * + * // \Phalcon\Mvc\Model\Row + * $manager->createQuery('SELECT r.id FROM Robots AS r') + * ->execute() + * ->getFirst(); + * + * // NULL + * $manager->createQuery('SELECT r.id FROM Robots AS r WHERE r.name = "NON-EXISTENT"') + * ->execute() + * ->getFirst(); + * ``` + * + * @return ModelInterface|Row|null */ - public function getFirst(): ?ModelInterface + public function getFirst() { } @@ -182,7 +202,7 @@ public function getHydrateMode(): int /** * Get last row in the resultset * - * @return mixed + * @return \Phalcon\Mvc\ModelInterface|null */ public function getLast(): ?ModelInterface { @@ -253,7 +273,7 @@ public function next() * Gets row in a specific position of the resultset * * @param mixed $index - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public function offsetGet($index) { diff --git a/src/Phalcon/Mvc/Model/Resultset/Complex.php b/src/Phalcon/Mvc/Model/Resultset/Complex.php index 4f3240f2..52929deb 100644 --- a/src/Phalcon/Mvc/Model/Resultset/Complex.php +++ b/src/Phalcon/Mvc/Model/Resultset/Complex.php @@ -43,7 +43,7 @@ public function __construct($columnTypes, \Phalcon\Db\ResultInterface $result = /** * Returns current row in the resultset * - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ final public function current() { diff --git a/src/Phalcon/Mvc/Model/Resultset/Simple.php b/src/Phalcon/Mvc/Model/Resultset/Simple.php index 0d428d2b..68eb43c9 100644 --- a/src/Phalcon/Mvc/Model/Resultset/Simple.php +++ b/src/Phalcon/Mvc/Model/Resultset/Simple.php @@ -48,7 +48,7 @@ public function __construct($columnMap, $model, $result, \Phalcon\Cache\Adapter\ /** * Returns current row in the resultset * - * @return mixed + * @return \Phalcon\Mvc\ModelInterface|null */ final public function current(): ?ModelInterface { diff --git a/src/Phalcon/Mvc/Model/ResultsetInterface.php b/src/Phalcon/Mvc/Model/ResultsetInterface.php index 6e2f6730..6c2fcdd2 100644 --- a/src/Phalcon/Mvc/Model/ResultsetInterface.php +++ b/src/Phalcon/Mvc/Model/ResultsetInterface.php @@ -56,9 +56,9 @@ public function getCache(): AdapterInterface; /** * Get first row in the resultset * - * @return mixed + * @return ModelInterface|Row|null */ - public function getFirst(): ?ModelInterface; + public function getFirst(); /** * Returns the current hydration mode @@ -70,7 +70,7 @@ public function getHydrateMode(): int; /** * Get last row in the resultset * - * @return mixed + * @return \Phalcon\Mvc\ModelInterface|null */ public function getLast(): ?ModelInterface; diff --git a/src/Phalcon/Mvc/Model/Row.php b/src/Phalcon/Mvc/Model/Row.php index 5ad81337..65d1cff6 100644 --- a/src/Phalcon/Mvc/Model/Row.php +++ b/src/Phalcon/Mvc/Model/Row.php @@ -86,7 +86,7 @@ public function readAttribute(string $attribute) * Set the current object's state * * @param int $dirtyState - * @return mixed + * @return bool|\Phalcon\Mvc\ModelInterface */ public function setDirtyState(int $dirtyState) { diff --git a/src/Phalcon/Mvc/Model/Transaction.php b/src/Phalcon/Mvc/Model/Transaction.php index 9f8d9866..0ffc5d86 100644 --- a/src/Phalcon/Mvc/Model/Transaction.php +++ b/src/Phalcon/Mvc/Model/Transaction.php @@ -68,7 +68,7 @@ class Transaction implements \Phalcon\Mvc\Model\TransactionInterface protected $manager; - protected $messages; + protected $messages = array(); protected $rollbackRecord; diff --git a/src/Phalcon/Mvc/Model/ValidationFailed.php b/src/Phalcon/Mvc/Model/ValidationFailed.php index f532b193..11a3dba9 100644 --- a/src/Phalcon/Mvc/Model/ValidationFailed.php +++ b/src/Phalcon/Mvc/Model/ValidationFailed.php @@ -20,7 +20,7 @@ class ValidationFailed extends \Phalcon\Mvc\Model\Exception { - protected $messages; + protected $messages = array(); protected $model; diff --git a/src/Phalcon/Mvc/ModelInterface.php b/src/Phalcon/Mvc/ModelInterface.php index 50ab8ab2..92ca9415 100644 --- a/src/Phalcon/Mvc/ModelInterface.php +++ b/src/Phalcon/Mvc/ModelInterface.php @@ -46,9 +46,9 @@ public function assign(array $data, $whiteList = null, $dataColumnMap = null): M * conditions * * @param array $parameters - * @return double + * @return double | ResultsetInterface */ - public static function average($parameters = null): float; + public static function average($parameters = null); /** * Assigns values to a model from an array returning a new model @@ -84,10 +84,14 @@ public static function cloneResultMapHydrate(array $data, $columnMap, int $hydra /** * Allows to count how many records match the specified conditions * + * Returns an integer for simple queries or a ResultsetInterface + * instance for when the GROUP condition is used. The results will + * contain the count of each group. + * * @param array $parameters - * @return int + * @return int|\Phalcon\Mvc\Model\ResultsetInterface */ - public static function count($parameters = null): int; + public static function count($parameters = null); /** * Inserts a model instance. If the instance already exists in the @@ -117,7 +121,7 @@ public static function find($parameters = null): ResultsetInterface; * Allows to query the first record that match the specified conditions * * @param array $parameters - * @return mixed + * @return bool|ModelInterface */ public static function findFirst($parameters = null); @@ -275,7 +279,7 @@ public function setConnectionService(string $connectionService); * constants * * @param int $dirtyState - * @return mixed + * @return bool|ModelInterface */ public function setDirtyState(int $dirtyState); @@ -325,9 +329,9 @@ public function skipOperation(bool $skip); * Allows to calculate a sum on a column that match the specified conditions * * @param array $parameters - * @return double + * @return double | ResultsetInterface */ - public static function sum($parameters = null): float; + public static function sum($parameters = null); /** * Check whether validation process has generated any messages diff --git a/src/Phalcon/Mvc/Router.php b/src/Phalcon/Mvc/Router.php index 75b49be9..cb84cd40 100644 --- a/src/Phalcon/Mvc/Router.php +++ b/src/Phalcon/Mvc/Router.php @@ -463,7 +463,7 @@ public function getParams(): array * Returns a route object by its id * * @param mixed $id - * @return mixed + * @return bool|\Phalcon\Mvc\Router\RouteInterface */ public function getRouteById($id) { @@ -473,7 +473,7 @@ public function getRouteById($id) * Returns a route object by its name * * @param string $name - * @return mixed + * @return bool|\Phalcon\Mvc\Router\RouteInterface */ public function getRouteByName(string $name) { diff --git a/src/Phalcon/Mvc/Router/Route.php b/src/Phalcon/Mvc/Router/Route.php index bb9ea158..287f343a 100644 --- a/src/Phalcon/Mvc/Router/Route.php +++ b/src/Phalcon/Mvc/Router/Route.php @@ -161,7 +161,7 @@ public function getConverters(): array /** * Returns the group associated with the route * - * @return mixed + * @return GroupInterface|null */ public function getGroup(): ?GroupInterface { diff --git a/src/Phalcon/Mvc/RouterInterface.php b/src/Phalcon/Mvc/RouterInterface.php index e6e702a9..336dd512 100644 --- a/src/Phalcon/Mvc/RouterInterface.php +++ b/src/Phalcon/Mvc/RouterInterface.php @@ -194,7 +194,7 @@ public function getRoutes(): array; * Returns a route object by its id * * @param mixed $id - * @return mixed + * @return bool|\Phalcon\Mvc\Router\RouteInterface */ public function getRouteById($id); @@ -202,7 +202,7 @@ public function getRouteById($id); * Returns a route object by its name * * @param string $name - * @return mixed + * @return bool|\Phalcon\Mvc\Router\RouteInterface */ public function getRouteByName(string $name); diff --git a/src/Phalcon/Mvc/View.php b/src/Phalcon/Mvc/View.php index 29bd0da4..01421d6a 100644 --- a/src/Phalcon/Mvc/View.php +++ b/src/Phalcon/Mvc/View.php @@ -326,7 +326,7 @@ public function getControllerName(): string /** * Returns the internal event manager * - * @return mixed + * @return \Phalcon\Events\ManagerInterface|null */ public function getEventsManager(): ?ManagerInterface { @@ -543,7 +543,7 @@ public function registerEngines(array $engines): View * @param string $controllerName * @param string $actionName * @param array $params - * @return mixed + * @return bool|View */ public function render(string $controllerName, string $actionName, array $params = array()) { diff --git a/src/Phalcon/Mvc/View/Engine/Volt.php b/src/Phalcon/Mvc/View/Engine/Volt.php index 6192db65..c2a9cfdb 100644 --- a/src/Phalcon/Mvc/View/Engine/Volt.php +++ b/src/Phalcon/Mvc/View/Engine/Volt.php @@ -65,7 +65,7 @@ public function getCompiler(): Compiler /** * Returns the internal event manager * - * @return mixed + * @return \Phalcon\Events\ManagerInterface|null */ public function getEventsManager(): ?ManagerInterface { diff --git a/src/Phalcon/Mvc/View/Simple.php b/src/Phalcon/Mvc/View/Simple.php index 7b4e6dd3..7501f4f6 100644 --- a/src/Phalcon/Mvc/View/Simple.php +++ b/src/Phalcon/Mvc/View/Simple.php @@ -138,7 +138,7 @@ public function getContent(): string /** * Returns the internal event manager * - * @return mixed + * @return \Phalcon\Events\ManagerInterface|null */ public function getEventsManager(): ?ManagerInterface { diff --git a/src/Phalcon/Mvc/ViewInterface.php b/src/Phalcon/Mvc/ViewInterface.php index c791f141..5e6a88a6 100644 --- a/src/Phalcon/Mvc/ViewInterface.php +++ b/src/Phalcon/Mvc/ViewInterface.php @@ -125,7 +125,7 @@ public function registerEngines(array $engines); * @param string $controllerName * @param string $actionName * @param array $params - * @return mixed + * @return bool|ViewInterface */ public function render(string $controllerName, string $actionName, array $params = array()); diff --git a/src/Phalcon/Security.php b/src/Phalcon/Security.php index bd340029..11e1dbb1 100644 --- a/src/Phalcon/Security.php +++ b/src/Phalcon/Security.php @@ -314,14 +314,14 @@ public function setWorkFactor(int $workFactor): Security } /** - * @return mixed + * @return \Phalcon\Http\RequestInterface|null */ private function getLocalRequest(): ?RequestInterface { } /** - * @return mixed + * @return \Phalcon\Session\ManagerInterface|null */ private function getLocalSession(): ?SessionInterface { diff --git a/src/Phalcon/Tag.php b/src/Phalcon/Tag.php index be8e8a3b..412a02e6 100644 --- a/src/Phalcon/Tag.php +++ b/src/Phalcon/Tag.php @@ -268,7 +268,7 @@ public static function getDocType(): string * Obtains the 'escaper' service if required * * @param array $params - * @return mixed + * @return \Phalcon\Escaper\EscaperInterface|null */ public static function getEscaper(array $params): ?EscaperInterface { diff --git a/src/Phalcon/Translate/InterpolatorFactory.php b/src/Phalcon/Translate/InterpolatorFactory.php index 1a2657ba..cff10ad8 100644 --- a/src/Phalcon/Translate/InterpolatorFactory.php +++ b/src/Phalcon/Translate/InterpolatorFactory.php @@ -10,28 +10,18 @@ namespace Phalcon\Translate; use Phalcon\Factory\AbstractFactory; -use Phalcon\Translate\Adapter\AdapterInterface; +use Phalcon\Translate\Interpolator\InterpolatorInterface; /** * This file is part of the Phalcon Framework. * * (c) Phalcon Team * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. + * For the full copyright and license information, please view the + * LICENSE.txt file that was distributed with this source code. */ class InterpolatorFactory extends AbstractFactory { - /** - * @var array - */ - private $mapper = array(); - - /** - * @var array - */ - private $services = array(); - /** * AdapterFactory constructor. @@ -46,9 +36,9 @@ public function __construct(array $services = array()) * Create a new instance of the adapter * * @param string $name - * @return AdapterInterface + * @return InterpolatorInterface */ - public function newInstance(string $name): AdapterInterface + public function newInstance(string $name): InterpolatorInterface { }