Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/TokensList.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@ class TokensList implements ArrayAccess
{
/**
* The count of tokens.
*
* @var int
*/
public $count = 0;
public int $count = 0;

/**
* The index of the next token to be returned.
*
* @var int
*/
public $idx = 0;
public int $idx = 0;

/** @param Token[] $tokens The array of tokens. */
public function __construct(public array $tokens = [])
Expand Down
20 changes: 5 additions & 15 deletions src/UtfString.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,43 +33,33 @@ class UtfString implements ArrayAccess, Stringable
{
/**
* The raw, multi-byte string.
*
* @var string
*/
public $str = '';
public string $str = '';

/**
* The index of current byte.
*
* For ASCII strings, the byte index is equal to the character index.
*
* @var int
*/
public $byteIdx = 0;
public int $byteIdx = 0;

/**
* The index of current character.
*
* For non-ASCII strings, some characters occupy more than one byte and
* the character index will have a lower value than the byte index.
*
* @var int
*/
public $charIdx = 0;
public int $charIdx = 0;

/**
* The length of the string (in bytes).
*
* @var int
*/
public $byteLen = 0;
public int $byteLen = 0;

/**
* The length of the string (in characters).
*
* @var int
*/
public $charLen = 0;
public int $charLen = 0;

/** @param string $str the string */
public function __construct(string $str)
Expand Down
2 changes: 1 addition & 1 deletion tests/Lexer/TokensListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TokensListTest extends TestCase
*
* @var Token[]
*/
public $tokens;
public array $tokens;

/**
* Test setup.
Expand Down
3 changes: 1 addition & 2 deletions tests/benchmarks/UtfStringBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

class UtfStringBench
{
/** @var string */
private $testContents;
private string $testContents;

/**
* @BeforeMethods("setUp")
Expand Down