Skip to content

Commit

Permalink
Merge pull request #30 from ruudboon/4.x
Browse files Browse the repository at this point in the history
Bumped Stubs to RC.2
  • Loading branch information
ruudboon authored Oct 26, 2019
2 parents 3c36179 + d81dea0 commit e21e477
Show file tree
Hide file tree
Showing 462 changed files with 1,189 additions and 5,335 deletions.
60 changes: 19 additions & 41 deletions src/Phalcon/Cache.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

use Phalcon\Cache\Adapter\AdapterInterface;
use Phalcon\Cache\Exception\InvalidArgumentException;
use Psr\SimpleCache\CacheInterface;

/**
* This component offers caching capabilities for your application.
* Phalcon\Cache implements PSR-16.
*/
class Cache implements CacheInterface
class Cache implements \Psr\SimpleCache\CacheInterface
{
/**
* The adapter
Expand Down Expand Up @@ -49,7 +41,7 @@ public function __construct(\Phalcon\Cache\Adapter\AdapterInterface $adapter)
/**
* Wipes clean the entire cache's keys.
*
* @return bool
* @return bool True on success and false on failure.
*/
public function clear(): bool
{
Expand All @@ -62,9 +54,7 @@ public function clear(): bool
*
* @return bool True if the item was successfully removed. False if there was an error.
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if the $key string is not a legal value.
* @param mixed $key
* @return bool
* @throws InvalidArgumentException MUST be thrown if the $key string is not a legal value.
*/
public function delete($key): bool
{
Expand All @@ -77,9 +67,7 @@ public function delete($key): bool
*
* @return bool True if the items were successfully removed. False if there was an error.
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if $keys is neither an array nor a Traversable, or if any of the $keys are not a legal value.
* @param mixed $keys
* @return bool
* @throws InvalidArgumentException MUST be thrown if $keys is neither an array nor a Traversable, or if any of the $keys are not a legal value.
*/
public function deleteMultiple($keys): bool
{
Expand All @@ -88,14 +76,12 @@ public function deleteMultiple($keys): bool
/**
* Fetches a value from the cache.
*
* @param mixed $default Default value to return if the key does not exist.
* @param string $key The unique key of this item in the cache.
* @param mixed $defaultValue Default value to return if the key does not exist.
*
* @return mixed The value of the item from the cache, or $default in case of cache miss.
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if the $key string is not a legal value.
* @param string $key The unique key of this item in the cache.
* @param mixed $defaultValue
* @return mixed
* @throws InvalidArgumentException MUST be thrown if the $key string is not a legal value.
*/
public function get($key, $defaultValue = null)
{
Expand All @@ -104,14 +90,12 @@ public function get($key, $defaultValue = null)
/**
* Obtains multiple cache items by their unique keys.
*
* @param mixed $default Default value to return for keys that do not exist.
* @param iterable $keys A list of keys that can obtained in a single operation.
* @param mixed $defaultValue Default value to return for keys that do not exist.
*
* @return iterable A list of key => value pairs. Cache keys that do not exist or are stale will have $default as value.
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if $keys is neither an array nor a Traversable, or if any of the $keys are not a legal value.
* @param iterable $keys A list of keys that can obtained in a single operation.
* @param mixed $defaultValue
* @return mixed
* @throws InvalidArgumentException MUST be thrown if $keys is neither an array nor a Traversable, or if any of the $keys are not a legal value.
*/
public function getMultiple($keys, $defaultValue = null)
{
Expand All @@ -124,9 +108,7 @@ public function getMultiple($keys, $defaultValue = null)
*
* @return bool
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if the $key string is not a legal value.
* @param mixed $key
* @return bool
* @throws InvalidArgumentException MUST be thrown if the $key string is not a legal value.
*/
public function has($key): bool
{
Expand All @@ -135,17 +117,15 @@ public function has($key): bool
/**
* Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
*
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* @param string $key The key of the item to store.
* @param mixed $value The value of the item to store. Must be serializable.
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if the $key string is not a legal value.
* @param string $key The key of the item to store.
* @param mixed $value The value of the item to store. Must be serializable.
* @param mixed $ttl
* @return bool
* @throws InvalidArgumentException MUST be thrown if the $key string is not a legal value.
*/
public function set($key, $value, $ttl = null): bool
{
Expand All @@ -154,16 +134,14 @@ public function set($key, $value, $ttl = null): bool
/**
* Persists a set of key => value pairs in the cache, with an optional TTL.
*
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* @param iterable $values A list of key => value pairs for a multiple-set operation.
* @param null|int|\DateInterval $ttl Optional. The TTL value of this item. If no value is sent and
* the driver supports TTL then the library may set a default value
* for it or let the driver take care of that.
*
* @return bool True on success and false on failure.
*
* @throws Phalcon\Cache\Exception\InvalidArgumentException MUST be thrown if $values is neither an array nor a Traversable, or if any of the $values are not a legal value.
* @param iterable $values A list of key => value pairs for a multiple-set operation.
* @param mixed $ttl
* @return bool
* @throws InvalidArgumentException MUST be thrown if $values is neither an array nor a Traversable, or if any of the $values are not a legal value.
*/
public function setMultiple($values, $ttl = null): bool
{
Expand Down
31 changes: 9 additions & 22 deletions src/Phalcon/Collection.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

use ArrayAccess;
use Countable;
use IteratorAggregate;
use JsonSerializable;
use Serializable;
use Traversable;

/**
* `Phalcon\Collection` is a supercharged object oriented array. It implements [ArrayAccess](https://www.php.net/manual/en/class.arrayaccess.php), [Countable](https://www.php.net/manual/en/class.countable.php), [IteratorAggregate](https://www.php.net/manual/en/class.iteratoraggregate.php), [JsonSerializable](https://www.php.net/manual/en/class.jsonserializable.php), [Serializable](https://www.php.net/manual/en/class.serializable.php)
* `Phalcon\Collection` is a supercharged object oriented array. It implements:
* - [ArrayAccess](https://www.php.net/manual/en/class.arrayaccess.php)
* - [Countable](https://www.php.net/manual/en/class.countable.php)
* - [IteratorAggregate](https://www.php.net/manual/en/class.iteratoraggregate.php)
* - [JsonSerializable](https://www.php.net/manual/en/class.jsonserializable.php)
* - [Serializable](https://www.php.net/manual/en/class.serializable.php)
*
* It can be used in any part of the application that needs collection of data
* Such implementations are for instance accessing globals `$_GET`, `$_POST`
* etc.
*/
class Collection implements
ArrayAccess,
Countable,
IteratorAggregate,
JsonSerializable,
Serializable
class Collection implements \ArrayAccess, \Countable, \IteratorAggregate, \JsonSerializable, \Serializable
{
/**
* @var array
Expand Down Expand Up @@ -119,9 +105,10 @@ public function count(): int
*
* @param string $element
* @param mixed $defaultValue
* @param string $cast
* @return mixed
*/
public function get(string $element, $defaultValue = null)
public function get(string $element, $defaultValue = null, string $cast = null)
{
}

Expand Down
13 changes: 2 additions & 11 deletions src/Phalcon/Config.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

/**
Expand All @@ -17,7 +8,7 @@
* based user interface for accessing this configuration data within application
* code.
*
*```php
* ```php
* $config = new \Phalcon\Config(
* [
* "database" => [
Expand All @@ -34,7 +25,7 @@
* ],
* ]
* );
*```
* ```
*/
class Config extends Collection
{
Expand Down
14 changes: 2 additions & 12 deletions src/Phalcon/Container.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

use Phalcon\Di\DiInterface;
use Psr\Container\ContainerInterface;

/**
* PSR-11 Wrapper for `Phalcon\Di`
*/
class Container implements ContainerInterface
class Container implements \Psr\Container\ContainerInterface
{
/**
* @var <DiInterface>
* @var DiInterface
*/
protected $container;

Expand Down
15 changes: 3 additions & 12 deletions src/Phalcon/Crypt.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

use Phalcon\Crypt\CryptInterface;
Expand All @@ -31,7 +22,7 @@
* echo $crypt->decrypt($encrypted, $key);
* ```
*/
class Crypt implements CryptInterface
class Crypt implements \Phalcon\Crypt\CryptInterface
{

const PADDING_ANSI_X_923 = 1;
Expand Down Expand Up @@ -165,11 +156,11 @@ public function decrypt(string $text, string $key = null): string
/**
* Decrypt a text that is coded as a base64 string.
*
* @throws \Phalcon\Crypt\Mismatch
* @param string $text
* @param mixed $key
* @param bool $safe
* @return string
* @throws \Phalcon\Crypt\Mismatch
*/
public function decryptBase64(string $text, $key = null, bool $safe = false): string
{
Expand Down Expand Up @@ -293,9 +284,9 @@ public function setCipher(string $cipher): CryptInterface
/**
* Set the name of hashing algorithm.
*
* @throws \Phalcon\Crypt\Exception
* @param string $hashAlgo
* @return \Phalcon\Crypt\CryptInterface
* @throws \Phalcon\Crypt\Exception
*/
public function setHashAlgo(string $hashAlgo): CryptInterface
{
Expand Down
9 changes: 0 additions & 9 deletions src/Phalcon/Debug.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

/**
Expand Down
16 changes: 3 additions & 13 deletions src/Phalcon/Di.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
<?php

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

use Phalcon\Di\DiInterface;
use Phalcon\Di\Exception\ServiceResolutionException;
use Phalcon\Di\ServiceInterface;
use Phalcon\Events\ManagerInterface;

Expand All @@ -34,7 +24,7 @@
* Additionally, this pattern increases testability in the code, thus making it
* less prone to errors.
*
*```php
* ```php
* use Phalcon\Di;
* use Phalcon\Http\Request;
*
Expand All @@ -52,9 +42,9 @@
* );
*
* $request = $di->getRequest();
*```
* ```
*/
class Di implements DiInterface
class Di implements \Phalcon\Di\DiInterface
{
/**
* List of registered services
Expand Down
Loading

0 comments on commit e21e477

Please sign in to comment.