diff --git a/scoper.inc.php b/scoper.inc.php index 622afcf66e5..5f4271c6395 100644 --- a/scoper.inc.php +++ b/scoper.inc.php @@ -6,13 +6,26 @@ $namespace = 'BuddyBossPlatform'; -return [ +return array( + // The prefix configuration. If a non null value will be used, a random prefix will be generated. - 'prefix' => $namespace, - 'whitelist' => [ + 'prefix' => $namespace, + 'whitelist' => array( + // Excludes specific namespaces from being prefixed. 'Composer\\*', - ], - 'finders' => [], - 'patchers' => [], -]; + 'MyCLabs', + 'MyCLabs\\*', + ), + 'finders' => array(), + 'patchers' => array( + function ( $file_path, $prefix, $contents ) { + + // Check the file path and possibly return the original contents. + if ( strpos( $file_path, 'myclabs/php-enum' ) !== false ) { + return file_get_contents( $file_path ); // Revert to original contents. + } + return $contents; // Return modified contents for other files. + }, + ), +); diff --git a/src/scoper.inc.php b/src/scoper.inc.php index ccfea8bb06e..5f4271c6395 100644 --- a/src/scoper.inc.php +++ b/src/scoper.inc.php @@ -6,13 +6,26 @@ $namespace = 'BuddyBossPlatform'; -return [ +return array( + // The prefix configuration. If a non null value will be used, a random prefix will be generated. - 'prefix' => $namespace, - 'whitelist' => [ + 'prefix' => $namespace, + 'whitelist' => array( + // Excludes specific namespaces from being prefixed. - 'Composer\\*' - ], - 'finders' => [], - 'patchers' => [], -]; + 'Composer\\*', + 'MyCLabs', + 'MyCLabs\\*', + ), + 'finders' => array(), + 'patchers' => array( + function ( $file_path, $prefix, $contents ) { + + // Check the file path and possibly return the original contents. + if ( strpos( $file_path, 'myclabs/php-enum' ) !== false ) { + return file_get_contents( $file_path ); // Revert to original contents. + } + return $contents; // Return modified contents for other files. + }, + ), +);