Skip to content

ReflectionMethod::hasReturnType() is true for an internal method whose return type is only tentative #563

Closed

Description

@blacktrs

Summary

ReflectionMethod::hasReturnType() is true for an internal method whose return type is only tentative.

Repro

<?php
$m = new ReflectionMethod(Countable::class, 'count');
var_dump($m->hasReturnType(), $m->hasTentativeReturnType());
$m = new ReflectionMethod(ArrayAccess::class, 'offsetGet');
var_dump($m->hasReturnType(), $m->hasTentativeReturnType());

Expected (php)

bool(false)
bool(true)
bool(false)
bool(true)

Actual (manticore 532ac414, Darwin arm64)

bool(true)
bool(false)
bool(true)
bool(false)

Tracking

Known-bug repro: tests/aot/repro/wrong/reflection_tentative_return_type.php — bash tests/aot/xfail.sh -k reflection_tentative_return_type reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.

Activity

  1. added
    bug
    wrong-answer
    on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugwrong-answer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions