schmittjoh/JMSSerializerBundle — pull request #191 by schmittjoh (2012-10-08 10:38:43+00:00)
Title: [WIP] Refactoring of Internals

This is still a work in progress which also includes the changes outlined in #190 (both a) and c)).

Let me outline the major changes real quick:

### 1. Types become more powerful

Types are not simple strings anymore (as far as internals are concerned).

They now consist of a type name, and optional type parameters which can be used to further specify how it is processed. Until now, this was already done for "array" by allowing "array" for example, but this was not cached, and had to be re-parsed on every access. Now, this syntax is automatically available to all types, and we cache the parsed type.

This should allow to make for example Date types for flexible (ref #134):
``@Type("Date<'Y-m-d'>")``, ``@Type("DateTime<'Y-m-d H:i:sT'>")``, etc.

### 2. Handlers become more efficient

Handlers must be registered for a specific combination now (see #190).

### 3. Special Handling for Traversables is gone

This caused some problems, and prevented any class from implementing Traversable, and still being treated as a regular class.

It could be restored by adding a Traversable handler, and forcing the type to be Traversable by explicitly specifying a type for the property (``@Type("Traversable")``) if we deem that necessary.

-------

Areas where I could still use feedback are the way how we register handlers (https://github.com/schmittjoh/JMSSerializerBundle/pull/new/internalRefactoring#L6R183 and https://github.com/schmittjoh/JMSSerializerBundle/pull/new/internalRefactoring#L21R34).