Skip to content

Commit

Permalink
[TASK] Do not prefix class ComposerJson
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed May 11, 2021
1 parent aa45d4e commit 49431b7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions build/target-repository/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@
require $filePath;
}
}

// aliased by php-scoper, that's why its missing
if ($class === 'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson') {
$filePath = __DIR__ . '/vendor/symplify/composer-json-manipulator/src/ValueObject/ComposerJson.php';
if (file_exists($filePath)) {
require $filePath;
}
}
});
9 changes: 9 additions & 0 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ function (string $filePath, string $prefix, string $content): string {
);
},

// unprefixed ComposerJson
function (string $filePath, string $prefix, string $content): string {
return Strings::replace(
$content, '
#' . $prefix . '\\\\Symplify\\\\ComposerJsonManipulator\\\\ValueObject\\\\ComposerJson#',
'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson'
);
},

// get version for prefixed version
function (string $filePath, string $prefix, string $content): string {
if (! Strings::endsWith($filePath, 'src/Configuration/Configuration.php')) {
Expand Down
2 changes: 2 additions & 0 deletions utils/compiler/src/PhpScoper/StaticEasyPrefixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ final class StaticEasyPrefixer
'Doctrine\Inflector\Inflector',
// for SmartFileInfo
'Symplify\SmartFileSystem\SmartFileInfo',
// for ComposerJson because it is part of the public API. I.e. ComposerRectorInterface
'Symplify\ComposerJsonManipulator\ValueObject\ComposerJson'
];

/**
Expand Down

0 comments on commit 49431b7

Please sign in to comment.