[code]
public function foo(Foo|Bar $input): int|float;
public function foo(Foo|null $foo): void;
public function bar(?Bar $bar): void;
$dateAsString = $booking->getStartDate()?->asDateTimeString();
class CustomerData
{
public function __construct(
public string $name,
public string $email,
public int $age,
) {}
}
$data = new CustomerData(
name: $input['name'],use App\Attributes\ExampleAttribute;
#[ExampleAttribute]
class Foo
{
#[ExampleAttribute]
public const FOO = 'foo';
#[ExampleAttribute]
public $x;
#[ExampleAttribute]
public function foo(#[ExampleAttribute] $bar) { }
}
email: $input['email'],
age: $input['age'],
);
$result = match($input) {
0 => "hello",
'1', '2', '3' => "world",
};
class Money
{
public function __construct(
public Currency $currency,
public int $amount,
) {}
}
class Foo
{
public function test(): static
{
return new static();
}
}
$triggerError = fn () => throw new MyError();
$foo = $bar['offset'] ?? throw new OffsetDoesNotExist('offset');
class Foo
{
private WeakMap $cache;
public function getSomethingWithCaching(object $obj): object
{
return $this->cache[$obj]
??= $this->computeSomethingExpensive($obj);
}
}
$foo = new Foo();
var_dump($foo::class);
try {
// Something goes wrong
} catch (MySpecialException) {
Log::error("Something went wrong");
}
DateTime::createFromInterface(DateTimeInterface $other);
DateTimeImmutable::createFromInterface(DateTimeInterface $other);
[/code]
AND SO ON.
IT IS ABOUT PHP 8 (eight), not 7.
YOU have to develop new internal parser for this version (PHP
that will support all php features 1:1, YOU have to update CodeInsight, docs, php standard definitions, debugger, refresh all the libraries depend on.