Skip to content
Discussion options

You must be logged in to vote

This should work, added a test to check it:

/** @test */
public function it_can_inherit_properties_from_a_base_class()
{
$dataClass = new class('') extends SimpleData{
public int $int;
};
$data = $dataClass::from(['string' => 'Hi', 'int' => 42]);
$this->assertEquals('Hi', $data->string);
$this->assertEquals(42, $data->int);
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@msnegurski
Comment options

@msnegurski
Comment options

Answer selected by msnegurski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants