Skip to content

Commit 207842a

Browse files
committed
Add more return types
1 parent e3d66f5 commit 207842a

25 files changed

+37
-39
lines changed

src/FqsenResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class FqsenResolver
1818
{
1919
/** @var string Definition of the NAMESPACE operator in PHP */
20-
const OPERATOR_NAMESPACE = '\\';
20+
private const OPERATOR_NAMESPACE = '\\';
2121

2222
public function resolve(string $fqsen, Context $context = null): Fqsen
2323
{

src/Type.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ interface Type
1919
*
2020
* @return string
2121
*/
22-
public function __toString();
22+
public function __toString(): string;
2323
}

src/TypeResolver.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@
2525
final class TypeResolver
2626
{
2727
/** @var string Definition of the ARRAY operator for types */
28-
const OPERATOR_ARRAY = '[]';
28+
private const OPERATOR_ARRAY = '[]';
2929

3030
/** @var string Definition of the NAMESPACE operator in PHP */
31-
const OPERATOR_NAMESPACE = '\\';
31+
private const OPERATOR_NAMESPACE = '\\';
3232

3333
/** @var int the iterator parser is inside a compound context */
34-
const PARSER_IN_COMPOUND = 0;
34+
private const PARSER_IN_COMPOUND = 0;
3535

3636
/** @var int the iterator parser is inside a nullable expression context */
37-
const PARSER_IN_NULLABLE = 1;
37+
private const PARSER_IN_NULLABLE = 1;
3838

3939
/** @var int the iterator parser is inside an array expression context */
40-
const PARSER_IN_ARRAY_EXPRESSION = 2;
40+
private const PARSER_IN_ARRAY_EXPRESSION = 2;
4141

4242
/** @var int the iterator parser is inside a collection expression context */
43-
const PARSER_IN_COLLECTION_EXPRESSION = 3;
43+
private const PARSER_IN_COLLECTION_EXPRESSION = 3;
4444

4545
/**
4646
* @var array<string, string> List of recognized keywords and unto which Value Object they map

src/Types/AbstractList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function getValueType(): Type
6464

6565
/**
6666
* Returns a rendered output of the Type as it would be used in a DocBlock.
67+
* @return string
6768
*/
6869
public function __toString(): string
6970
{

src/Types/Boolean.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class Boolean implements Type
2424
*
2525
* @return string
2626
*/
27-
public function __toString()
27+
public function __toString(): string
2828
{
2929
return 'bool';
3030
}

src/Types/Callable_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class Callable_ implements Type
2424
*
2525
* @return string
2626
*/
27-
public function __toString()
27+
public function __toString(): string
2828
{
2929
return 'callable';
3030
}

src/Types/Collection.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function getFqsen(): ?Fqsen
5555

5656
/**
5757
* Returns a rendered output of the Type as it would be used in a DocBlock.
58+
* @return string
5859
*/
5960
public function __toString(): string
6061
{

src/Types/Compound.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct(array $types)
5353
*
5454
* @return Type|null
5555
*/
56-
public function get($index)
56+
public function get(int $index): ?Type
5757
{
5858
if (!$this->has($index)) {
5959
return null;
@@ -69,7 +69,7 @@ public function get($index)
6969
*
7070
* @return bool
7171
*/
72-
public function has($index)
72+
public function has(int $index): bool
7373
{
7474
return isset($this->types[$index]);
7575
}
@@ -79,7 +79,7 @@ public function has($index)
7979
*
8080
* @return string
8181
*/
82-
public function __toString()
82+
public function __toString(): string
8383
{
8484
return implode('|', $this->types);
8585
}

src/Types/Context.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct($namespace, array $namespaceAliases = [])
6767
*
6868
* @return string
6969
*/
70-
public function getNamespace()
70+
public function getNamespace(): string
7171
{
7272
return $this->namespace;
7373
}
@@ -78,7 +78,7 @@ public function getNamespace()
7878
*
7979
* @return string[]
8080
*/
81-
public function getNamespaceAliases()
81+
public function getNamespaceAliases(): array
8282
{
8383
return $this->namespaceAliases;
8484
}

src/Types/ContextFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
final class ContextFactory
2727
{
2828
/** The literal used at the end of a use statement. */
29-
const T_LITERAL_END_OF_USE = ';';
29+
private const T_LITERAL_END_OF_USE = ';';
3030

3131
/** The literal used between sets of use statements */
32-
const T_LITERAL_USE_SEPARATOR = ',';
32+
private const T_LITERAL_USE_SEPARATOR = ',';
3333

3434
/**
3535
* Build a Context given a Class Reflection.

0 commit comments

Comments
 (0)