Skip to content

Commit

Permalink
chore: update phpdoc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk committed Jul 24, 2024
1 parent 20c4006 commit 4d1183b
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
abstract class ActiveRecord
{
/**
* Creates a new entity instance with the given data.
* Create a new entity instance with the given data.
* It is preferable to use this method instead of the constructor because
* it uses ORM services to create the entity.
*
Expand All @@ -42,15 +42,15 @@ public static function make(array $data): static
}

/**
* Finds a single record based on the given primary key.
* Find a single record based on the given primary key.
*/
final public static function findByPK(mixed $primaryKey): ?static
{
return static::query()->wherePK($primaryKey)->fetchOne();
}

/**
* Finds the first single record based on the given scope.
* Find the first single record based on the given scope.
*
* @note Limit of 1 will be added to the query.
*/
Expand All @@ -60,7 +60,7 @@ final public static function findOne(array $scope = []): ?static
}

/**
* Finds all records based on the given scope.
* Find all records based on the given scope.
*
* @return iterable<static>
*/
Expand All @@ -70,7 +70,7 @@ final public static function findAll(array $scope = []): iterable
}

/**
* Returns a ActiveQuery query builder for the extending entity class.
* Get an ActiveQuery instance for the entity.
*
* @return ActiveQuery<static>
*/
Expand All @@ -85,7 +85,7 @@ public static function getRepository(): RepositoryInterface
}

/**
* Persists the current entity.
* Persist the entity.
*
* @throws \Throwable
*/
Expand All @@ -99,7 +99,7 @@ final public function save(bool $cascade = true): StateInterface
}

/**
* Persists the current entity and throws an exception if an error occurs.
* Persist the entity and throw an exception if an error occurs.
*
* @throws \Throwable
*/
Expand All @@ -112,12 +112,19 @@ final public function saveOrFail(bool $cascade = true): StateInterface
return $entityManager->run();
}

/**
* Prepare the entity for persistence.
*
* @note This function is experimental and may be removed in the future.
*/
final public function persist(bool $cascade = true): EntityManagerInterface

Check warning on line 120 in src/ActiveRecord.php

View workflow job for this annotation

GitHub Actions / mutation-testing (ubuntu-latest, 8.2, locked)

Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * * @note This function is experimental and may be removed in the future. */ - public final function persist(bool $cascade = true) : EntityManagerInterface + public final function persist(bool $cascade = false) : EntityManagerInterface { return Facade::getEntityManager()->persist($this, $cascade); }
{
return Facade::getEntityManager()->persist($this, $cascade);
}

/**
* Delete the entity.
*
* @throws \Throwable
*/
final public function delete(bool $cascade = true): StateInterface

Check warning on line 130 in src/ActiveRecord.php

View workflow job for this annotation

GitHub Actions / mutation-testing (ubuntu-latest, 8.2, locked)

Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * * @throws \Throwable */ - public final function delete(bool $cascade = true) : StateInterface + public final function delete(bool $cascade = false) : StateInterface { /** @var EntityManager $entityManager */ $entityManager = Facade::getEntityManager();
Expand All @@ -130,6 +137,8 @@ final public function delete(bool $cascade = true): StateInterface
}

/**
* Delete the entity and throw an exception if an error occurs.
*
* @throws \Throwable
*/
final public function deleteOrFail(bool $cascade = true): StateInterface
Expand All @@ -142,7 +151,9 @@ final public function deleteOrFail(bool $cascade = true): StateInterface
}

/**
* Prepares the current entity for deletion.
* Prepare the entity for deletion.
*
* @note This function is experimental and may be removed in the future.
*/
final public function remove(bool $cascade = true): EntityManagerInterface

Check warning on line 158 in src/ActiveRecord.php

View workflow job for this annotation

GitHub Actions / mutation-testing (ubuntu-latest, 8.2, locked)

Escaped Mutant for Mutator "TrueValue": --- Original +++ New @@ @@ * * @note This function is experimental and may be removed in the future. */ - public final function remove(bool $cascade = true) : EntityManagerInterface + public final function remove(bool $cascade = false) : EntityManagerInterface { /** @var EntityManager $entityManager */ $entityManager = Facade::getEntityManager();
{
Expand Down

0 comments on commit 4d1183b

Please sign in to comment.