Skip to content

Commit 2e71e97

Browse files
Merge pull request #531 from kamil-tekiela/types-in-other-classes
Add native property types in other classes
2 parents d7f485c + fdb885b commit 2e71e97

File tree

4 files changed

+9
-24
lines changed

4 files changed

+9
-24
lines changed

src/TokensList.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ class TokensList implements ArrayAccess
2121
{
2222
/**
2323
* The count of tokens.
24-
*
25-
* @var int
2624
*/
27-
public $count = 0;
25+
public int $count = 0;
2826

2927
/**
3028
* The index of the next token to be returned.
31-
*
32-
* @var int
3329
*/
34-
public $idx = 0;
30+
public int $idx = 0;
3531

3632
/** @param Token[] $tokens The array of tokens. */
3733
public function __construct(public array $tokens = [])

src/UtfString.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,33 @@ class UtfString implements ArrayAccess, Stringable
3333
{
3434
/**
3535
* The raw, multi-byte string.
36-
*
37-
* @var string
3836
*/
39-
public $str = '';
37+
public string $str = '';
4038

4139
/**
4240
* The index of current byte.
4341
*
4442
* For ASCII strings, the byte index is equal to the character index.
45-
*
46-
* @var int
4743
*/
48-
public $byteIdx = 0;
44+
public int $byteIdx = 0;
4945

5046
/**
5147
* The index of current character.
5248
*
5349
* For non-ASCII strings, some characters occupy more than one byte and
5450
* the character index will have a lower value than the byte index.
55-
*
56-
* @var int
5751
*/
58-
public $charIdx = 0;
52+
public int $charIdx = 0;
5953

6054
/**
6155
* The length of the string (in bytes).
62-
*
63-
* @var int
6456
*/
65-
public $byteLen = 0;
57+
public int $byteLen = 0;
6658

6759
/**
6860
* The length of the string (in characters).
69-
*
70-
* @var int
7161
*/
72-
public $charLen = 0;
62+
public int $charLen = 0;
7363

7464
/** @param string $str the string */
7565
public function __construct(string $str)

tests/Lexer/TokensListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TokensListTest extends TestCase
1818
*
1919
* @var Token[]
2020
*/
21-
public $tokens;
21+
public array $tokens;
2222

2323
/**
2424
* Test setup.

tests/benchmarks/UtfStringBench.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
class UtfStringBench
1212
{
13-
/** @var string */
14-
private $testContents;
13+
private string $testContents;
1514

1615
/**
1716
* @BeforeMethods("setUp")

0 commit comments

Comments
 (0)