Skip to content

Commit 0da52f7

Browse files
authored
Merge pull request #123 from aternosorg/solution-properties-in-constructor
Set properties of solutions in constructor
2 parents 6e2054c + 869ec67 commit 0da52f7

File tree

54 files changed

+237
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+237
-124
lines changed

src/Analysis/Problem/Bukkit/AmbiguousPluginNameProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function setMatches(array $matches, mixed $patternKey): void
4949
$this->firstPluginPath = $this->correctPluginPath($matches[2]);
5050
$this->secondPluginPath = $this->correctPluginPath($matches[3]);
5151

52-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getFirstPluginPath()));
53-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getSecondPluginPath()));
52+
$this->addSolution(new FileDeleteSolution($this->getFirstPluginPath()));
53+
$this->addSolution(new FileDeleteSolution($this->getSecondPluginPath()));
5454
}
5555

5656
/**

src/Analysis/Problem/Bukkit/ChunkLoadExceptionProblem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public static function getPatterns(): array
3535
*/
3636
public function setMatches(array $matches, mixed $patternKey): void
3737
{
38-
$this->addSolution((new WorldRepairSolution())->setWorldName("world"));
39-
$this->addSolution((new FileDeleteSolution())->setRelativePath("world"));
40-
$this->addSolution((new ChunkRemoveSolution()));
38+
$this->addSolution(new WorldRepairSolution("world"));
39+
$this->addSolution(new FileDeleteSolution("world"));
40+
$this->addSolution(new ChunkRemoveSolution());
4141
}
4242
}

src/Analysis/Problem/Bukkit/Plugin/AuthMeShutdownProblem.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public static function getPatterns(): array
3131
*/
3232
public function setMatches(array $matches, mixed $patternKey): void
3333
{
34-
$this->addSolution((new AuthMeShutdownSolution()));
35-
$this->addSolution((new PluginConfigureSolution())->setPluginName("AuthMe")->setSuggestedFile("plugins/AuthMe/config.yml"));
36-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName("AuthMe"));
37-
$this->addSolution((new PluginRemoveSolution())->setPluginName("AuthMe"));
34+
$this->addSolution(new AuthMeShutdownSolution());
35+
$this->addSolution(new PluginConfigureSolution("AuthMe", "plugins/AuthMe/config.yml"));
36+
$this->addSolution(new PluginInstallDifferentVersionSolution("AuthMe"));
37+
$this->addSolution(new PluginRemoveSolution("AuthMe"));
3838
}
3939
}

src/Analysis/Problem/Bukkit/Plugin/MultiverseLoadProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function setMatches(array $matches, mixed $patternKey): void
4141
{
4242
$this->worldName = $matches[1];
4343

44-
$this->addSolution((new WorldRepairSolution())->setWorldName($this->getWorldName()));
45-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getWorldName()));
44+
$this->addSolution(new WorldRepairSolution($this->getWorldName()));
45+
$this->addSolution(new FileDeleteSolution($this->getWorldName()));
4646
}
4747
}

src/Analysis/Problem/Bukkit/Plugin/PermissionsExConfigProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function getPatterns(): array
2929
*/
3030
public function setMatches(array $matches, mixed $patternKey): void
3131
{
32-
$this->addSolution((new PluginConfigureSolution())->setPluginName("PermissionsEx")->setSuggestedFile("plugins/PermissionsEx/permissions.yml"));
33-
$this->addSolution((new PluginRemoveSolution())->setPluginName("PermissionsEx"));
32+
$this->addSolution(new PluginConfigureSolution("PermissionsEx", "plugins/PermissionsEx/permissions.yml"));
33+
$this->addSolution(new PluginRemoveSolution("PermissionsEx"));
3434
}
3535
}

src/Analysis/Problem/Bukkit/PluginCommandExceptionProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public function setMatches(array $matches, mixed $patternKey): void
3838
$this->command = $matches[1];
3939
$this->pluginName = $matches[2];
4040

41-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
42-
$this->addSolution((new PluginRemoveSolution())->setPluginName($this->getPluginName()));
41+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
42+
$this->addSolution(new PluginRemoveSolution($this->getPluginName()));
4343
}
4444

4545
/**

src/Analysis/Problem/Bukkit/PluginDependenciesProblem.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ public function setMatches(array $matches, mixed $patternKey): void
7373
if ($matches[4]) {
7474
$this->pluginName = $matches[4];
7575
$this->pluginFilePath = $this->correctPluginPath($matches[1]);
76-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
77-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
76+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
77+
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
7878
} else {
7979
parent::setMatches($matches, $patternKey);
8080
}
8181

8282
$this->dependencyPluginNames = preg_split("/, ?/", $matches[3]);
8383
foreach ($this->dependencyPluginNames as $name) {
84-
$this->addSolution((new PluginInstallSolution())->setPluginName($name));
84+
$this->addSolution(new PluginInstallSolution($name));
8585
}
8686
}
8787

src/Analysis/Problem/Bukkit/PluginDependencyProblem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function setMatches(array $matches, mixed $patternKey): void
4747
parent::setMatches($matches, $patternKey);
4848

4949
$this->dependencyPluginName = $matches[3] ?: $matches[4];
50-
$this->addSolution((new PluginInstallSolution())->setPluginName($this->getDependencyPluginName()));
50+
$this->addSolution(new PluginInstallSolution($this->getDependencyPluginName()));
5151
}
5252

5353
/**

src/Analysis/Problem/Bukkit/PluginFileProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function setMatches(array $matches, mixed $patternKey): void
4141
$this->pluginFilePath = $folderPath . '/' . $pluginFileName;
4242
$this->pluginName = $this->extractPluginName($matches[1]);
4343

44-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
45-
$this->addSolution((new FileDeleteSolution())->setRelativePath($this->getPluginFilePath()));
44+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
45+
$this->addSolution(new FileDeleteSolution($this->getPluginFilePath()));
4646
}
4747

4848
/**

src/Analysis/Problem/Bukkit/PluginProblem.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public function setMatches(array $matches, mixed $patternKey): void
3737
{
3838
$this->pluginName = $this->extractPluginName($matches[1]);
3939

40-
$this->addSolution((new PluginInstallDifferentVersionSolution())->setPluginName($this->getPluginName()));
41-
$this->addSolution((new PluginRemoveSolution())->setPluginName($this->getPluginName()));
40+
$this->addSolution(new PluginInstallDifferentVersionSolution($this->getPluginName()));
41+
$this->addSolution(new PluginRemoveSolution($this->getPluginName()));
4242
}
4343

4444
/**

0 commit comments

Comments
 (0)