Repository navigation
fix(rules): stop false ForbiddenPropertyType on Uid, Embeddable VO and shared Enum / убрать ложные срабатывания сниффера VO - #137
Merged
Conversation
…d shared Enum / убрать ложные ForbiddenPropertyType на Uid, Embeddable VO и общих Enum
ValueObjectStructureSniff was stricter than the convention in three places,
found by auditing the consumer project TasK (27 of 41 ForbiddenPropertyType
were false positives):
- Symfony\Component\Uid\Uuid was not in the vendor allowlist (only Ramsey\Uuid),
although the convention allows Uuid and its own examples use Symfony Uid;
- Embeddable VO in Domain\Entity\ValueObject\ were rejected because the group
was taken as the first segment after the layer (Entity). The group is now
the last category segment before the class name, so
Domain\Entity\ValueObject\XVo resolves to valueobject while
Domain\Entity\XModel still resolves to entity;
- module-independent types in {Project}\Common\Enum, {Project}\Common\Component
and {Project}\Common\ValueObject were rejected for lacking a Module segment,
although enum.md allows shared enums there.
Honest violations (ORM models, Domain\Service, other layers and modules)
are preserved; on TasK ForbiddenPropertyType drops from 41 to 14, all genuine.
Refs: TASK-fix-vo-sniff-dependency-false-positives
… явно описать разрешённые и запрещённые зависимости VO Make the Dependencies section explicit: Uuid of any implementation, shared (module-independent) Enum/VO under Common\, Embeddable VO of the module are allowed; Entity models, Domain\Service, other modules and layers (including Infrastructure VO -> Domain types) are forbidden. Review checklist updated. Refs: TASK-fix-vo-sniff-dependency-false-positives
…вление ложных срабатываний сниффера VO
…ew / указать PR и перевести задачу в review
… / не привязывать Uuid к реализации в зависимостях Do not name concrete Uid implementations in the convention — which one to use is debatable and belongs to the project. The sniff allows both known implementations, the convention stays as it was: Uuid. Refs: TASK-fix-vo-sniff-dependency-false-positives
…имость VO от Embeddable VO Embeddable VO (Domain\Entity\ValueObject\…) are a persistence part of the entity: they carry Doctrine mapping attributes and are not domain types. A domain VO depending on them violates "no ORM/DB dependencies" transitively (the consumer project TasK uses such embeddables from Application mappers, service interfaces and command handlers). The previous commit of this task briefly allowed them by resolving the group as the last category segment; that conflated "where to place" with "what to inject". Now any `entity` segment in the dependency path makes the type forbidden, while nested ValueObject groups (Domain\ValueObject\Group\…Vo) and same-layer enums stay allowed. Fixtures cover both. BREAKING CHANGE: VO properties typed with Embeddable VO now fail phpcs with ForbiddenPropertyType. Refs: TASK-fix-vo-sniff-dependency-false-positives
…ть Embeddable VO как зависимости VO Explain in the Dependencies section why embeddables are not domain types (they carry ORM mapping and belong to their entity) and that other VO must not depend on them; the Location section now states embeddables are used only inside entity models. Review checklist updated. Refs: TASK-fix-vo-sniff-dependency-false-positives
…ровать решение по Embeddable в задаче
…ble reuse across entities / сделать список запретов неисчерпывающим, разрешить переиспользование Embeddable в сущностях Per review: enumerating examples next to "forbidden" implies everything not listed is allowed — the sentence now states the list is non-exhaustive and only what is listed as allowed is permitted. Removed the over-restrictive "only inside its own entity": embeddables may be reused by other entities of the domain; they just are not a dependency for VO. Checklist aligned. Refs: TASK-fix-vo-sniff-dependency-false-positives
… / убрать ссылку на снифф и лишние уточнения Per review: a convention must not know about the code that validates it — the sniff implements the convention, not the other way around. Removed the "classified by namespace" sentence, the non-exhaustive-list remark and the parenthetical examples; the checklist item now simply refers to the section. Refs: TASK-fix-vo-sniff-dependency-false-positives
…/ перенести определение Embeddable VO в конвенцию сущности Per review: what an Embeddable VO *is* (a persistence part of the entity, not a domain type) belongs to the Entity convention, not to the VO location list. The VO convention now only references the Entity convention for the rationale and keeps the placement rule; Entity gains the definition (ORM mapping, used inside entity models, reusable across entities of the domain) and a checklist item. Refs: TASK-fix-vo-sniff-dependency-false-positives
…равило про Embeddable VO под стиль документации Refs: TASK-fix-vo-sniff-dependency-false-positives
… о ложных срабатываниях сниффера VO
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TASK-fix-vo-sniff-dependency-false-positives
Аудит
ValueObjectStructureSniff(после #136) на проекте-потребителе TasK выявил, что сниффер строже конвенции в трёх местах: 27 из 41ForbiddenPropertyType— ложные срабатывания.Что исправлено
Symfony\Component\Uid\Uuid(22)Ramsey\Uuid, хотя конвенция разрешаетUuidи её примеры сами используют Symfony Uidsymfony\component\uid\Domain\Entity\ValueObject\(2)Entity→ запрет, хотя конвенция такое размещение разрешает…\Entity\ValueObject\XVo→valueobject,…\Entity\XModel→entity{Project}\Common\…(3)Module-сегмента → запрет, хотяenum.mdразрешает общие Enum вCommon\EnumCommon\{Enum|Component|ValueObject}\…безModuleЧестные нарушения сохранены: ORM-модели,
Domain\Service, другие слои и модули.Конвенция
value-object.mdРаздел «Зависимости» теперь явно перечисляет разрешённое (Uuid любой реализации, общие, Embeddable) и запрещённое (Entity/Service, другие модули и слои — включая Infrastructure-VO → Domain, что раньше следовало лишь косвенно). Чек-лист ревью обновлён.
Проверки
Common\Enum,Common\Component\…Enum, Embeddable VOcomposer checkзелёныйForbiddenPropertyType41 → 14 (все честные),NonPrivateProperty138 без измененийRefs: TASK-fix-vo-sniff-dependency-false-positives