-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Classmap implementation #4
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4a4b5e1
Added Classmap autoload object and handling
coenjacobs f7ef397
Split up replacement logic during moving of files
coenjacobs 38969f7
Regex magic for classmap replacer
coenjacobs 31d0a22
Store replaced class names to later replace in all files
coenjacobs f8ea2cd
Run routine to replace replaced class names across classmap
coenjacobs e206a50
Classmap configuration in the readme
coenjacobs a35ee8c
Replace static class prefix by config value
coenjacobs 44ac13c
Classmap loads split between files and folders
coenjacobs 05fea7d
Replace is_a( calls with instanceof
coenjacobs c91d232
All class directories will now be prefixed with vendor/package
coenjacobs c8542f7
Instanceof checks need to go against class object instead of string
coenjacobs dd3333f
Explicitely create target directories to avoid errors
coenjacobs a27c4a6
Different apporach to this reverted commit, same outcome
coenjacobs 05f9900
Move classmapped files to prefixed directory as well
coenjacobs 03d830f
Improved regexes on both detecting and replacing classes
coenjacobs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will miss a couple of scenarios.
The ones I can think of right now:
public function __construct( MyClass $obj );
new
without arguments:$obj = new MyClass;
$class = 'MyClass'; $obj = new $class();
It will also probably break when using relative namespaces, like the following:
I'm not really sure how you can add cases like these without getting false positives as well, though. I don't think this can properly be handled by regexes, you should look into using
nikic/PHP-Parser
perhaps.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @schlessera, I would love to make this as bullet proof as I can, but don't want this to distract too much from actually implementing the classmap handler. Improving the replacing logic can obviously be an ongoing process. Can you please post this as an issue, so I can handle it accordingly ( - it would be amazing if the GitHub UI allowed me to promote this comment to an issue, directly from here)?