Link to home
Start Free TrialLog in
Avatar of Silas2
Silas2

asked on

PHP Underscores vs. Directory separators

Forgive my ignorance on this, but when I run composer to install magium examples, i notice many of the class names have underscores, e.g. PHPUnit_Framework_Test, but when I look in the autoload_static.php i see :
        'PHPUnit\\Framework\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Test.php',

Open in new window

and the files are not loading properly. Is this some setting I haven't set?
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

There must be a little more to the code, right?  By itself, that looks like a parse error.

I think the backslashes\\ are related to PHP namespaces.  The underscores__ are part of the magic constant's name.  Underscores are legit characters in PHP variable and constant names.
http://php.net/manual/en/language.constants.predefined.php
Avatar of Silas2
Silas2

ASKER

Thanks Ray, I just did a hack on the classloader.php to find the files, and now I'm getting a brick wall on
" implements \PHPUnit_Framework_TestListener"
Its not using the classloader.php to look for it....
Avatar of Silas2

ASKER

Generally speaking, I've downloaded a test project with loads of dependencies, and I see some pointing to AppData\Local\Temp\$Metadata$\B49847A5$phpunit-4.5.phar/PHPUnit_Framework_TestCase.php (which i didn't knowingly download) and I see references broken there....I'm sure this the php version of 'DLL Hell', I was hoping the composer would take care of this stuff..
Avatar of Silas2

ASKER

Whats' the best way out of this ?
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial