Open
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
Library version | v2.10.0 |
<?php
namespace App\Traits;
use Vinkla\Hashids\Facades\Hashids;
/**
* Trait to decode id value
*/
trait CodeDecodeId
{
private string|int $id;
/**
* Set property id to use in methods inside class
*/
public function setId(string|int $id): void
{
if (env('USE_HASH', true)) {
$this->id = (int) Hashids::connection('main')->decodeHex($id);
} else {
$this->id = (int) $id;
}
}
}
I am using the following code for an integer ID to hash conversion. When validating the error Parameter type tip: CodeDecodeId.php:12: Non-parsable php code: syntax error or wrong phpdocs.
, I have already looked for several solutions to get around this error, but nothing I have done so far has resolved , this occurs in other classes also whether with a simple or compound parameter.
At the moment I have this validation disabled to be able to follow the project, but it would be very interesting to be able to check the typing.
This happens with ParameterTypeHint, PropertyTypeHint.
Laravel: 10.1.0
PHP: 8.2.12
Metadata
Metadata
Assignees
Labels
No labels