Problem/Motivation
Dependent upon database abstraction layer connection configuration the database may return string like integers as strings or as integers. Both are usually later passed through the entity stack without modification.
AccountInterface::id()'s typehint states it returns an integer, but this is not true in many (all?) cases. Weakly typed as PHP is, uids stored on AccountProxy, UserSession, UserInterface may return the uid as a string. This prevents strongly typed comparison, e.g. $currentUser->id() === $ownerIdAsInteger, if one is represented as an integer and the other a string. Or, it will fail strict type enforcement if passed to a method which expects an integer.
Steps to reproduce
Proposed resolution
Classes implementing AccountInterface::id() should ensure they return an integer as documented by the the API.
(Affirmed by Framework Managers see #43 and #44.
Remaining tasks
Framework manager decision on if a class implementing AccountIinterface::id() should:
- Return integers as documented in the API (cast string's returned by the DB layer to int)
- Change the API Spec for AccountInterface::id() to return string
Note:
In both cases we appear to need to add |null as well.
User interface changes
None
API changes
Data model changes
None