Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no kernel #5860

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"composer/xdebug-handler": "^1.4",
"doctrine/annotations": "^1.12",
"doctrine/inflector": "^2.0",
"jean85/pretty-package-versions": "^1.5.1|^2.0.1",
"nette/robot-loader": "^3.2 <=3.3.1",
"nette/utils": "^3.2",
"nikic/php-parser": "^4.10.4",
Expand Down
3 changes: 2 additions & 1 deletion packages/ChangesReporting/Output/JsonOutputFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Nette\Utils\Json;
use Rector\ChangesReporting\Application\ErrorAndDiffCollector;
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
use Rector\Core\Application\RectorApplication;
use Rector\Core\Configuration\Configuration;
use Symplify\SmartFileSystem\SmartFileSystem;

Expand Down Expand Up @@ -42,7 +43,7 @@ public function report(ErrorAndDiffCollector $errorAndDiffCollector): void
{
$errorsArray = [
'meta' => [
'version' => $this->configuration->getPrettyVersion(),
'version' => RectorApplication::VERSION,
'config' => $this->configuration->getMainConfigFilePath(),
],
'totals' => [
Expand Down
12 changes: 0 additions & 12 deletions scoper.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@
ScoperOption::WHITELIST => StaticEasyPrefixer::getExcludedNamespacesAndClasses(),
ScoperOption::PATCHERS => [
// [BEWARE] $filePath is absolute!

// fixes https://github.com/rectorphp/rector-prefixed/runs/2103759172
// and https://github.com/rectorphp/rector-prefixed/blob/0cc433e746b645df5f905fa038573c3a1a9634f0/vendor/jean85/pretty-package-versions/src/PrettyVersions.php#L6
function (string $filePath, string $prefix, string $content): string {
if (! Strings::endsWith($filePath, 'vendor/jean85/pretty-package-versions/src/PrettyVersions.php')) {
return $content;
}

// see https://regex101.com/r/v8zRMm/1
return Strings::replace($content, '#' . $prefix . '\\\\Composer\\\\InstalledVersions#', 'Composer\InstalledVersions');
},

// unprefix string classes, as they're string on purpose - they have to be checked in original form, not prefixed
function (string $filePath, string $prefix, string $content): string {
// skip vendor
Expand Down
7 changes: 7 additions & 0 deletions src/Application/RectorApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
*/
final class RectorApplication
{
/**
* @var string
* @see https://github.com/composer/composer/blob/b6826f352390b4c952be8fd75d60cfd4f6f39f11/src/Composer/Composer.php#L54
* @see https://github.com/composer/composer/blob/dfc69140fe720b169b978b18b7863611cc0d8077/src/Composer/Compiler.php#L46-L50
*/
public const VERSION = '@package_version@';

/**
* Why 4? One for each cycle, so user sees some activity all the time:
*
Expand Down
7 changes: 0 additions & 7 deletions src/Configuration/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Rector\Core\Configuration;

use Jean85\PrettyVersions;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Core\Exception\Configuration\InvalidConfigurationException;
use Rector\Core\ValueObject\Bootstrap\BootstrapConfigs;
Expand Down Expand Up @@ -118,12 +117,6 @@ public function resolveFromInput(InputInterface $input): void
}
}

public function getPrettyVersion(): string
{
$version = PrettyVersions::getVersion('rector/rector');
return $version->getPrettyVersion();
}

/**
* @forTests
*/
Expand Down
10 changes: 2 additions & 8 deletions src/Console/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
namespace Rector\Core\Console;

use Composer\XdebugHandler\XdebugHandler;
use OutOfBoundsException;
use Rector\ChangesReporting\Output\ConsoleOutputFormatter;
use Rector\Core\Application\RectorApplication;
use Rector\Core\Bootstrap\NoRectorsLoadedReporter;
use Rector\Core\Configuration\Configuration;
use Rector\Core\Configuration\Option;
Expand Down Expand Up @@ -42,13 +42,7 @@ public function __construct(
CommandNaming $commandNaming,
array $commands = []
) {
try {
$version = $configuration->getPrettyVersion();
} catch (OutOfBoundsException $outOfBoundsException) {
$version = 'Unknown';
}

parent::__construct(self::NAME, $version);
parent::__construct(self::NAME, RectorApplication::VERSION);

foreach ($commands as $command) {
$commandName = $commandNaming->resolveFromCommand($command);
Expand Down