2626use Symfony \Component \Finder \Finder ;
2727use Symfony \Component \Process \Process ;
2828
29+ use function Safe \file_get_contents ;
30+
2931/**
3032 * Represents the command responsible for installing development scripts into `composer.json`.
3133 * This class MUST NOT be overridden and SHALL rely on the `ScriptsInstallerTrait`.
@@ -70,6 +72,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7072 $ this ->updateComposerJson ();
7173 $ this ->createGitHubActionWorkflows ();
7274 $ this ->copyEditorConfig ();
75+ $ this ->copyDependabotConfig ();
7376 $ this ->addRepositoryWikiGitSubmodule ();
7477
7578 return self ::SUCCESS ;
@@ -91,7 +94,7 @@ private function updateComposerJson(): void
9194 return ;
9295 }
9396
94- $ contents = $ this -> filesystem -> readFile ($ file );
97+ $ contents = file_get_contents ($ file );
9598 $ manipulator = new JsonManipulator ($ contents );
9699
97100 $ scripts = [
@@ -141,7 +144,7 @@ private function createGitHubActionWorkflows(): void
141144 continue ;
142145 }
143146
144- $ content = $ this -> filesystem -> readFile ($ file ->getRealPath ());
147+ $ content = file_get_contents ($ file ->getRealPath ());
145148 $ this ->filesystem ->dumpFile ($ targetPath , $ content );
146149 }
147150 }
@@ -163,7 +166,27 @@ private function copyEditorConfig(): void
163166 return ;
164167 }
165168
166- $ content = $ this ->filesystem ->readFile ($ source );
169+ $ content = file_get_contents ($ source );
170+ $ this ->filesystem ->dumpFile ($ target , $ content );
171+ }
172+
173+ /**
174+ * Installs the dependabot.yml configuration file in the .github directory if it does not exist.
175+ *
176+ * This method copies the dependabot.yml from the package resources to .github/dependabot.yml if it is not already present.
177+ *
178+ * @return void
179+ */
180+ private function copyDependabotConfig (): void
181+ {
182+ $ source = parent ::getDevToolsFile ('dependabot.yml ' );
183+ $ target = parent ::getConfigFile ('.github/dependabot.yml ' , true );
184+
185+ if ($ this ->filesystem ->exists ($ target )) {
186+ return ;
187+ }
188+
189+ $ content = file_get_contents ($ source );
167190 $ this ->filesystem ->dumpFile ($ target , $ content );
168191 }
169192
0 commit comments