v3.0: fix incomplete interfaces, add new interfaces, keep final classes, reduce bypass-finals usage#1575
Conversation
Migrate configuration from XML to PHP
Deprecate Annotation namespace in favor of Attribute namespace
⬆️ allow Symfony 8
…UploadableField (#1564)
…nd readonly class" error
fix the "Non-readonly class PHPUnit\Metadata\DataProvider cannot exte…
update directory_namer service id in doc
|
@copilot the php-cs-fixer failure is due to an upgrade in their rules. Please take it into account and propose a fix for it (it should be straightforward, just take the generated diff and apply it to the codebase) |
…global registration, update UPGRADE.md Co-authored-by: garak <179866+garak@users.noreply.github.com>
|
@copilot we want to use final classes as much as possible, because we want the extension points to be in the interfaces instead. Another purpose is to avoid relying on the bypass-finals library in testing. |
Co-authored-by: garak <179866+garak@users.noreply.github.com>
Applied in 3da41e4 — two closures in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…eader, AttributeReader and restore final keyword - Create PropertyMappingInterface, PropertyMappingFactoryInterface, MetadataReaderInterface, AttributeReaderInterface - Restore final keyword to PropertyMapping, PropertyMappingFactory, MetadataReader, AttributeReader - Update all src/ consumers to use interface type hints - Update all tests to mock interfaces instead of concrete classes Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ngFactoryInterface, MetadataReaderInterface, AttributeReaderInterface Co-authored-by: garak <179866+garak@users.noreply.github.com>
Restored
All 337 tests pass; no bypass-finals needed except the existing Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot this PR should target the 3.x branch |
Changing a PR's base branch is outside my capabilities — I cannot make GitHub API calls to update PR settings. Could you retarget this PR to |
|
@copilot please resolve conflicts. If you can't, please close this PR and open another one with the same purpose, but targeting branch 3.x instead |
…ntributions Co-authored-by: garak <179866+garak@users.noreply.github.com>
|
@copilot we still have some conflicts |
…Exception imports from 3.x Co-authored-by: garak <179866+garak@users.noreply.github.com>
Resolved in commit
Two small conflicts remain at merge time due to both branches independently modifying the same lines since the common ancestor (UPGRADE.md header and |
Improvement
Summary
Ensures v3.0 interfaces are complete and consistent with their implementations, introduces
UploadHandlerInterfaceand additional service interfaces, keeps all internal classesfinal(using interfaces as the extension points), and removes the globaldg/bypass-finalsregistration so tests no longer require it. This PR targets the3.xbranch and has been rebased onto it.Interface fixes
NamerInterface::name()parameter type corrected fromobjecttoobject|array— all built-in namers already usedobject|array; the interface was lagging behind (BC break for custom namer implementors, documented inUPGRADE.md)PropertyMappingResolverInterface::resolve()andPropertyMappingResolver::resolve()return type changed fromPropertyMappingtoPropertyMappingInterfaceNew interfaces
UploadHandlerInterfaceadded withupload(),inject(),clean(),remove()—UploadHandlerimplements it;BaseListener,VichFileType,VichImageType, and the DI config now type-hint the interfacePropertyMappingInterfaceadded — exposes the full public API ofPropertyMapping; used by namers, storage classes, handlers, events, and injectorsPropertyMappingFactoryInterfaceadded — exposesfromObject(),fromField(),fromFirstField(); used by handlers, form types, and storageMetadataReaderInterfaceadded — exposesisUploadable(),getUploadableClasses(),getUploadableFields(),getUploadableField(); used by listeners, commands, cache warmer, and data collectorTestability / bypass-finals
PropertyMapping,PropertyMappingFactory,MetadataReader, andAttributeReaderremainfinal— extension points are provided through the new interfaces aboveBypassFinalExtensionremoved fromphpunit.xml.dist;dg/bypass-finalskept inrequire-devand enabled selectively only where needed for third-partyfinalclasses with no interfaceStorageTestCaseandUploadHandlerTestmigrated toPropertyMappingFactoryInterfacemock;DownloadHandlerTestmigrated toPropertyMappingFactoryInterfacemockUPGRADE.md
Enhanced with a focused v2.9 → v3.0 section; older notes kept and also referenced via the 2.x branch link:
Documents removed deprecations (
Annotationnamespace,AnnotationInterface,*Annotation()reader methods) and all BC breaks introduced by this branch, includingNamerInterfacesignature change, newUploadHandlerInterface, and newPropertyMappingResolverInterface.docs
docs/namers.md: updated directory namer example to use FQCN (Vich\UploaderBundle\Naming\ConfigurableDirectoryNamer) instead of the legacy service aliasCode style
$thisupdated tostatic fnto comply with updated php-cs-fixer rules.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.