Skip to content
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

Internal class reflections #80

Merged
merged 30 commits into from
Jul 22, 2015
Merged

Internal class reflections #80

merged 30 commits into from
Jul 22, 2015

Conversation

asgrim
Copy link
Member

@asgrim asgrim commented Jul 20, 2015

This PR fixes #38

  • AggregateSourceLocators can be nested now (Reflector\Generic will recurse through them in a flat ordered way)
  • I had to modify the behaviour of the SourceLocators slightly so that they don't throw exceptions, but merely return null. This is so that when we loop through the AggregateSourceLocator, we don't break the loop.
  • By default PhpInternalSourceLocator gets added to all calls to reflect(). Can be disabled by a paramter
  • A new magic const is defined as a flag to notify ReflectionClass that the LocatedSource originated from the PhpInternalSourceLocator (thus isInternal() === true)

Todo

  • Needs the rest of the internal classes implemented...
  • ~~~Need to implement functions too...~~~
  • More path coverage for PhpInternalSourceLocator

@asgrim asgrim self-assigned this Jul 20, 2015
@asgrim asgrim added this to the 1.0.0 milestone Jul 20, 2015
@@ -30,7 +30,13 @@ public function __construct(array $sourceLocators = [])
public function __invoke(Identifier $identifier)
{
foreach ($this->sourceLocators as $sourceLocator) {
yield $sourceLocator->__invoke($identifier);
if ($sourceLocator instanceof self) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not just if ($sourceLocator instanceof Traversable) {?

Copy link
Member Author

Choose a reason for hiding this comment

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

'cuz AggregateSourceLocator is not Traversable?

@Ocramius Ocramius changed the title [WIP] Internal class reflections Internal class reflections Jul 22, 2015
Ocramius added a commit that referenced this pull request Jul 22, 2015
@Ocramius Ocramius merged commit a5bcb25 into master Jul 22, 2015
@Ocramius Ocramius deleted the internal-class-reflections branch July 22, 2015 00:58
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.

Create ReflectionFunctions/ReflectionClasses from internal definitions
2 participants