Skip to content

Commit

Permalink
Do not use object return type hint
Browse files Browse the repository at this point in the history
See: #14987
  • Loading branch information
sergeyklay authored and niden committed May 16, 2020
1 parent b38796e commit 8fccfe3
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 46 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG-4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,25 @@
- Fixed return type hints of the following `Phalcon\Annotations\Annotation`'s methods: `getArgument`, `getName` and `getNamedArgument` [#14977](https://github.com/phalcon/cphalcon/issues/14977)
- Fixed incorrect return type hint for `Phalcon\Http\Response\Cookies::setSignKey` [#14982](https://github.com/phalcon/cphalcon/issues/14982)
- Fixed return type hints for `Phalcon\Config\ConfigFactory::load` and `Phalcon\Config\ConfigFactory::newInstance` to explicitly indicate the return type as `Phalcon\Config` instance [#14978](https://github.com/phalcon/cphalcon/issues/14978)
- Fixed return type hints for the following methods [#14987](https://github.com/phalcon/cphalcon/issues/14987):
- `Phalcon\Dispatcher\AbstractDispatcher::dispatch`
- `Phalcon\Dispatcher\DispatcherInterface::dispatch`
- `Phalcon\Filter::get`
- `Phalcon\Http\Message\AbstractCommon::cloneInstance`
- `Phalcon\Http\Message\AbstractCommon::processWith`
- `Phalcon\Http\Message\AbstractMessage::withAddedHeader`
- `Phalcon\Http\Message\AbstractMessage::withBody`
- `Phalcon\Http\Message\AbstractMessage::withHeader`
- `Phalcon\Http\Message\AbstractMessage::withProtocolVersion`
- `Phalcon\Http\Message\AbstractMessage::withoutHeader`
- `Phalcon\Http\Message\AbstractRequest::withMethod`
- `Phalcon\Http\Message\AbstractRequest::withRequestTarget`
- `Phalcon\Http\Message\AbstractRequest::withUri`
- `Phalcon\Mvc\Model\Binder::findBoundModel`
- `Phalcon\Validation::getEntity`
- `Phalcon\Validation\ValidationInterface::getEntity`

[#14987](https://github.com/phalcon/cphalcon/issues/14987)

# [4.0.5](https://github.com/phalcon/cphalcon/releases/tag/v4.0.5) (2020-03-07)
## Added
Expand Down
6 changes: 3 additions & 3 deletions phalcon/Dispatcher/AbstractDispatcher.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*/

namespace Phalcon\Dispatcher;
Expand Down Expand Up @@ -120,7 +120,7 @@ abstract class AbstractDispatcher extends AbstractInjectionAware implements Disp
*
* @throws \Exception if any uncaught or unhandled exception occurs during the dispatcher process.
*/
public function dispatch() -> object | bool
public function dispatch() -> var | bool
{
bool hasService, hasEventsManager;
int numberDispatches;
Expand Down
8 changes: 5 additions & 3 deletions phalcon/Dispatcher/DispatcherInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*/

namespace Phalcon\Dispatcher;
Expand All @@ -17,8 +17,10 @@ interface DispatcherInterface
{
/**
* Dispatches a handle action taking into account the routing parameters
*
* @return object|false
*/
public function dispatch() -> object | bool;
public function dispatch() -> var | bool;

/**
* Forwards the execution flow to another controller/action
Expand Down
8 changes: 5 additions & 3 deletions phalcon/Filter.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*/

namespace Phalcon;
Expand Down Expand Up @@ -63,8 +63,10 @@ class Filter implements FilterInterface
/**
* Get a service. If it is not in the mapper array, create a new object,
* set it and then return it.
*
* @return object
*/
public function get(string! name) -> object
public function get(string! name) -> var
{
var definition;

Expand Down
12 changes: 6 additions & 6 deletions phalcon/Http/Message/AbstractCommon.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*
* Implementation of this file has been influenced by Zend Diactoros
* @link https://github.com/zendframework/zend-diactoros
Expand All @@ -27,9 +27,9 @@ abstract class AbstractCommon
* @param mixed $element
* @param string $property
*
* @return mixed
* @return static
*/
final protected function cloneInstance(var element, string property) -> object
final protected function cloneInstance(var element, string property) -> var
{
var newInstance;

Expand Down Expand Up @@ -60,9 +60,9 @@ abstract class AbstractCommon
* @param mixed $element
* @param string $property
*
* @return mixed
* @return static
*/
final protected function processWith(var element, string property) -> object
final protected function processWith(var element, string property) -> var
{
this->checkStringParameter(element);

Expand Down
24 changes: 12 additions & 12 deletions phalcon/Http/Message/AbstractMessage.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*
* Implementation of this file has been influenced by Zend Diactoros
* @link https://github.com/zendframework/zend-diactoros
Expand Down Expand Up @@ -161,9 +161,9 @@ abstract class AbstractMessage extends AbstractCommon
* @param string $name
* @param string|string[] $value
*
* @return self
* @return static
*/
public function withAddedHeader(var name, var value) -> object
public function withAddedHeader(var name, var value) -> var
{
var existing, headers;

Expand All @@ -190,11 +190,11 @@ abstract class AbstractMessage extends AbstractCommon
*
* @param StreamInterface $body
*
* @return self
* @return static
* @throws InvalidArgumentException When the body is not valid.
*
*/
public function withBody(<StreamInterface> body) -> object
public function withBody(<StreamInterface> body) -> var
{
var newBody;

Expand All @@ -217,11 +217,11 @@ abstract class AbstractMessage extends AbstractCommon
* @param string $name
* @param string|string[] $value
*
* @return self
* @return static
* @throws InvalidArgumentException for invalid header names or values.
*
*/
public function withHeader(var name, var value) -> object
public function withHeader(var name, var value) -> var
{
var headers;

Expand All @@ -247,9 +247,9 @@ abstract class AbstractMessage extends AbstractCommon
*
* @param string $version
*
* @return self
* @return static
*/
public function withProtocolVersion(var version) -> object
public function withProtocolVersion(var version) -> var
{
this->processProtocol(version);

Expand All @@ -267,9 +267,9 @@ abstract class AbstractMessage extends AbstractCommon
*
* @param string $name
*
* @return self
* @return static
*/
public function withoutHeader(var name) -> object
public function withoutHeader(var name) -> var
{
var headers;

Expand Down
17 changes: 8 additions & 9 deletions phalcon/Http/Message/AbstractRequest.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*
* Implementation of this file has been influenced by Zend Diactoros
* @link https://github.com/zendframework/zend-diactoros
Expand Down Expand Up @@ -95,11 +95,10 @@ abstract class AbstractRequest extends AbstractMessage
*
* @param string $method
*
* @return object
* @return static
* @throws InvalidArgumentException for invalid HTTP methods.
*
*/
public function withMethod(var method) -> object
public function withMethod(var method) -> var
{
this->processMethod(method);

Expand All @@ -123,9 +122,9 @@ abstract class AbstractRequest extends AbstractMessage
*
* @param mixed $requestTarget
*
* @return object
* @return static
*/
public function withRequestTarget(var requestTarget) -> object
public function withRequestTarget(var requestTarget) -> var
{
if unlikely preg_match("/\s/", requestTarget) {
throw new InvalidArgumentException(
Expand Down Expand Up @@ -167,9 +166,9 @@ abstract class AbstractRequest extends AbstractMessage
* @param UriInterface $uri
* @param bool $preserveHost
*
* @return object
* @return static
*/
public function withUri(<UriInterface> uri, var preserveHost = false) -> object
public function withUri(<UriInterface> uri, var preserveHost = false) -> var
{
var headers, newInstance;

Expand Down
10 changes: 6 additions & 4 deletions phalcon/Mvc/Model/Binder.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*/

namespace Phalcon\Mvc\Model;
Expand All @@ -18,7 +18,7 @@ use ReflectionFunction;
use ReflectionMethod;

/**
* Phalcon\Mvc\Model\Binding
* Phalcon\Mvc\Model\Binder
*
* This is an class for binding models into params for handler
*/
Expand Down Expand Up @@ -94,8 +94,10 @@ class Binder implements BinderInterface

/**
* Find the model by param value.
*
* @return object|false
*/
protected function findBoundModel(var paramValue, string className) -> object | bool
protected function findBoundModel(var paramValue, string className) -> var | bool
{
return {className}::findFirst(paramValue);
}
Expand Down
8 changes: 5 additions & 3 deletions phalcon/Validation.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*/

namespace Phalcon;
Expand Down Expand Up @@ -130,8 +130,10 @@ class Validation extends Injectable implements ValidationInterface

/**
* Returns the bound entity
*
* @return object
*/
public function getEntity() -> object
public function getEntity() -> var
{
return this->entity;
}
Expand Down
8 changes: 5 additions & 3 deletions phalcon/Validation/ValidationInterface.zep
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*
* (c) Phalcon Team <team@phalcon.io>
*
* 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.
*/

namespace Phalcon\Validation;
Expand Down Expand Up @@ -40,8 +40,10 @@ interface ValidationInterface

/**
* Returns the bound entity
*
* @return object
*/
public function getEntity() -> object;
public function getEntity() -> var;

/**
* Returns all the filters or a specific one
Expand Down

0 comments on commit 8fccfe3

Please sign in to comment.