Skip to content
Snippets Groups Projects
Commit 84cc874b authored by Yash Rode's avatar Yash Rode Committed by Adam G-H
Browse files

Issue #3355609 by yash.rode, Wim Leers, phenaproxima: All injected services...

Issue #3355609 by yash.rode, Wim Leers, phenaproxima: All injected services should be marked readonly
parent 58c9abd3
No related branches found
No related tags found
No related merge requests found
Showing
with 69 additions and 48 deletions
......@@ -55,7 +55,7 @@ class ExtensionUpdateStage extends StageBase {
* The failure marker service.
*/
public function __construct(
protected ComposerInspector $composerInspector,
protected readonly ComposerInspector $composerInspector,
PathLocator $pathLocator,
BeginnerInterface $beginner,
StagerInterface $stager,
......
......@@ -55,14 +55,14 @@ final class UpdateReady extends UpdateFormBase {
* The path locator service.
*/
public function __construct(
private ExtensionUpdateStage $stage,
private readonly ExtensionUpdateStage $stage,
MessengerInterface $messenger,
private StateInterface $state,
private ModuleExtensionList $moduleList,
private RendererInterface $renderer,
private EventDispatcherInterface $eventDispatcher,
private ComposerInspector $composerInspector,
private PathLocator $pathLocator,
private readonly StateInterface $state,
private readonly ModuleExtensionList $moduleList,
private readonly RendererInterface $renderer,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly ComposerInspector $composerInspector,
private readonly PathLocator $pathLocator,
) {
$this->setMessenger($messenger);
}
......
......@@ -66,13 +66,13 @@ final class UpdaterForm extends UpdateFormBase {
* The path locator service.
*/
public function __construct(
private ExtensionUpdateStage $stage,
private EventDispatcherInterface $eventDispatcher,
private RendererInterface $renderer,
private StateInterface $state,
private FailureMarker $failureMarker,
private ComposerInspector $composerInspector,
private PathLocator $pathLocator,
private readonly ExtensionUpdateStage $stage,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly RendererInterface $renderer,
private readonly StateInterface $state,
private readonly FailureMarker $failureMarker,
private readonly ComposerInspector $composerInspector,
private readonly PathLocator $pathLocator,
) {}
/**
......
......@@ -36,8 +36,8 @@ final class UpdateReleaseValidator implements EventSubscriberInterface {
* The path locator service.
*/
public function __construct(
private ComposerInspector $composerInspector,
private PathLocator $pathLocator
private readonly ComposerInspector $composerInspector,
private readonly PathLocator $pathLocator
) {}
/**
......
......@@ -74,7 +74,11 @@ class ComposerInspector implements LoggerAwareInterface {
* @param \PhpTuf\ComposerStager\Infrastructure\Factory\Path\PathFactoryInterface $pathFactory
* The path factory service from Composer Stager.
*/
public function __construct(private ComposerRunnerInterface $runner, private ComposerIsAvailableInterface $composerIsAvailable, private PathFactoryInterface $pathFactory) {
public function __construct(
private readonly ComposerRunnerInterface $runner,
private readonly ComposerIsAvailableInterface $composerIsAvailable,
private readonly PathFactoryInterface $pathFactory
) {
$this->processCallback = new ProcessOutputCallback();
$this->setLogger(new NullLogger());
}
......
......@@ -24,7 +24,7 @@ final class UpdateDataSubscriber implements EventSubscriberInterface {
* @param \Drupal\update\UpdateManagerInterface $updateManager
* The update manager service.
*/
public function __construct(protected UpdateManagerInterface $updateManager) {
public function __construct(private readonly UpdateManagerInterface $updateManager) {
}
/**
......
......@@ -34,7 +34,10 @@ final class ExecutableFinder implements ExecutableFinderInterface {
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The config factory service.
*/
public function __construct(SymfonyExecutableFinder $symfony_executable_finder, private ConfigFactoryInterface $configFactory) {
public function __construct(
SymfonyExecutableFinder $symfony_executable_finder,
private readonly ConfigFactoryInterface $configFactory
) {
$this->decorated = new StagerExecutableFinder($symfony_executable_finder);
}
......
......@@ -30,7 +30,7 @@ final class FailureMarker {
* @param \Drupal\package_manager\PathLocator $pathLocator
* The path locator service.
*/
public function __construct(private PathLocator $pathLocator) {
public function __construct(private readonly PathLocator $pathLocator) {
}
/**
......
......@@ -42,9 +42,9 @@ final class FileSyncerFactory {
*/
public function __construct(
ExecutableFinder $executable_finder,
private PhpFileSyncer $phpFileSyncer,
private RsyncFileSyncer $rsyncFileSyncer,
private ConfigFactoryInterface $configFactory,
private readonly PhpFileSyncer $phpFileSyncer,
private readonly RsyncFileSyncer $rsyncFileSyncer,
private readonly ConfigFactoryInterface $configFactory,
) {
$this->decorated = new StagerFileSyncerFactory($executable_finder, $phpFileSyncer, $rsyncFileSyncer);
}
......
......@@ -35,8 +35,8 @@ final class NoSymlinksPointToADirectory implements NoSymlinksPointToADirectoryIn
* The config factory.
*/
public function __construct(
private NoSymlinksPointToADirectoryInterface $decorated,
private ConfigFactoryInterface $configFactory
private readonly NoSymlinksPointToADirectoryInterface $decorated,
private readonly ConfigFactoryInterface $configFactory
) {}
/**
......
......@@ -29,7 +29,7 @@ final class GitExcluder implements EventSubscriberInterface {
* @param \Drupal\package_manager\ComposerInspector $composerInspector
* The Composer inspector service.
*/
public function __construct(PathLocator $path_locator, private ComposerInspector $composerInspector) {
public function __construct(PathLocator $path_locator, private readonly ComposerInspector $composerInspector) {
$this->pathLocator = $path_locator;
}
......
......@@ -33,7 +33,11 @@ final class SiteFilesExcluder implements EventSubscriberInterface {
* @param \Symfony\Component\Filesystem\Filesystem $fileSystem
* The Symfony file system service.
*/
public function __construct(PathLocator $path_locator, protected StreamWrapperManagerInterface $streamWrapperManager, protected Filesystem $fileSystem) {
public function __construct(
PathLocator $path_locator,
private readonly StreamWrapperManagerInterface $streamWrapperManager,
private readonly Filesystem $fileSystem
) {
$this->pathLocator = $path_locator;
}
......
......@@ -40,7 +40,7 @@ final class UnknownPathExcluder implements EventSubscriberInterface {
* @param \Drupal\package_manager\PathLocator $path_locator
* The path locator service.
*/
public function __construct(private ComposerInspector $composerInspector, PathLocator $path_locator) {
public function __construct(private readonly ComposerInspector $composerInspector, PathLocator $path_locator) {
$this->pathLocator = $path_locator;
}
......
......@@ -37,7 +37,10 @@ final class ProcessFactory implements ProcessFactoryInterface {
* @param \Drupal\Core\Config\ConfigFactoryInterface $configFactory
* The config factory service.
*/
public function __construct(private FileSystemInterface $fileSystem, private ConfigFactoryInterface $configFactory) {
public function __construct(
private readonly FileSystemInterface $fileSystem,
private readonly ConfigFactoryInterface $configFactory
) {
$this->decorated = new StagerProcessFactory();
}
......
......@@ -27,7 +27,7 @@ final class ProjectInfo {
* @param string $name
* The project name.
*/
public function __construct(protected string $name) {
public function __construct(private readonly string $name) {
}
/**
......
......@@ -186,16 +186,16 @@ abstract class StageBase implements LoggerAwareInterface {
* The failure marker service.
*/
public function __construct(
protected PathLocator $pathLocator,
protected BeginnerInterface $beginner,
protected StagerInterface $stager,
protected CommitterInterface $committer,
protected FileSystemInterface $fileSystem,
protected readonly PathLocator $pathLocator,
protected readonly BeginnerInterface $beginner,
protected readonly StagerInterface $stager,
protected readonly CommitterInterface $committer,
protected readonly FileSystemInterface $fileSystem,
protected EventDispatcherInterface $eventDispatcher,
protected SharedTempStoreFactory $tempStoreFactory,
protected TimeInterface $time,
protected PathFactoryInterface $pathFactory,
protected FailureMarker $failureMarker,
protected readonly SharedTempStoreFactory $tempStoreFactory,
protected readonly TimeInterface $time,
protected readonly PathFactoryInterface $pathFactory,
protected readonly FailureMarker $failureMarker,
) {
$this->tempStore = $tempStoreFactory->get('package_manager_stage');
$this->setLogger(new NullLogger());
......
......@@ -32,7 +32,12 @@ final class ValidationResult {
* Thrown if $messages is empty, or if it has 2 or more items but $summary
* is NULL.
*/
private function __construct(public readonly int $severity, private array $messages, public readonly ?TranslatableMarkup $summary, bool $assert_translatable) {
private function __construct(
public readonly int $severity,
private array $messages,
public readonly ?TranslatableMarkup $summary,
bool $assert_translatable
) {
if ($assert_translatable) {
assert(Inspector::assertAll(fn ($message) => $message instanceof TranslatableMarkup, $messages));
}
......
......@@ -35,8 +35,8 @@ final class AllowedScaffoldPackagesValidator implements EventSubscriberInterface
* The path locator service.
*/
public function __construct(
private ComposerInspector $composerInspector,
private PathLocator $pathLocator,
private readonly ComposerInspector $composerInspector,
private readonly PathLocator $pathLocator,
) {}
/**
......
......@@ -32,8 +32,10 @@ final class ComposerMinimumStabilityValidator implements EventSubscriberInterfac
* @param \Drupal\package_manager\ComposerInspector $inspector
* The Composer inspector service.
*/
public function __construct(protected PathLocator $pathLocator, protected ComposerInspector $inspector) {
}
public function __construct(
private readonly PathLocator $pathLocator,
private readonly ComposerInspector $inspector
) {}
/**
* Validates composer minimum stability.
......
......@@ -58,9 +58,9 @@ final class ComposerPatchesValidator implements EventSubscriberInterface {
* The path locator service.
*/
public function __construct(
private ModuleHandlerInterface $moduleHandler,
private ComposerInspector $composerInspector,
private PathLocator $pathLocator
private readonly ModuleHandlerInterface $moduleHandler,
private readonly ComposerInspector $composerInspector,
private readonly PathLocator $pathLocator
) {}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment