Skip to content

Commit

Permalink
Merge pull request #40 from Yoast/feature/autoloader-remove-use-of-di…
Browse files Browse the repository at this point in the history
…r-sep-constant

Autoloader: minor simplification
  • Loading branch information
jrfnl authored Jun 19, 2021
2 parents e92195b + 2dfaea9 commit 0c45fd3
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions phpunitpolyfills-autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ public static function load( $className ) {
* exist in PHP natively.
*/
if ( $className === 'Error' || $className === 'TypeError' ) {
$file = \realpath(
__DIR__ . \DIRECTORY_SEPARATOR
. 'src' . \DIRECTORY_SEPARATOR
. 'Exceptions' . \DIRECTORY_SEPARATOR
. $className . '.php'
);
$file = \realpath( __DIR__ . '/src/Exceptions/' . $className . '.php' );

if ( \file_exists( $file ) === true ) {
require_once $file;
Expand Down Expand Up @@ -119,11 +114,7 @@ public static function load( $className ) {
* - Yoast\PHPUnitPolyfills\TestListeners\TestListenerSnakeCaseMethods
*/
default:
$file = \realpath(
__DIR__ . \DIRECTORY_SEPARATOR
. 'src' . \DIRECTORY_SEPARATOR
. \strtr( \substr( $className, 23 ), '\\', \DIRECTORY_SEPARATOR ) . '.php'
);
$file = \realpath( __DIR__ . '/src/' . \strtr( \substr( $className, 23 ), '\\', '/' ) . '.php' );

if ( \file_exists( $file ) === true ) {
require_once $file;
Expand Down

0 comments on commit 0c45fd3

Please sign in to comment.