Skip to content

Commit dbf1a87

Browse files
authored
Merge pull request #100 from niden/master
5.7.0 stubs
2 parents 509423a + 8fde8c7 commit dbf1a87

File tree

14 files changed

+79
-65
lines changed

14 files changed

+79
-65
lines changed

src/Cli/Router.php

+11-10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Phalcon\Cli\Router\Route;
1515
use Phalcon\Cli\Router\Exception;
1616
use Phalcon\Cli\Router\RouteInterface;
17+
use Phalcon\Cli\RouterInterface;
1718

1819
/**
1920
* Phalcon\Cli\Router is the standard framework router. Routing is the process
@@ -35,7 +36,7 @@
3536
* echo $router->getTaskName();
3637
* ```
3738
*/
38-
class Router extends AbstractInjectionAware
39+
class Router extends AbstractInjectionAware implements \Phalcon\Cli\RouterInterface
3940
{
4041
/**
4142
* @var string
@@ -113,8 +114,8 @@ public function __construct(bool $defaultRoutes = true)
113114
* $router->add("/about", "About::main");
114115
* ```
115116
*
116-
* @param string|array $paths
117-
* @param string $pattern
117+
* @param string $pattern
118+
* @param mixed|null $paths
118119
* @return RouteInterface
119120
*/
120121
public function add(string $pattern, $paths = null): RouteInterface
@@ -179,7 +180,7 @@ public function getParameters(): array
179180
/**
180181
* Returns a route object by its id
181182
*
182-
* @param int $id
183+
* @param mixed $id
183184
* @return bool|RouteInterface
184185
*/
185186
public function getRouteById($id): RouteInterface|bool
@@ -227,19 +228,19 @@ public function handle($arguments = null)
227228
* Sets the default action name
228229
*
229230
* @param string $actionName
230-
* @return Router
231+
* @return RouterInterface
231232
*/
232-
public function setDefaultAction(string $actionName): Router
233+
public function setDefaultAction(string $actionName): RouterInterface
233234
{
234235
}
235236

236237
/**
237238
* Sets the name of the default module
238239
*
239240
* @param string $moduleName
240-
* @return Router
241+
* @return RouterInterface
241242
*/
242-
public function setDefaultModule(string $moduleName): Router
243+
public function setDefaultModule(string $moduleName): RouterInterface
243244
{
244245
}
245246

@@ -258,9 +259,9 @@ public function setDefaultModule(string $moduleName): Router
258259
* ```
259260
*
260261
* @param array $defaults
261-
* @return Router
262+
* @return RouterInterface
262263
*/
263-
public function setDefaults(array $defaults): Router
264+
public function setDefaults(array $defaults): RouterInterface
264265
{
265266
}
266267

src/Cli/RouterInterface.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,17 @@ public function getParameters(): array;
7272
* Returns a route object by its id
7373
*
7474
* @param mixed $id
75-
* @return RouteInterface
75+
* @return bool|RouteInterface
7676
*/
77-
public function getRouteById($id): RouteInterface;
77+
public function getRouteById($id): RouteInterface|bool;
7878

7979
/**
8080
* Returns a route object by its name
8181
*
8282
* @param string $name
83-
* @return RouteInterface
83+
* @return bool|RouteInterface
8484
*/
85-
public function getRouteByName(string $name): RouteInterface;
85+
public function getRouteByName(string $name): RouteInterface|bool;
8686

8787
/**
8888
* Return all the routes defined in the router
@@ -109,25 +109,25 @@ public function handle($arguments = null);
109109
* Sets the default action name
110110
*
111111
* @param string $actionName
112-
* @return void
112+
* @return RouterInterface
113113
*/
114-
public function setDefaultAction(string $actionName): void;
114+
public function setDefaultAction(string $actionName): RouterInterface;
115115

116116
/**
117117
* Sets the name of the default module
118118
*
119119
* @param string $moduleName
120-
* @return void
120+
* @return RouterInterface
121121
*/
122-
public function setDefaultModule(string $moduleName): void;
122+
public function setDefaultModule(string $moduleName): RouterInterface;
123123

124124
/**
125125
* Sets an array of default paths
126126
*
127127
* @param array $defaults
128-
* @return void
128+
* @return RouterInterface
129129
*/
130-
public function setDefaults(array $defaults): void;
130+
public function setDefaults(array $defaults): RouterInterface;
131131

132132
/**
133133
* Sets the default task name

src/Db/Column.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Column implements \Phalcon\Db\ColumnInterface
8383
/**
8484
* Binary abstract data type
8585
*/
86-
const TYPE_BINARY = 26;
86+
const TYPE_BINARY = 27;
8787

8888
/**
8989
* Blob abstract data type
@@ -208,7 +208,7 @@ class Column implements \Phalcon\Db\ColumnInterface
208208
/**
209209
* Varbinary abstract data type
210210
*/
211-
const TYPE_VARBINARY = 27;
211+
const TYPE_VARBINARY = 28;
212212

213213
/**
214214
* Varchar abstract data type

src/Filter/Filter.php

+22-22
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@
1212
/**
1313
* Lazy loads, stores and exposes sanitizer objects
1414
*
15-
* @method absint(mixed $input): int
16-
* @method alnum(mixed $input): string
17-
* @method alpha(mixed $input): string
18-
* @method bool(mixed $input): bool
19-
* @method email(string $input): string
20-
* @method float(mixed $input): float
21-
* @method int(string $input): int
22-
* @method lower(string $input): string
23-
* @method lowerfirst(string $input): string
24-
* @method regex(mixed $input, mixed $pattern, mixed $replace): mixed
25-
* @method remove(mixed $input, mixed $replace): mixed
26-
* @method replace(mixed $input, mixed $source, mixed $target): mixed
27-
* @method special(string $input): string
28-
* @method specialfull(string $input): string
29-
* @method string(string $input): string
30-
* @method stringlegacy(mixed $input): string
31-
* @method striptags(string $input): string
32-
* @method trim(string $input): string
33-
* @method upper(string $input): string
34-
* @method upperFirst(string $input): string
35-
* @method upperWords(string $input): string|null
36-
* @method url(string $input): string|null
15+
* @method int absint(mixed $input)
16+
* @method string alnum(mixed $input)
17+
* @method string alpha(mixed $input)
18+
* @method bool bool(mixed $input)
19+
* @method string email(string $input)
20+
* @method float float(mixed $input)
21+
* @method int int(string $input)
22+
* @method string lower(string $input)
23+
* @method string lowerfirst(string $input)
24+
* @method mixed regex(mixed $input, mixed $pattern, mixed $replace)
25+
* @method mixed remove(mixed $input, mixed $replace)
26+
* @method mixed replace(mixed $input, mixed $source, mixed $target)
27+
* @method string special(string $input)
28+
* @method string specialfull(string $input)
29+
* @method string string(string $input)
30+
* @method string stringlegacy(mixed $input)
31+
* @method string striptags(string $input)
32+
* @method string trim(string $input)
33+
* @method string upper(string $input)
34+
* @method string upperFirst(string $input)
35+
* @method string|null upperWords(string $input)
36+
* @method string|null url(string $input)
3737
*
3838
* @property array $mapper
3939
* @property array $services

src/Mvc/Model.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
* echo "Great, a new robot was saved successfully!";
8181
* }
8282
* ```
83+
*
84+
* @template T of static
8385
*/
8486
abstract class Model extends AbstractInjectionAware implements \Phalcon\Mvc\EntityInterface, \Phalcon\Mvc\ModelInterface, \Phalcon\Mvc\Model\ResultInterface, \Serializable, \JsonSerializable
8587
{
@@ -760,9 +762,9 @@ public function dump(): array
760762
* ],
761763
* 'hydration' => null
762764
* ]
763-
* @return ResultsetInterface
765+
* @return T[]|\Phalcon\Mvc\Model\Resultset<int, T>
764766
*/
765-
public static function find($parameters = null): ResultsetInterface
767+
public static function find($parameters = null)
766768
{
767769
}
768770

