A temporary fix to the Composer 5.2 autoload generator

Edit and apologies

The “fix” I had concocted for the PHP 5.2 auto load generator was not working and not needed.
I’m leaving the original post here as a gentle reminder to myself that the “measure twice, cut once” saying does apply to development as well.
The xrstf/composer-php52 works as intended with latest Composer version and my modification was fixing something that has never been broken to begin with.

Follow the instructions on the package site to have the magic happen and stop reading here.

Composer

I use Composer on a daily basis and in PHP 5.2 projects as well when developing for back-compatible WordPress plugins.
Part of the chores that PHP 5.2 imposes is greatly reduced by the use of the xrstf/composer-php52 library that takes care of creating a PHP 5.2 compatible autoload file that can be included in the main plugin file.
Recent updates to Composer seem to have broken the solution, at least for a while, and while I’ve opened a PR (here) to fix I need the library so badly I’ve gone and created a mirror of it on GitHub.
Straight from the README file the simple and slightly different instructions.
In your project’s composer.json file add the following lines:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/lucatume/composer-php52.git"
        }
    ]
    "require": {
        "xrstf/composer-php52": "1.0.20"
    },
    "scripts": {
        "post-install-cmd": [
            "xrstf\\Composer52\\Generator::onPostInstallCmd"
        ],
        "post-update-cmd": [
            "xrstf\\Composer52\\Generator::onPostInstallCmd"
        ],
        "post-autoload-dump": [
            "xrstf\\Composer52\\Generator::onPostInstallCmd"
        ]
    }
}

After the next update/install, you will have a vendor/autoload_52.php file, that you can simply include and use in PHP 5.2 projects.
The fixed version and the repository specifications will be required until the fix is in a detached state.

grunt-init template

Together with the repo I’ve updated the template I use to quickly scaffold plugins again on GitHub; it integrates the needed modification already and, while not the solution for everyone, it might be a good starting point.

I appreciate your input