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?
PHP

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon
Ray Paseur

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
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....
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..
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Silas2

ASKER
Whats' the best way out of this ?
ASKER CERTIFIED SOLUTION
Ray Paseur

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question