The typehint is wrong. It should either be the ClassMetadata interface from Common or ClassMetadataInfo (which implements all the logic in the ORM and is the parent of ClassMetadata for BC reasons)