Skip to content

Commit

Permalink
ReflectionFunctionAbstract
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubmisek committed Apr 26, 2019
1 parent a153fbb commit 4b065a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ private protected bool ResolveReturnType(out Type type, out bool notNullFlag)
var m = _routine.Methods[0];

type = m.ReturnType;
notNullFlag = m.ReturnTypeCustomAttributes.IsDefined(typeof(NotNullAttribute), false);
notNullFlag =
m.ReturnTypeCustomAttributes.IsDefined(typeof(NotNullAttribute), false) ||
m.ReturnTypeCustomAttributes.IsDefined(typeof(CastToFalse), false); // [return: CastToFalse] => NULL cannot be returned

//
return type != typeof(PhpValue) && type != typeof(PhpAlias); // dunno
Expand Down
2 changes: 2 additions & 0 deletions src/Peachpie.Runtime/Reflection/ReflectionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public static bool IsPhpClassType(TypeInfo tinfo)
/// </summary>
public static bool IsNullable(this ParameterInfo p)
{
Debug.Assert(typeof(PhpArray).IsValueType == false); // see TODO below

if (p.ParameterType.IsValueType &&
p.ParameterType != typeof(PhpValue) &&
//p.ParameterType != typeof(PhpArray) // TODO: uncomment when PhpArray will be struct
Expand Down

0 comments on commit 4b065a7

Please # to comment.