I just opened new project and this is class file example:
<?php
namespace AppTest;
class Sky
{
public function __construct(private readonly string $registration, private readonly Airline $airline)
{
}
public function getRegistration(): string
{
return $this->registration;
}
public function getAirline(): Airline
{
return $this->airline;
}
}
And i have errors like:
Method should either have body or be abstract
Using '$this' when not in object context
But when i change constructor to this:
public function __construct(string $registration,Airline $airline)
{
}
then i don’t have errors, does someone knows to explain why? because i think there is some problem that im not aware of