pint
pint copied to clipboard
False syntax error on PHP 8.4 hooks
Pint Version
1.20
PHP Version
8.4.3
Description
Laravel Pint throws a false syntax error when in fact code works.
Steps To Reproduce
PHP Hooks error.
This is a valid php code, but fail on Pint
class Example {
public ?int $intBoolean {
get => $this->booleanValue === null ? null : (int) $this->booleanValue;
}
public function __construct(
public ?boolean $booleanValue
) {}
}
FAIL ............................................................................................................................................. 217 files, 1 error
! Example.php. Parse error: syntax error, unexpected token "public" on line 24.
1▕ class Example {
2▕
3▕ public ?int $intBoolean {
➜ 4▕ get => $this->booleanValue === null ? null : (int) $this->booleanValue;
5▕ }
6▕
7▕ public function __construct(
8▕ public ?boolean $booleanValue
This is a valid code too, but pass.
class Example {
public ?int $intBoolean {
get => ($this->booleanValue === null ? null : (int) $this->booleanValue);
}
public function __construct(
public ?boolean $booleanValue
) {}
}
Pending https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/milestone/173
I don't know if that's enough. However, CS Fixer (v3.75) has published several improvements since then. Dependency upgrades could benefit from this.