It's apparently bad practice to define a class and then perform logic with it in the same file. This makes complete sense. Not sure why I did that in the first place. Rather than ask users to
You should instead, keep the Autoloader class definition inside the Autoloader.php file, but then create a new file named "autoload.php" and place it in either the "src" directory or in the "src/CSVelte" directory (I think I prefer the former). Maybe even create a src/bootstrap/autoload.php... I don't know. Think about it... then make it happen.
Contents of src/autoload.php
<?php
/**
* Add the "src" directory to list of search paths and register autoloader
* @var Autoloader
*/
$autoloader = new Autoloader();
$autoloader->addPath(__DIR__);
$autoloader->register();
[x] Remove autoload registration from CSVelte\Autoloader
[x] Place the above code into "src/autoload.php"
[x] Test it
[x] Document it
[x] Re-run Scrutinizer on it (it was complaining up a storm about this one!)
From RTD todo item(s)
Look into PSR-4 for autoloading. According to a book I was just reading, PSR-4 eliminates the need for me to register an autoload function. See what this is all about...
Look into the other PSRs and see if any of them might benefit you as well (after looking through them, PSR-7 and PSR-17 were both very interesting - see GitHub issue #107)
It's apparently bad practice to define a class and then perform logic with it in the same file. This makes complete sense. Not sure why I did that in the first place. Rather than ask users to
You should instead, keep the Autoloader class definition inside the Autoloader.php file, but then create a new file named "autoload.php" and place it in either the "src" directory or in the "src/CSVelte" directory (I think I prefer the former). Maybe even create a src/bootstrap/autoload.php... I don't know. Think about it... then make it happen.
Contents of src/autoload.php
From RTD todo item(s)