Skip to content

Commit 0c45fd3

Browse files
authored
Merge pull request #40 from Yoast/feature/autoloader-remove-use-of-dir-sep-constant
Autoloader: minor simplification
2 parents e92195b + 2dfaea9 commit 0c45fd3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

phpunitpolyfills-autoload.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,7 @@ public static function load( $className ) {
2525
* exist in PHP natively.
2626
*/
2727
if ( $className === 'Error' || $className === 'TypeError' ) {
28-
$file = \realpath(
29-
__DIR__ . \DIRECTORY_SEPARATOR
30-
. 'src' . \DIRECTORY_SEPARATOR
31-
. 'Exceptions' . \DIRECTORY_SEPARATOR
32-
. $className . '.php'
33-
);
28+
$file = \realpath( __DIR__ . '/src/Exceptions/' . $className . '.php' );
3429

3530
if ( \file_exists( $file ) === true ) {
3631
require_once $file;
@@ -119,11 +114,7 @@ public static function load( $className ) {
119114
* - Yoast\PHPUnitPolyfills\TestListeners\TestListenerSnakeCaseMethods
120115
*/
121116
default:
122-
$file = \realpath(
123-
__DIR__ . \DIRECTORY_SEPARATOR
124-
. 'src' . \DIRECTORY_SEPARATOR
125-
. \strtr( \substr( $className, 23 ), '\\', \DIRECTORY_SEPARATOR ) . '.php'
126-
);
117+
$file = \realpath( __DIR__ . '/src/' . \strtr( \substr( $className, 23 ), '\\', '/' ) . '.php' );
127118

128119
if ( \file_exists( $file ) === true ) {
129120
require_once $file;

0 commit comments

Comments
 (0)