stitcher.io
stitcher.io copied to clipboard
Promoted properties are allowed in abstract class c-tor as long as c-tor itself is not abstract
https://github.com/brendt/stitcher.io/blob/2bb72fff42166013fc60705d8b82d13432c90021/src/content/blog/2020-06-12-constructor-promotion.md?plain=1#L245
Having body in an abstract method is not allowed.
So this:
abstract class A
{
abstract public function __construct(
public string $a,
) {}
}
Should be this:
abstract class A
{
abstract public function __construct(
public string $a,
);
}
But this is allowed:
abstract class A
{
public function __construct(
public string $a,
) {}
}
Was looking around the Internet if I can do more with promoted properties that I'm already using and stumbled upon your article.