From 7a39826c8e7e331b0cbf0ead8305962eb68fb80d Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 15 Jan 2024 22:31:35 +0100 Subject: [PATCH 1/3] Add native property types in TokensList Signed-off-by: Kamil Tekiela --- src/TokensList.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/TokensList.php b/src/TokensList.php index dd90bb99..ea41d2b8 100644 --- a/src/TokensList.php +++ b/src/TokensList.php @@ -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 = []) From 18262b3f5d3262792da6126722f9575483a244c0 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 15 Jan 2024 22:50:03 +0100 Subject: [PATCH 2/3] Add native property types in UtfString Signed-off-by: Kamil Tekiela --- src/UtfString.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/UtfString.php b/src/UtfString.php index 84341622..1c23d572 100644 --- a/src/UtfString.php +++ b/src/UtfString.php @@ -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) From fdb885be1aa6d59dec6d98e059ef20577f55f154 Mon Sep 17 00:00:00 2001 From: Kamil Tekiela Date: Mon, 15 Jan 2024 22:51:32 +0100 Subject: [PATCH 3/3] Add native property types in Tests Signed-off-by: Kamil Tekiela --- tests/Lexer/TokensListTest.php | 2 +- tests/benchmarks/UtfStringBench.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/Lexer/TokensListTest.php b/tests/Lexer/TokensListTest.php index 0fa6627a..8df560c4 100644 --- a/tests/Lexer/TokensListTest.php +++ b/tests/Lexer/TokensListTest.php @@ -18,7 +18,7 @@ class TokensListTest extends TestCase * * @var Token[] */ - public $tokens; + public array $tokens; /** * Test setup. diff --git a/tests/benchmarks/UtfStringBench.php b/tests/benchmarks/UtfStringBench.php index f1b8b6ef..f5af4764 100644 --- a/tests/benchmarks/UtfStringBench.php +++ b/tests/benchmarks/UtfStringBench.php @@ -10,8 +10,7 @@ class UtfStringBench { - /** @var string */ - private $testContents; + private string $testContents; /** * @BeforeMethods("setUp")