Skip to content

Commit 5d971fe

Browse files
author
Kirill Nesmeyanov
committed
Split reader interfaces
1 parent fab92ce commit 5d971fe

File tree

5 files changed

+77
-33
lines changed

5 files changed

+77
-33
lines changed

src/ConstantReaderInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\Reader;
6+
7+
use TypeLang\Parser\Node\Stmt\TypeStatement;
8+
use TypeLang\Reader\Exception\ReaderExceptionInterface;
9+
10+
interface ConstantReaderInterface
11+
{
12+
/**
13+
* Returns a type AST structure based on an {@see ReflectionClassConstant} object.
14+
*
15+
* @throws ReaderExceptionInterface In case of any reading error occurs.
16+
*/
17+
public function findConstantType(\ReflectionClassConstant $constant): ?TypeStatement;
18+
}

src/FunctionReaderInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\Reader;
6+
7+
use TypeLang\Parser\Node\Stmt\TypeStatement;
8+
use TypeLang\Reader\Exception\ReaderExceptionInterface;
9+
10+
interface FunctionReaderInterface
11+
{
12+
/**
13+
* Returns a type AST structure based on an {@see ReflectionFunctionAbstract} object.
14+
*
15+
* @throws ReaderExceptionInterface In case of any reading error occurs.
16+
*/
17+
public function findFunctionType(\ReflectionFunctionAbstract $function): ?TypeStatement;
18+
}

src/ParameterReaderInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\Reader;
6+
7+
use TypeLang\Parser\Node\Stmt\TypeStatement;
8+
use TypeLang\Reader\Exception\ReaderExceptionInterface;
9+
10+
interface ParameterReaderInterface
11+
{
12+
/**
13+
* Returns a type AST structure based on an {@see ReflectionParameter} object.
14+
*
15+
* @throws ReaderExceptionInterface In case of any reading error occurs.
16+
*/
17+
public function findParameterType(\ReflectionParameter $parameter): ?TypeStatement;
18+
}

src/PropertyReaderInterface.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace TypeLang\Reader;
6+
7+
use TypeLang\Parser\Node\Stmt\TypeStatement;
8+
use TypeLang\Reader\Exception\ReaderExceptionInterface;
9+
10+
interface PropertyReaderInterface
11+
{
12+
/**
13+
* Returns a type AST structure based on an {@see ReflectionProperty} object.
14+
*
15+
* @throws ReaderExceptionInterface In case of any reading error occurs.
16+
*/
17+
public function findPropertyType(\ReflectionProperty $property): ?TypeStatement;
18+
}

src/ReaderInterface.php

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,8 @@
44

55
namespace TypeLang\Reader;
66

7-
use TypeLang\Parser\Node\Stmt\TypeStatement;
8-
use TypeLang\Reader\Exception\ReaderExceptionInterface;
9-
10-
interface ReaderInterface
11-
{
12-
/**
13-
* Returns a type AST structure based on an {@see ReflectionProperty} object.
14-
*
15-
* @throws ReaderExceptionInterface In case of any reading error occurs.
16-
*/
17-
public function findPropertyType(\ReflectionProperty $property): ?TypeStatement;
18-
19-
/**
20-
* Returns a type AST structure based on an {@see ReflectionFunctionAbstract} object.
21-
*
22-
* @throws ReaderExceptionInterface In case of any reading error occurs.
23-
*/
24-
public function findFunctionType(\ReflectionFunctionAbstract $function): ?TypeStatement;
25-
26-
/**
27-
* Returns a type AST structure based on an {@see ReflectionParameter} object.
28-
*
29-
* @throws ReaderExceptionInterface In case of any reading error occurs.
30-
*/
31-
public function findParameterType(\ReflectionParameter $parameter): ?TypeStatement;
32-
33-
/**
34-
* Returns a type AST structure based on an {@see ReflectionClassConstant} object.
35-
*
36-
* @throws ReaderExceptionInterface In case of any reading error occurs.
37-
*/
38-
public function findConstantType(\ReflectionClassConstant $constant): ?TypeStatement;
39-
}
7+
interface ReaderInterface extends
8+
ConstantReaderInterface,
9+
PropertyReaderInterface,
10+
FunctionReaderInterface,
11+
ParameterReaderInterface {}

0 commit comments

Comments
 (0)