Skip to content

container entries debug#505

Merged
mnapoli merged 5 commits intoPHP-DI:masterfrom
juliangut:container-debug
Jun 11, 2017
Merged

container entries debug#505
mnapoli merged 5 commits intoPHP-DI:masterfrom
juliangut:container-debug

Conversation

@juliangut
Copy link
Copy Markdown
Contributor

covers container entries debug dumper as per comment on #152

Copy link
Copy Markdown
Member

@mnapoli mnapoli left a comment

Choose a reason for hiding this comment

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

Thanks! I have written a few comments inline, also could you add a changelog entry in the 6.0 section?

$this->assertEquals('foo', $container->debugEntry('string'));
$this->assertEquals('string', $container->debugEntry('entry'));
$this->assertEquals('stdClass', $container->debugEntry('object'));
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test is ContainerGetTest.php and it's supposed to test the get() method.

I think it would make more sense to move those 2 new tests into a new test class in IntegrationTest (instead of UnitTest) that would test the debug features, i.e. DebugTest ?

* Get defined container entries.
*
* @return array
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can add the array return type here and remove the same line that is in the phpdoc (PHP 7 FTW ^^)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think code base must be reviewed on missing type hinting hunt, for example on Container::has

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I cannot add it for has() and get() because those are defined in PSR-11 unfortunately.

* @throws InvalidDefinition
*
* @return string
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you add the strict types here too? (parameter + return type)


return is_object($entry) ? get_class($entry) : gettype($entry);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You could throw a NotFound exception? (it wouldn't be a huge difference but since the exception exists let's use it)

@mnapoli mnapoli added this to the 6.0 milestone Jun 10, 2017
@mnapoli
Copy link
Copy Markdown
Member

mnapoli commented Jun 11, 2017

Thanks!

@mnapoli mnapoli merged commit 6b55493 into PHP-DI:master Jun 11, 2017
@juliangut juliangut deleted the container-debug branch June 11, 2017 18:21
@juliangut juliangut mentioned this pull request Feb 3, 2018
mnapoli added a commit that referenced this pull request Feb 3, 2018
This reverts commit 6748f3f.

The method getKnownEntryNames introduced in PR #505 has been removed as being considered "unused".

Without that method debugEntry method is sort of orphan as you may only debug entries you know exist in the container.
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.

2 participants