mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-08 01:14:34 +02:00
Applied rector suggestions
This commit is contained in:
parent
4106bcef5f
commit
20f32c7f12
170 changed files with 808 additions and 761 deletions
|
@ -30,6 +30,7 @@ use Doctrine\ORM\Mapping\ClassMetadata;
|
|||
/**
|
||||
* @template TEntityClass of AttachmentContainingDBElement
|
||||
* @extends NamedDBElementRepository<TEntityClass>
|
||||
* @see \App\Tests\Repository\AttachmentContainingDBElementRepositoryTest
|
||||
*/
|
||||
class AttachmentContainingDBElementRepository extends NamedDBElementRepository
|
||||
{
|
||||
|
|
|
@ -49,6 +49,7 @@ use ReflectionClass;
|
|||
/**
|
||||
* @template TEntityClass of AbstractDBElement
|
||||
* @extends EntityRepository<TEntityClass>
|
||||
* @see \App\Tests\Repository\DBElementRepositoryTest
|
||||
*/
|
||||
class DBElementRepository extends EntityRepository
|
||||
{
|
||||
|
@ -143,9 +144,7 @@ class DBElementRepository extends EntityRepository
|
|||
*/
|
||||
protected function sortResultArrayByIDArray(array &$result_array, array $ids): void
|
||||
{
|
||||
usort($result_array, static function (AbstractDBElement $a, AbstractDBElement $b) use ($ids) {
|
||||
return array_search($a->getID(), $ids, true) <=> array_search($b->getID(), $ids, true);
|
||||
});
|
||||
usort($result_array, static fn(AbstractDBElement $a, AbstractDBElement $b) => array_search($a->getID(), $ids, true) <=> array_search($b->getID(), $ids, true));
|
||||
}
|
||||
|
||||
protected function setField(AbstractDBElement $element, string $field, int $new_value): void
|
||||
|
|
|
@ -29,6 +29,7 @@ use App\Helpers\Trees\TreeViewNode;
|
|||
/**
|
||||
* @template TEntityClass of AbstractNamedDBElement
|
||||
* @extends DBElementRepository<TEntityClass>
|
||||
* @see \App\Tests\Repository\NamedDBElementRepositoryTest
|
||||
*/
|
||||
class NamedDBElementRepository extends DBElementRepository
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ class StructuralDBElementRepository extends AttachmentContainingDBElementReposit
|
|||
$qb->select('e')
|
||||
->orderBy('NATSORT(e.name)', $nameOrdering);
|
||||
|
||||
if ($parent) {
|
||||
if ($parent !== null) {
|
||||
$qb->where('e.parent = :parent')
|
||||
->setParameter('parent', $parent);
|
||||
} else {
|
||||
|
@ -260,7 +260,7 @@ class StructuralDBElementRepository extends AttachmentContainingDBElementReposit
|
|||
|
||||
//Try to find if we already have an element cached for this name
|
||||
$entity = $this->getNewEntityFromCache($name, null);
|
||||
if ($entity) {
|
||||
if ($entity !== null) {
|
||||
return $entity;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ use Symfony\Component\Security\Core\User\UserInterface;
|
|||
* @method User[] findAll()
|
||||
* @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||
* @extends NamedDBElementRepository<User>
|
||||
* @see \App\Tests\Repository\UserRepositoryTest
|
||||
*/
|
||||
final class UserRepository extends NamedDBElementRepository implements PasswordUpgraderInterface
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue