Conversation
c9a9981 to
6b86df7
Compare
… to not load the class but grab the source code
6b86df7 to
84ba5d6
Compare
src/Reflection/ReflectionClass.php
Outdated
There was a problem hiding this comment.
Because that is how ::createFromNode works.
doing this:
$classInfo = new ReflectionClass('Foo');creates autoload source locator > creates class reflector > calls reflect > locates class > loads source code > loads AST > calls ReflectionClass::createFromNode() > which instantiates a new ReflectionClass but with no parameters
There was a problem hiding this comment.
@asgrim you are changing public API to please package API? Seems wrong :-\
There was a problem hiding this comment.
I don't see another way around it, ideally I need two constructors.. a private one for internal (::createFromNode) use and one for public API :/
…_construct nullable nonsense
There was a problem hiding this comment.
Cache the call to $identifier->getType()->getName(). You should also probably make a method that matches the constant, rather than getting the constant and then comparing outside the VO
There was a problem hiding this comment.
Something like $type->isClass()
Implemented the
AutoloadSourceLocatorwhich means we can now use "static" creation ofReflectionClassobjects, e.g.:There are caveats (we expect the autoloader to load classes from a file, i.e. using require/include), but it does actually work.
It also means this can actually implement theLoadSafeSourceLocator(to be implemented)Merging this would fix #36 and would be a better solution that I initially proposed actually 😀
Todo
masterwhen Compatibility for ReflectionFunctionAbstract and ReflectionFunction #40 is mergedReflectionFunction__constructnullable nonsenseCreate aLoadSafeSourceLocatorand write the logic to do checkingImplement the @todo in Identifier.php#L45