From 1e82641fae2405e322ddbd7e3bfb2bb37484fa37 Mon Sep 17 00:00:00 2001 From: "tien.xuan.vo" Date: Fri, 20 Dec 2024 06:35:08 +0700 Subject: [PATCH] fix: Fix PHPStan no error to ignore --- composer.json | 2 +- src/PhpPact/FFI/Model/ArrayData.php | 2 +- tests/PhpPact/FFI/Model/ArrayDataTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 5e00c575..b92a0b7e 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "ext-sockets": "*", "roave/security-advisories": "dev-latest", "friendsofphp/php-cs-fixer": "^3.0", - "phpstan/phpstan": "^2.0", + "phpstan/phpstan": "^2.0.4", "phpunit/phpunit": "^10.1.0|^11.0", "guzzlehttp/guzzle": "^7.8", "behat/behat": "^3.13", diff --git a/src/PhpPact/FFI/Model/ArrayData.php b/src/PhpPact/FFI/Model/ArrayData.php index 06632509..4058445d 100644 --- a/src/PhpPact/FFI/Model/ArrayData.php +++ b/src/PhpPact/FFI/Model/ArrayData.php @@ -47,7 +47,7 @@ public static function createFrom(array $values): ?self throw new CDataNotCreatedException(); } FFI::memcpy($item, $value, $length); - $items[$index++] = $item; // @phpstan-ignore-line + $items[$index++] = $item; } return new self($items, $size); diff --git a/tests/PhpPact/FFI/Model/ArrayDataTest.php b/tests/PhpPact/FFI/Model/ArrayDataTest.php index 4cf15547..8d860a92 100644 --- a/tests/PhpPact/FFI/Model/ArrayDataTest.php +++ b/tests/PhpPact/FFI/Model/ArrayDataTest.php @@ -20,7 +20,7 @@ public function testCreateFromArray(): void $this->assertInstanceOf(ArrayData::class, $arrayData); $this->assertSame(count($branches), $arrayData->getSize()); foreach ($branches as $index => $branch) { - // @phpstan-ignore offsetAccess.nonOffsetAccessible,argument.type + // @phpstan-ignore argument.type $this->assertSame($branch, FFI::string($arrayData->getItems()[$index])); } }