@@ -14,7 +14,7 @@ trait EntityTrait
1414{
1515 use ObjectTrait;
1616
17- public function __construct (Model $ model , string $ id , ?stdClass $ data = null )
17+ final public function __construct (Model $ model , string $ id , ?stdClass $ data = null )
1818 {
1919 $ this ->model = $ model ;
2020 $ this ->data = $ data ;
@@ -24,7 +24,7 @@ public function __construct(Model $model, string $id, ?stdClass $data = null)
2424 $ this ->data ->id = $ id ;
2525 }
2626
27- public function __set ($ name , $ value ) : void
27+ final public function __set ($ name , $ value ) : void
2828 {
2929 if ($ name === 'id ' ) {
3030 throw new OverridingIdentityOfEntityException ('You can not change the "id" of an entity! ' );
@@ -35,12 +35,12 @@ public function __set($name, $value) : void
3535 $ this ->data ->{$ name } = $ value ;
3636 }
3737
38- public function __unset ($ name )
38+ final public function __unset ($ name )
3939 {
4040 unset($ this ->data ->{$ name });
4141 }
4242
43- public static function createFromJsonFile (string $ jsonFilePath , string $ id ) : EntityInterface
43+ final public static function createFromJsonFile (string $ jsonFilePath , string $ id ) : EntityInterface
4444 {
4545 if (!file_exists ($ jsonFilePath )) {
4646 throw new CouldNotFindJSONSchemaFileException (
@@ -51,17 +51,17 @@ public static function createFromJsonFile(string $jsonFilePath, string $id) : En
5151 return self ::createFromJson ($ json , $ id );
5252 }
5353
54- public static function createFromJson (string $ json , string $ id ) : EntityInterface
54+ final public static function createFromJson (string $ json , string $ id ) : EntityInterface
5555 {
56- return new self (new Model ($ json ), $ id );
56+ return new static (new Model ($ json ), $ id );
5757 }
5858
59- public function entityId () : string
59+ final public function entityId () : string
6060 {
6161 return $ this ->data ->id ;
6262 }
6363
64- public function validatePartially (array $ requiredFields ) : bool
64+ final public function validatePartially (array $ requiredFields ) : bool
6565 {
6666 $ model = $ this ->model ->getModel ();
6767 $ model ->required = $ requiredFields ;
0 commit comments