Skip to content
Draft
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
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
],
"require": {
"php": "^8.2",
"a9f/fractor": "^0.3",
"rector/rector": "^1.0",
"a9f/fractor": "^0.4",
"rector/rector": "^2.0",
"symfony/config": "^6.4 || ^7.0",
"symfony/console": "^6.4 || ^7.0",
"symfony/dependency-injection": "^6.4 || ^7.0",
Expand All @@ -23,11 +23,11 @@
},
"require-dev": {
"ergebnis/composer-normalize": "^2.42",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.10",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^11.0",
"symplify/easy-coding-standard": "^12.1",
"thecodingmachine/phpstan-safe-rule": "^1.2"
"thecodingmachine/phpstan-safe-rule": "^2.0-dev"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions e2e/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"type": "project",
"require": {
"a9f/lifter": "@dev",
"a9f/fractor": "^0.3",
"a9f/fractor-composer-json": "^0.3",
"a9f/fractor-doc-generator": "^0.3",
"a9f/fractor-extension-installer": "^0.3",
"a9f/fractor": "^0.4",
"a9f/fractor-composer-json": "^0.4",
"a9f/fractor-doc-generator": "^0.4",
"a9f/fractor-extension-installer": "^0.4",
"symplify/rule-doc-generator-contracts": "^11.2"
},
"require-dev": {
Expand Down
7 changes: 3 additions & 4 deletions e2e/fractor/fractor.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php

use a9f\Fractor\Configuration\FractorConfigurationBuilder;
use a9f\Fractor\Configuration\FractorConfiguration;

return static function (FractorConfigurationBuilder $fractorConfig) {
// no-op for now
};
return FractorConfiguration::configure()
->withPaths([__DIR__ . '/result/**']);
14 changes: 7 additions & 7 deletions e2e/fractor/lifter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
new FractorStep(
'Update phpunit/phpunit to 11.x',
static function (FractorConfigurationBuilder $fractorConfig) {
$fractorConfig->withPaths([__DIR__ . '/result/**']);
$fractorConfig->withConfiguredRule(
ChangePackageVersionComposerJsonFractor::class,
[
new PackageAndVersion('phpunit/phpunit', '^11.2')
]
);
return $fractorConfig
->withConfiguredRule(
ChangePackageVersionComposerJsonFractor::class,
[
new PackageAndVersion('phpunit/phpunit', '^11.2')
]
);
}
)
]);
Expand Down
2 changes: 1 addition & 1 deletion e2e/rector/expected-output.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
RECTOR:
RECTOR: [OK] 1 file has been changed by Rector

RECTOR:
4 changes: 3 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ parameters:

# this is required because of our generic interface StepExecutor that we use w/o specifying a concrete subtype,
# e.g. in UpgradeRunner
checkGenericClassInNonGenericObjectType: false
ignoreErrors:
-
identifier: missingType.generics
5 changes: 1 addition & 4 deletions res/run_fractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
use a9f\Lifter\Configuration\LifterConfigFactory;
use a9f\Lifter\Upgrade\Step\FractorStep;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Webmozart\Assert\Assert;

return static function (ContainerConfigurator $configurator) {
$fractorConfig = FractorConfiguration::configure();
Expand All @@ -14,9 +13,7 @@
if (!is_string($fractorConfigFile)) {
throw new \RuntimeException('No file passed in env variable FRACTOR_CONFIG_FILE', 1712507292);
}
$fractorConfigClosure = (require $fractorConfigFile);
Assert::isCallable($fractorConfigClosure, 'FRACTOR_CONFIG_FILE did not yield a callable');
$fractorConfigClosure($fractorConfig);
$fractorConfig->import($fractorConfigFile);

$lifterConfigFile = getenv('LIFTER_CONFIG_FILE');
if (!is_string($lifterConfigFile)) {
Expand Down
8 changes: 7 additions & 1 deletion src/Upgrade/Step/FractorStepExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,17 @@ public function run(int $index, UpgradeStep $step): void
],
timeout: 3600
);
$process->run(static function ($type, $data) {
$firstLine = true;
$process->run(static function ($type, $data) use (&$firstLine) {
$data = trim($data);

// TODO do we need to handle CRLF separately here?
$lines = explode("\n", $data);
if (!$firstLine) {
echo array_shift($lines);
} else {
$firstLine = false;
}
$lines = array_map(
static fn (string $line) => "FRACTOR: $line",
$lines
Expand Down
18 changes: 16 additions & 2 deletions src/Upgrade/Step/RectorStepExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,22 @@ public function run(int $index, UpgradeStep $step): void
],
timeout: 3600
);
$process->run(static function ($type, $data) {
echo 'RECTOR: ' . $data;
$firstLine = true;
$process->run(static function ($type, $data) use (&$firstLine) {
$data = trim($data);

// TODO do we need to handle CRLF separately here?
$lines = explode("\n", $data);
if (!$firstLine) {
echo array_shift($lines);
} else {
$firstLine = false;
}
$lines = array_map(
static fn (string $line) => "RECTOR: $line",
$lines
);
echo implode("\n", $lines), "\n";
});
}
}