Skip to content

Conversation

@theofidry
Copy link
Member

@theofidry theofidry commented Oct 7, 2017

Instead of not touching the global classes at all and prefix them only when explicitly specified, we can prefix them if they are not internal. We could then get rid of the global whitelist and allow the whitelist for classes belonging to the global namespace.

  • Remove the global namespace config concept
  • Simplify the code (now possible as there is only 1 whitelist concept)
  • Allow whitelist to work with classes from the global namespace
  • Update the tests
  • Update the configuration

Current status: did a replacement and updating the tests; need more refactoring and checking the list above

@theofidry theofidry requested a review from padraic October 7, 2017 11:02
@theofidry theofidry force-pushed the feature/better-reflection branch from 94f8c22 to e5c571f Compare October 9, 2017 21:48
@theofidry theofidry self-assigned this Oct 26, 2017
@theofidry theofidry changed the title PoC: use BetterReflection for global classes Use BetterReflection for global classes Jan 8, 2018
@theofidry theofidry force-pushed the feature/better-reflection branch 2 times, most recently from 8826fbb to d735b41 Compare February 14, 2018 00:44
Copy link
Member Author

@theofidry theofidry left a comment

Choose a reason for hiding this comment

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

I think I went a bit too far in that PR as a few behavioural changes could have been done in other PRs to make it simpler.

However as it stands now too many tests would require to be updated so the overhead would be quite significant.

I think it's better to cleanup this PR and continue the remaining work in other PRs but not worth to rework this PR to simplify it by breaking it down in several PRs which would have a lot of conflicts.

TODO-roave Outdated
@@ -0,0 +1,112 @@
// vendor/roave/better-reflection/src/SourceLocator/Ast/Locator.php
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: this should be a patch for roave/better-reflection

$whitelister = function (string $className) {
return 'AppKernel' === $className;
};
$nonInternalReflectionProphecy = $this->prophesize(ReflectionClass::class);
Copy link
Member Author

Choose a reason for hiding this comment

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

no longer necessary

if (null === $namespace->name && $this->hasWhitelistedNode([$namespace])) {
return true;
}
// if (null === $namespace->name && $this->hasWhitelistedNode([$namespace])) {
Copy link
Member Author

Choose a reason for hiding this comment

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

can be simplified

|| AppendParentNode::hasParent($node)
) ? $node : $this->wrapNamespace($node);
}
//
Copy link
Member Author

Choose a reason for hiding this comment

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

can be simplified

.TODO Outdated
@@ -0,0 +1,17 @@
Right now whitelisted class works as follow:
Copy link
Member Author

Choose a reason for hiding this comment

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

Should be transformed into several issues rather than this file

@theofidry theofidry force-pushed the feature/better-reflection branch from 5577270 to 02ef70e Compare February 15, 2018 22:03
@theofidry theofidry merged commit 21756f8 into humbug:master Feb 16, 2018
@theofidry theofidry deleted the feature/better-reflection branch February 16, 2018 00:36
@theofidry
Copy link
Member Author

The e2e tests are not passing due to #152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant