Skip to content
Merged
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
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/DemoRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private function processFilesContents(string $fileContent, string $rectorConfig)
} catch (JsonException $jsonException) {
if ($jsonException->getMessage() === 'Syntax error') {
$errorMessage = 'Invalid json syntax in "vendor/bin/rector" process output: ' . PHP_EOL . PHP_EOL . $output;
throw new ShouldNotHappenException($errorMessage);
throw new ShouldNotHappenException($errorMessage, $jsonException->getCode(), $jsonException);
}

throw $jsonException;
Expand Down
14 changes: 6 additions & 8 deletions src/FileSystem/RectorFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,12 @@ private function findInDirectoriesAndCreateRuleMetadatas(array $directories, arr
$ruleDefinition = $rector->getRuleDefinition();

} catch (Throwable $throwable) {
throw new InvalidRuleDescriptionException(
sprintf(
'Rule "%s" has invalid code samples:%s"%s"',
$findRectorClass,
PHP_EOL . PHP_EOL,
$throwable->getMessage()
)
);
throw new InvalidRuleDescriptionException(sprintf(
'Rule "%s" has invalid code samples:%s"%s"',
$findRectorClass,
PHP_EOL . PHP_EOL,
$throwable->getMessage()
), $throwable->getCode(), $throwable);
}

$ruleDefinition->setRuleClass($findRectorClass);
Expand Down
4 changes: 2 additions & 2 deletions src/Validation/Rules/HasRectorRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ private function createFromConfigs(array $configFiles): RectorConfig
} catch (Throwable $e) {
$message = $e->getMessage();
if (str_starts_with($message, 'Call to undefined method')) {
throw new ShouldNotHappenException('PHP config should have valid method name, you may have typo');
throw new ShouldNotHappenException('PHP config should have valid method name, you may have typo', $e->getCode(), $e);
}

throw new ShouldNotHappenException('Expected config should return callable RectorConfig instance');
throw new ShouldNotHappenException('Expected config should return callable RectorConfig instance', $e->getCode(), $e);
}
}

Expand Down