public void AssertTypeDeclared <T>() { if (!_types.IsDeclared(TypeInfoHolder <T> .TypeInfo)) { // TODO: autoload, ErrCode } }
/// <summary> /// Called by runtime when it expects that given type is declared. /// If not, autoload is invoked and if the type mismatches or cannot be declared, an exception is thrown. /// </summary> /// <typeparam name="T">Type which is expected to be declared.</typeparam> public void ExpectTypeDeclared <T>() { var tinfo = TypeInfoHolder <T> .TypeInfo; if (!_types.IsDeclared(tinfo)) { // perform regular load with autoload if (GetDeclaredTypeOrThrow(tinfo.Name, true) != tinfo) { throw new InvalidOperationException(); } } }
/// <summary> /// Checks the user type is declared in the current state of <see cref="Context"/>. /// </summary> /// <param name="phptype">PHP type runtime information. Must not be <c>null</c>.</param> /// <returns>True if the type has been declared on the current <see cref="Context"/>.</returns> internal bool IsUserTypeDeclared(PhpTypeInfo phptype) => _types.IsDeclared(phptype);