Skip to content

Commit 336ef25

Browse files
adaamzondrejmirtes
authored andcommitted
Added stubs for generic classes
1 parent edc43c4 commit 336ef25

File tree

16 files changed

+133
-38
lines changed

16 files changed

+133
-38
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"jakub-onderka/php-parallel-lint": "^1.0",
2525
"nette/application": "^2.3.0 || ^3.0.0",
2626
"nette/component-model": "^2.3.0 || ^3.0.0",
27+
"nette/database": "^3.0.0",
2728
"nette/di": "^2.3.0 || ^3.0.0",
2829
"nette/forms": "^2.3.0 || ^3.0.0",
2930
"nette/http": "^2.3.0 || ^3.0.0",

extension.neon

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
parameters:
22
stubFiles:
3-
- stubs/ArrayHash.stub
4-
- stubs/Form.stub
5-
- stubs/FormContainer.stub
6-
- stubs/Html.stub
7-
- stubs/Rules.stub
8-
- stubs/SessionSection.stub
3+
- stubs/Application/Routers/RouteList.stub
4+
- stubs/Application/UI/Component.stub
5+
- stubs/ComponentModel/IComponent.stub
6+
- stubs/Database/ResultSet.stub
7+
- stubs/Database/Table/ActiveRow.stub
8+
- stubs/Database/Table/Selection.stub
9+
- stubs/Database/ResultSet.stub
10+
- stubs/Forms/Container.stub
11+
- stubs/Forms/Form.stub
12+
- stubs/Forms/Rules.stub
13+
- stubs/Http/SessionSection.stub
14+
- stubs/Routing/Router.stub
15+
- stubs/Utils/Html.stub
916
universalObjectCratesClasses:
1017
- Nette\Application\UI\ITemplate
1118
- Nette\Bridges\ApplicationLatte\Template
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace Nette\Application\Routers;
4+
5+
/**
6+
* @phpstan-implements \IteratorAggregate<int, \Nette\Routing\Router>
7+
* @phpstan-implements \ArrayAccess<int, \Nette\Routing\Router>
8+
*/
9+
class RouteList implements \ArrayAccess, \IteratorAggregate
10+
{
11+
/**
12+
* @phpstan-return \ArrayIterator<int, \Nette\Routing\Router>
13+
*/
14+
public function getIterator(): \ArrayIterator
15+
{
16+
// nothing
17+
}
18+
}

stubs/Application/UI/Component.stub

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
namespace Nette\Application\UI;
4+
5+
/**
6+
* @phpstan-implements \ArrayAccess<string, \Nette\ComponentModel\IComponent>
7+
*/
8+
abstract class Component implements \ArrayAccess
9+
{
10+
11+
}

stubs/ArrayHash.stub

Lines changed: 0 additions & 20 deletions
This file was deleted.

stubs/ComponentModel/IComponent.stub

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Nette\ComponentModel;
4+
5+
interface IComponent
6+
{
7+
8+
}

stubs/Database/ResultSet.stub

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Nette\Database;
4+
5+
/**
6+
* @phpstan-extends \Traversable<string, mixed>
7+
* @phpstan-extends \ArrayAccess<string, mixed>
8+
*/
9+
interface IRow extends \Traversable, \ArrayAccess
10+
{
11+
12+
}
13+
14+
/**
15+
* @phpstan-extends \Traversable<int, IRow>
16+
*/
17+
interface IRowContainer extends \Traversable
18+
{
19+
20+
}
21+
22+
/**
23+
* @phpstan-implements \Iterator<int, IRow>
24+
*/
25+
class ResultSet implements \Iterator
26+
{
27+
28+
}

stubs/Database/Table/ActiveRow.stub

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Nette\Database\Table;
4+
5+
use Traversable;
6+
7+
/**
8+
* @phpstan-implements \IteratorAggregate<int, array<string, mixed>>
9+
*/
10+
class ActiveRow implements \IteratorAggregate
11+
{
12+
/**
13+
* @phpstan-return \ArrayIterator<int, array<string, mixed>>
14+
*/
15+
public function getIterator(): \ArrayIterator
16+
{
17+
// nothing
18+
}
19+
}

stubs/Database/Table/Selection.stub

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace Nette\Database\Table;
4+
5+
/**
6+
* @phpstan-implements \Iterator<string, ActiveRow>
7+
* @phpstan-implements \ArrayAccess<string, \Nette\Database\IRow>
8+
*/
9+
class Selection implements \Iterator, \ArrayAccess
10+
{
11+
12+
}

stubs/FormContainer.stub

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)