Notes on converting apps from Horde 5 to Horde 6

These are by far not complete.

General

[Unnamespaced code still needs Horde_Autoloader's slightly different approach than composer's autoloader]

Exceptions to the rule

Mandatory

Optional / Best Practice

Exceptions To The Rule

Namespaces and dir layout

Mandatory

- Horde\$Name\$Name
- Horde\$Name\$NameInterface
- Horde\$Name\Base
- Horde\$Name\Constants
- In case of base classes, re-think if we are not better off with an interface and some trait

Optional

Exceptions to the rule

PHPDoc / Type Hints / Type Declarations

Remember Liskov:

Mandatory

Optional

Exceptions to the rule

GLOBALS usage

Whitelist

Mandatory

Optional

Exceptions to the rule

DI / Injector and Constructors

As Horde has evolved over the years, we have different types of classes, sometimes even mixed.

Mandatory

       // Use a factory to get an implementation
       // In case the factory cannot be autowired itself, you need to register how to get it first.
       $injector->bindFactory(Horde\Kronolith\Calendar\Resource::class, Horde\Kronolith\Calendar\Factory::class, 'create') 
       // In case you want a specific implementation and it can be autowired, just bind it.
       $injector->bindImplementation(Horde\Kronolith\Renderer::class, Horde\Kronolith\Renderer\Default::class); 

       use Horde\Kronolith\Calendar\Resource;
       use Horde\Kronolith\Calendar\Factory as CalendarFactory;
       use Horde\Kronolith\Renderer;
       use Horde\Kronolith\Renderer\Default as RendererDefault;
       // Use a factory to get an implementation
       // In case the factory cannot be autowired itself, you need to register how to get it first.
       $injector->bindFactory(Resource::class, CalendarFactory::class, 'create') 
       // In case you want a specific implementation and it can be autowired, just bind it.
       $injector->bindImplementation(Renderer::class, RendererDefault::class); 

       $injector->bindImplementation('Forms', '\Horde_Forms_Base'); 

Optional

Exceptions to the rule

reqire/require_once, Horde\Autoloader and Composer Autoloader

Required

Optional

UNCLEAR

package specific notes

Horde\Injector

Optional

Horde\Date

Optional

* Horde\Date use cases should generally be checked for timezone mismatches e.g. when converting UTC strings from database
* There is some headache potential with Horde\Db implicitly using Horde\Date without timezone information when SELECTing datetime values.
* This is especially annoying with Horde\Rdo
* Horde\Date constructor should always require an explicit timezone and current time
* Provide convenience static methods for "fromThisFormat()", "fromThatFormat()" to keep that complexity out of the value object

Horde\Core

Mandatory:

Optional:

Horde\Rpc

Mandatory:

Optional:
* Default to JsonRpc rather than XmlRpc
* Refactor to controller framework

Library Upgrade strategy (pre release)

Apart from mandatory changes, we should not currently port all horde to the new standard quickly.

Mandatory

Optional

Exception to the rule

App Upgrade Strategy (pre release)

Required

Optional