wip: generic State<T>
closes #8
Zkusil jsem naťuknout generický State
, ale ještě to není úúúúplně ono
<?php
final class Foo implements \Grifart\Stateful\Stateful
{
public function _getState(): \Grifart\Stateful\State
{
return \Grifart\Stateful\StateBuilder::from($this)
->version(1)
->build();
}
public static function _fromState(\Grifart\Stateful\State $state): static
{
$obj = $state->makeAnEmptyObject(static::class);
return $obj;
}
}
vyprodukuje
------ -----------------------------------------------------------------------
Line test.php
------ -----------------------------------------------------------------------
6 Return type (Grifart\Stateful\State<static(Foo)>) of method
Foo::_getState() should be compatible with return type
(Grifart\Stateful\State<static(Grifart\Stateful\Stateful)>) of method
Grifart\Stateful\Stateful::_getState()
8 Method Foo::_getState() should return
Grifart\Stateful\State<static(Foo)> but returns
Grifart\Stateful\State<Foo>.
16 Method Foo::_fromState() should return static(Foo) but returns
Grifart\Stateful\Stateful.
------ -----------------------------------------------------------------------
Edited by Jiří Pudil