Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[VarDumper] Fix return type and anonymous classes dumping #16291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 20, 2015

Conversation

nicolas-grekas
Copy link
Member

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

I missed that getReturnType returns a ReflectionType instance that should be casted to string.

@stof
Copy link
Member

stof commented Oct 19, 2015

I suggest adding a test covering this for PHP 7+

@nicolas-grekas
Copy link
Member Author

test added

@nicolas-grekas nicolas-grekas changed the title [VarDumper] Fix return type dumping [VarDumper] Fix return type and anonymous classes dumping Oct 19, 2015
@nicolas-grekas
Copy link
Member Author

This PR now also fixes dumping PHP7 anonymous classes.

@fabpot
Copy link
Member

fabpot commented Oct 20, 2015

Thank you @nicolas-grekas.

@fabpot fabpot merged commit b42b03a into symfony:2.7 Oct 20, 2015
fabpot added a commit that referenced this pull request Oct 20, 2015
…(nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[VarDumper] Fix return type and anonymous classes dumping

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

I missed that `getReturnType` returns a `ReflectionType` instance that should be casted to string.

Commits
-------

b42b03a [VarDumper] Fix return type and anonymous classes dumping
@nicolas-grekas nicolas-grekas deleted the refl-type branch October 20, 2015 08:05
*/
public function testAnonymousClass()
{
$c = eval('return new class extends stdClass { private $foo = "foo"; };');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about an anonymous class not extending any parent class ? Is it valid ?

@fabpot fabpot mentioned this pull request Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants