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

Dead code or autoloading mechanism? #389

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

@holtkamp holtkamp commented Sep 24, 2019

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

This comment has been minimized.

Copy link

@jelen07 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

This comment has been minimized.

Copy link
Member

@dg 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

This comment has been minimized.

Copy link
Contributor Author

@holtkamp 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... 🤔

@holtkamp holtkamp closed this Sep 24, 2019
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Sep 24, 2019

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

dg added a commit that referenced this issue Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.