@@ -850,7 +852,7 @@ public static function find($parameters = null): ResultsetInterface
850852
* 'hydration' => null
851853
* ]
852854
*
853-
* @return \Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
855+
* @return T|\Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
854856
*/
855857
public static function findFirst($parameters = null): mixed
856858
{

src/Mvc/Model/Resultset.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
* $robots->next();
6464
* }
6565
* ```
66+
*
67+
* @template TKey
68+
* @template TValue
69+
* @implements Iterator<TKey, TValue>
6670
*/
6771
abstract class Resultset implements \Phalcon\Mvc\Model\ResultsetInterface, \Iterator, \SeekableIterator, \Countable, \ArrayAccess, \Serializable, \JsonSerializable
6872
{
@@ -279,7 +283,7 @@ public function jsonSerialize(): array
279283
/**
280284
* Gets pointer number of active row in the resultset
281285
*
282-
* @return int|null
286+
* @return TKey|null
283287
*/
284288
public function key(): int|null
285289
{

src/Mvc/Model/Resultset/Complex.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@
2626
*
2727
* Complex resultsets may include complete objects and scalar values.
2828
* This class builds every complex row as it is required
29+
*
30+
* @template TKey of int
31+
* @template TValue of mixed
2932
*/
30-
class Complex extends Resultset implements \Phalcon\Mvc\Model\ResultsetInterface
33+
class Complex extends Resultset
3134
{
3235
/**
3336
* @var array

src/Mvc/Model/Resultset/Simple.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
*
2424
* Simple resultsets only contains a complete objects
2525
* This class builds every complete object as it is required
26+
*
27+
* @template TKey of int
28+
* @template TValue of \Phalcon\Mvc\ModelInterface
2629
*/
2730
class Simple extends Resultset
2831
{
@@ -57,7 +60,7 @@ public function __construct($columnMap, $model, $result, $cache = null, bool $ke
5760
/**
5861
* Returns current row in the resultset
5962
*
60-
* @return ModelInterface|null
63+
* @return TValue
6164
*/
6265
final public function current(): ModelInterface|null
6366
{

src/Mvc/ModelInterface.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
use Phalcon\Messages\MessageInterface;
1515
use Phalcon\Mvc\Model\CriteriaInterface;
1616
use Phalcon\Mvc\Model\MetaDataInterface;
17+
use Phalcon\Mvc\Model\Resultset;
1718
use Phalcon\Mvc\Model\ResultsetInterface;
1819
use Phalcon\Mvc\Model\TransactionInterface;
1920

2021
/**
2122
* Phalcon\Mvc\ModelInterface
2223
*
2324
* Interface for Phalcon\Mvc\Model
25+
*
26+
* @template T
2427
*/
2528
interface ModelInterface
2629
{
@@ -115,15 +118,15 @@ public function delete(): bool;
115118
* Allows to query a set of records that match the specified conditions
116119
*
117120
* @param array|string|int|null $parameters *
118-
* @return ResultsetInterface
121+
* @return T[]|\Phalcon\Mvc\Model\Resultset<int, T>
119122
*/
120-
public static function find($parameters = null): ResultsetInterface;
123+
public static function find($parameters = null);
121124

122125
/**
123126
* Allows to query the first record that match the specified conditions
124127
*
125128
* @param array $parameters
126-
* @return \Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
129+
* @return T|\Phalcon\Mvc\ModelInterface|\Phalcon\Mvc\Model\Row|null
127130
*
128131
* TODO: Current method signature must be reviewed in v5. As it must return only ?ModelInterface (it also returns Row).
129132
* @see https://github.com/phalcon/cphalcon/issues/15212

src/Mvc/Router.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ public function getParams(): array
501501
/**
502502
* Returns a route object by its id
503503
*
504-
* @param mixed $id *
504+
* @param mixed $id
505+
*
505506
* @return RouteInterface|bool
506507
*/
507508
public function getRouteById($id): RouteInterface|bool

src/Support/Helper/Str/Uncamelize.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ class Uncamelize
1616
{
1717
/**
1818
* @param string $text
19-
* @param string $delimiters
19+
* @param string $delimiter
2020
*
2121
* @return string
22-
* @param string $delimiter
2322
*/
2423
public function __invoke(string $text, string $delimiter = '_'): string
2524
{

src/Tag.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public static function javascriptInclude($parameters = null, bool $local = true)
423423
/**
424424
* Builds a HTML A tag using framework conventions
425425
*
426-
* @param parameters $array |string = [
426+
* @param array|string $parameters = [
427427
* 'action' => '',
428428
* 'text' => '',
429429
* 'local' => false,
@@ -433,9 +433,8 @@ public static function javascriptInclude($parameters = null, bool $local = true)
433433
* 'href' => '',
434434
* 'id' => ''
435435
* ]
436-
* @param mixed $parameters
437-
* @param mixed $text
438-
* @param mixed $local
436+
* @param string $text
437+
* @param bool $local
439438
* @return string
440439
*/
441440
public static function linkTo($parameters, $text = null, $local = true): string

src/Translate/Adapter/Csv.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ public function query(string $translateKey, array $placeholders = []): string
7979
*
8080
* @param string $file
8181
* @param int $length
82-
* @param string $separator
82+
* @param string $delimiter
8383
* @param string $enclosure
8484
*
8585
* @throws Exception
86-
* @param string $delimiter
8786
* @return void
8887
*/
8988
private function load(string $file, int $length, string $delimiter, string $enclosure): void

0 commit comments

Comments
 (0)