From a03e6883cdb0335457f688e5e0e7f3ccc7c15802 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 4 Dec 2024 22:45:52 +0000 Subject: [PATCH 1/3] Remove `FilterProviderInterface` This interface is MVC Module Manager specific and does not belong in this library Signed-off-by: George Steel --- src/FilterProviderInterface.php | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 src/FilterProviderInterface.php diff --git a/src/FilterProviderInterface.php b/src/FilterProviderInterface.php deleted file mode 100644 index 72978d28..00000000 --- a/src/FilterProviderInterface.php +++ /dev/null @@ -1,23 +0,0 @@ - Date: Wed, 4 Dec 2024 23:03:17 +0000 Subject: [PATCH 2/3] Amend documentation and migration guide Signed-off-by: George Steel --- .../application-integration/providing-filters-via-modules.md | 4 +++- docs/book/v3/migration/v2-to-v3.md | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/book/v3/application-integration/providing-filters-via-modules.md b/docs/book/v3/application-integration/providing-filters-via-modules.md index d290f54a..f21ce109 100644 --- a/docs/book/v3/application-integration/providing-filters-via-modules.md +++ b/docs/book/v3/application-integration/providing-filters-via-modules.md @@ -1,6 +1,6 @@ # Providing Filters via Modules -If you wish to indicate that your laminas-mvc module provides filters, have your `Module` class implement `Laminas\Filter\FilterProviderInterface`, which defines the method: +If you wish to indicate that your laminas-mvc module provides filters, have your `Module` class implement `Laminas\ModuleManager\Feature\FilterProviderInterface`, which defines the method: ```php /** @@ -11,6 +11,8 @@ public function getFilterConfig(); The method should return an array of configuration following the [laminas-servicemanager configuration format](https://docs.laminas.dev/laminas-servicemanager/configuring-the-service-manager/). +Further information can be found in the [Module Manager documentation](https://docs.laminas.dev/laminas-modulemanager/module-manager/#servicelistener). + If you are not using laminas-mvc, but are using a dependency injection container (e.g., if you are using Mezzio), you can also provide filters using the top-level `filters` configuration key; the value of that key should be laminas-servicemanager configuration, as linked above. (laminas-mvc users may also provide configuration in the same way, and omit implementation of the `FilterProviderInterface`.) diff --git a/docs/book/v3/migration/v2-to-v3.md b/docs/book/v3/migration/v2-to-v3.md index f387777c..2e91465d 100644 --- a/docs/book/v3/migration/v2-to-v3.md +++ b/docs/book/v3/migration/v2-to-v3.md @@ -343,3 +343,8 @@ Various filters such as `StringToLower` and `StringToUpper` inherited from the a This class has been removed and the affected filters no longer inherit from anything. In order to provide consistent handling of the `encoding` option that has been re-implemented in these filters, a new class `EncodingOption` has been introduced which provides static methods to validate a given encoding option. This change is unlikely to affect you, unless you have inherited from this class. In which case, you will need to implement the provision of an encoding option for your custom filter and remove `AbstractUnicode` from your inheritance tree. + +### Removal of the `FilterProviderInterface` + +This legacy interface is related to Laminas MVC Module Manager integration and was superseded by `Laminas\ModuleManager\Feature\FilterProviderInterface`. +If your code still references `Laminas\Filter\FilterProviderInterface`, replace its usage with the interface [shipped by Module Manager](https://docs.laminas.dev/laminas-modulemanager/module-manager/#servicelistener). From a5fd879d73899d601b12c3ebde27e869b7076aa4 Mon Sep 17 00:00:00 2001 From: George Steel Date: Wed, 4 Dec 2024 23:12:29 +0000 Subject: [PATCH 3/3] Remove unnecessary module manager affordances Signed-off-by: George Steel --- psalm-baseline.xml | 11 ----------- src/Module.php | 20 -------------------- 2 files changed, 31 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 5b897219..eb3e2550 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -185,11 +185,6 @@ - - - - - @@ -309,12 +304,6 @@ - - - - - - diff --git a/src/Module.php b/src/Module.php index 4bb95a51..fd965a81 100644 --- a/src/Module.php +++ b/src/Module.php @@ -4,7 +4,6 @@ namespace Laminas\Filter; -use Laminas\ModuleManager\ModuleManager; use Laminas\ServiceManager\ServiceManager; /** @@ -25,23 +24,4 @@ public function getConfig(): array 'service_manager' => $provider->getDependencyConfig(), ]; } - - /** - * Register a specification for the FilterManager with the ServiceListener. - * - * @param ModuleManager $moduleManager - */ - public function init($moduleManager): void - { - $event = $moduleManager->getEvent(); - $container = $event->getParam('ServiceManager'); - $serviceListener = $container->get('ServiceListener'); - - $serviceListener->addServiceManager( - 'FilterManager', - 'filters', - FilterProviderInterface::class, - 'getFilterConfig' - ); - } }