From e1774eb20ada48be766b1f1067cd0cb2a57a58c6 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Fri, 10 Apr 2020 15:51:57 +0200 Subject: [PATCH] Document deprecation of untyped DI queries Ref https://github.com/nextcloud/server/pull/19347 Signed-off-by: Christoph Wurst --- developer_manual/app/upgrade-guide.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/developer_manual/app/upgrade-guide.rst b/developer_manual/app/upgrade-guide.rst index ccb3001fd..373bc379d 100644 --- a/developer_manual/app/upgrade-guide.rst +++ b/developer_manual/app/upgrade-guide.rst @@ -42,6 +42,25 @@ Symfony update Symfony was updated to `v4.4 `_. The most important change for apps is to return an int value from CLI commands. Returning null (explicitly or implicitly) won't be allowed in future versions of Symfony. +Deprecation of injection of named services +****************************************** + +Apps had been able to query core services like the implementation of the interface ``\OCP\ITagManager`` as ``TagManager``. To unify the service resolution with type hints for the constructor injection, the named resolution is deprecated, logs warnings and will be removed in the future. Use the fully-qualifier class name (with the `::class` constant) instead: + +If you had + +.. code-block:: php + + $tagManager = \OC::$server->query('TagManager'); + +change your code to + +.. code-block:: php + + $tagManager = \OC::$server->query(\OCP\ITagManager::class); + +On constructor arguments you should always type-hint the service by its interface. If you do so already, nothing changes for you. + New APIs ********