From a58db4b5d70c7f7846f035bd32dbe045a0dc3106 Mon Sep 17 00:00:00 2001 From: Josha von Gizycki Date: Thu, 8 Oct 2026 23:21:21 +0200 Subject: [PATCH] remove dead code and fix linting errors --- src/Analyze/EntityAnalyzer.php | 3 ++- src/Sql/DataToEntityMapper.php | 34 ---------------------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/Analyze/EntityAnalyzer.php b/src/Analyze/EntityAnalyzer.php index 22394d4..d40844a 100644 --- a/src/Analyze/EntityAnalyzer.php +++ b/src/Analyze/EntityAnalyzer.php @@ -85,7 +85,7 @@ readonly class EntityAnalyzer $idFields = array_filter($fields, static fn(EntityField $f) => $f->isIdField); $nrIdFields = count($idFields); - if ($nrIdFields !== 1) { + if ($nrIdFields === 0 || $nrIdFields > 1) { throw new InvalidEntity( "Invalid number of id fields on entity $this->entity found: $nrIdFields, expected: 1" ); @@ -109,6 +109,7 @@ readonly class EntityAnalyzer $name = $param->getName(); } + /** @var ReflectionClass $refClass */ $refClass = $param->getDeclaringClass(); $readAccess = $this->readAccess($refClass, $param); diff --git a/src/Sql/DataToEntityMapper.php b/src/Sql/DataToEntityMapper.php index b611ab1..d90c789 100644 --- a/src/Sql/DataToEntityMapper.php +++ b/src/Sql/DataToEntityMapper.php @@ -36,38 +36,4 @@ readonly class DataToEntityMapper /** @var E */ return new $this->entityResult->classFqcn(...$params); } - - /** - * @param E $entity - * @param EntityField $field - * @param object $value - */ - private function getsetWrite(object $entity, EntityField $field, mixed $value): void - { - $setter = FieldAccess::setterName($field->name); - $entity->$setter($value); - } - - /** - * @param E $entity - * @param EntityField $field - * @param object $value - */ - private function publicWrite(object $entity, EntityField $field, mixed $value): void - { - $entity->{$field->name} = $value; - } - - /** - * @param E $entity - * @param EntityField $field - * @param object $value - * @return E - */ - private function witherWrite(object $entity, EntityField $field, mixed $value): object - { - $wither = FieldAccess::witherName($field->name); - /** @var E */ - return $entity->$wither($value); - } }