You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The package operates correctly, and I am confident that the $segmentId variable is a string. However, after modifying the assertIsString assertion to use a named parameter:
Hello,
I've encountered a type inference issue when using PHPStan with PHPUnit assertions on a piece of code that utilizes named parameters.
Given the following code snippet:
$data = $this->requestAndGetData(method: 'segment.create', parameters: [ 'name' => 'Test segment' ]);
self::assertArrayHasKey(key: 'id', array: $data['result']['data']);
self::assertIsString($data['result']['data']['id']);
$segmentId = $data['result']['data']['id'];
$segmentUuid = Symfony\Component\Uid\Uuid::fromString(uuid: $segmentId);
The package operates correctly, and I am confident that the $segmentId variable is a string. However, after modifying the assertIsString assertion to use a named parameter:
self::assertIsString(actual: $data['result']['data']['id']);
I start receiving the following error from PHPStan:
Parameter $uuid of static method Symfony\Component\Uid\Uuid::fromString() expects string, mixed given.
This issue does not occur when the named parameter is not used in the assertion.
Thank you for your time and assistance.
The text was updated successfully, but these errors were encountered: