Skip to content

Commit

Permalink
Merge pull request #531 from kamil-tekiela/types-in-other-classes
Browse files Browse the repository at this point in the history
Add native property types in other classes
  • Loading branch information
MauricioFauth committed Jan 16, 2024
2 parents d7f485c + fdb885b commit 2e71e97
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
8 changes: 2 additions & 6 deletions src/TokensList.php
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
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
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
Expand Up @@ -10,8 +10,7 @@

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

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

0 comments on commit 2e71e97

Please sign in to comment.