simple-autoloader-for-wordpress icon indicating copy to clipboard operation
simple-autoloader-for-wordpress copied to clipboard

Missing file_exists() check

Open cliffordp opened this issue 7 years ago • 3 comments

https://tommcfarlin.com/namespaces-and-autoloading-2017/ actually says,

Note that this code is not checking to see if the file exists. Though I recommend it, it’s been left out for the sake of length and because, in our example, we know the file does exist.

:)

I didn't submit a PR because your article says there are a few options for what to do if it doesn't exist and I didn't want to waste time writing one if you preferred another.

cliffordp avatar Nov 05 '17 01:11 cliffordp

file_exists is normally the check I use.

tommcfarlin avatar Nov 06 '17 21:11 tommcfarlin

I'm unclear... is file_exists() omitted from autoload.php intentionally or should it be added?

cliffordp avatar Nov 07 '17 21:11 cliffordp

It can be added. The repository doesn't have it included because this particular code was used during a presentation in which we knew the code would exist.

If you want to open a PR to include the check, that's fine!

tommcfarlin avatar Nov 08 '17 15:11 tommcfarlin