55namespace DrevOps \VortexInstaller \Prompts \Handlers ;
66
77use AlexSkrypnyk \File \ExtendedSplFileInfo ;
8- use DrevOps \VortexInstaller \Utils \ComposerJson ;
8+ use DrevOps \VortexInstaller \Utils \JsonManipulator ;
99use DrevOps \VortexInstaller \Utils \File ;
1010use DrevOps \VortexInstaller \Utils \Strings ;
1111use DrevOps \VortexInstaller \Utils \Yaml ;
@@ -67,8 +67,8 @@ public function discover(): null|string|bool|array {
6767
6868 $ tools = [];
6969
70- $ cj = ComposerJson ::fromFile ($ this ->dstDir . '/composer.json ' );
71- if ($ cj instanceof ComposerJson ) {
70+ $ cj = JsonManipulator ::fromFile ($ this ->dstDir . '/composer.json ' );
71+ if ($ cj instanceof JsonManipulator ) {
7272 foreach (static ::getToolDefinitions ('tools ' ) as $ tool => $ config ) {
7373 if (isset ($ config ['present ' ]) && $ config ['present ' ] instanceof \Closure && $ config ['present ' ]->bindTo ($ this )()) {
7474 $ tools [] = $ tool ;
@@ -120,8 +120,8 @@ protected function processTool(string $name): void {
120120 // Remove dependencies from composer.json.
121121 if (isset ($ tool ['composer.json ' ]) && is_callable ($ tool ['composer.json ' ])) {
122122 $ composer_path = $ this ->tmpDir . '/composer.json ' ;
123- $ cj = ComposerJson ::fromFile ($ composer_path );
124- if ($ cj instanceof ComposerJson ) {
123+ $ cj = JsonManipulator ::fromFile ($ composer_path );
124+ if ($ cj instanceof JsonManipulator ) {
125125 $ tool ['composer.json ' ]($ cj );
126126 file_put_contents ($ composer_path , $ cj ->getContents ());
127127 }
@@ -186,7 +186,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
186186 File::contains ($ this ->dstDir . '/composer.json ' , 'drupal/coder ' ) ||
187187 File::contains ($ this ->dstDir . '/composer.json ' , 'squizlabs/php_codesniffer ' );
188188 },
189- 'composer.json ' => function (ComposerJson $ cj ): void {
189+ 'composer.json ' => function (JsonManipulator $ cj ): void {
190190 $ cj ->removeSubNode ('require-dev ' , 'dealerdirect/phpcodesniffer-composer-installer ' );
191191 $ cj ->removeSubNode ('require-dev ' , 'drupal/coder ' );
192192 $ cj ->removeSubNode ('require-dev ' , 'squizlabs/php_codesniffer ' );
@@ -205,7 +205,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
205205 return File::contains ($ this ->dstDir . '/composer.json ' , 'phpstan/phpstan ' ) ||
206206 File::contains ($ this ->dstDir . '/composer.json ' , 'mglaman/phpstan-drupal ' );
207207 },
208- 'composer.json ' => function (ComposerJson $ cj ): void {
208+ 'composer.json ' => function (JsonManipulator $ cj ): void {
209209 $ cj ->removeSubNode ('require-dev ' , 'phpstan/phpstan ' );
210210 $ cj ->removeSubNode ('require-dev ' , 'mglaman/phpstan-drupal ' );
211211 },
@@ -222,7 +222,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
222222 'present ' => function (): mixed {
223223 return File::contains ($ this ->dstDir . '/composer.json ' , 'rector/rector ' );
224224 },
225- 'composer.json ' => function (ComposerJson $ cj ): void {
225+ 'composer.json ' => function (JsonManipulator $ cj ): void {
226226 $ cj ->removeSubNode ('require-dev ' , 'rector/rector ' );
227227 },
228228 'files ' => ['rector.php ' ],
@@ -235,7 +235,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
235235 'present ' => function (): mixed {
236236 return File::contains ($ this ->dstDir . '/composer.json ' , 'phpmd/phpmd ' );
237237 },
238- 'composer.json ' => function (ComposerJson $ cj ): void {
238+ 'composer.json ' => function (JsonManipulator $ cj ): void {
239239 $ cj ->removeSubNode ('require-dev ' , 'phpmd/phpmd ' );
240240 },
241241 'files ' => ['phpmd.xml ' ],
@@ -251,7 +251,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
251251 'present ' => function (): mixed {
252252 return File::contains ($ this ->dstDir . '/composer.json ' , 'phpunit/phpunit ' );
253253 },
254- 'composer.json ' => function (ComposerJson $ cj ): void {
254+ 'composer.json ' => function (JsonManipulator $ cj ): void {
255255 $ cj ->removeSubNode ('require-dev ' , 'phpunit/phpunit ' );
256256 $ cj ->removeProperty ('autoload-dev.classmap ' );
257257 $ cj ->removeMainKeyIfEmpty ('autoload-dev ' );
@@ -281,7 +281,7 @@ public static function getToolDefinitions(string $filter = 'all'): array {
281281 return File::contains ($ this ->dstDir . '/composer.json ' , 'behat/behat ' ) ||
282282 File::contains ($ this ->dstDir . '/composer.json ' , 'drupal/drupal-extension ' );
283283 },
284- 'composer.json ' => function (ComposerJson $ cj ): void {
284+ 'composer.json ' => function (JsonManipulator $ cj ): void {
285285 $ cj ->removeSubNode ('require-dev ' , 'behat/behat ' );
286286 $ cj ->removeSubNode ('require-dev ' , 'drupal/drupal-extension ' );
287287 $ cj ->removeSubNode ('require-dev ' , 'dantleech/gherkin-lint ' );
0 commit comments