Skip to content

Dead code or autoloading mechanism? #389

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

Closed
holtkamp opened this issue Sep 24, 2019 · 4 comments
Closed

Dead code or autoloading mechanism? #389

holtkamp opened this issue Sep 24, 2019 · 4 comments

Comments

@holtkamp
Copy link
Contributor

Maybe I am missing the point, but what is the functional justification of this snippet:

array_map('class_exists', [Bar::class, BlueScreen::class, DefaultBarPanel::class, Dumper::class,
FireLogger::class, Helpers::class, Logger::class, ]);

Is it to ensure these classes are "autoloaded"? If so, what would be the point of that?

@jelen07
Copy link

jelen07 commented Sep 24, 2019

I think that the primary aim of this code is that ensures, that Tracy will work properly. It's better to know earlier, that Tracy won't work in Debugger::enable() method, than later - ie. logging and so on.

@dg
Copy link
Member

dg commented Sep 24, 2019

This is because the errors that occurs in the autoloader.

For questions please use the forum https://forum.nette.org/en/f46-tracy

@holtkamp
Copy link
Contributor Author

holtkamp commented Sep 24, 2019

This is because the errors that occurs in the autoloader.

ok, so it is intended to "capture" any error that might occur during autoloading. But it does not ensure that class exists... class_exists('unexistingClass'); simply returns false...

For questions please use the forum https://forum.nette.org/en/f46-tracy

Ok, sorry. Thought this was more a "issue" than a question 😉

Closing for now, but I think the code does not do what it suggests it does... 🤔

@dg
Copy link
Member

dg commented Sep 24, 2019

It is just fix for very specific problem. It can be replaced with require_once ....

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

No branches or pull requests

3 participants