@@ -73,6 +73,7 @@ public function build(string $themePath, SymfonyStyle $io, OutputInterface $outp
7373 }
7474
7575 // Deploy static content
76+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- basename is safe here for extracting theme name from validated path
7677 $ themeCode = basename ($ themePath );
7778 if (!$ this ->staticContentDeployer ->deploy ($ themeCode , $ io , $ output , $ isVerbose )) {
7879 return false ;
@@ -115,6 +116,7 @@ private function buildTheme(string $themePath, SymfonyStyle $io, bool $isVerbose
115116
116117 // Change to tailwind directory and run build
117118 $ currentDir = getcwd ();
119+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary for npm to run in correct context
118120 chdir ($ tailwindPath );
119121
120122 try {
@@ -125,10 +127,12 @@ private function buildTheme(string $themePath, SymfonyStyle $io, bool $isVerbose
125127 if ($ isVerbose ) {
126128 $ io ->success ('Hyvä theme build completed successfully. ' );
127129 }
130+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary to restore original directory
128131 chdir ($ currentDir );
129132 return true ;
130133 } catch (\Exception $ e ) {
131134 $ io ->error ('Failed to build Hyvä theme: ' . $ e ->getMessage ());
135+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary to restore original directory
132136 chdir ($ currentDir );
133137 return false ;
134138 }
@@ -163,6 +167,7 @@ private function installNodeModules(string $tailwindPath, SymfonyStyle $io, bool
163167 }
164168
165169 $ currentDir = getcwd ();
170+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary for npm to run in correct context
166171 chdir ($ tailwindPath );
167172
168173 try {
@@ -179,10 +184,12 @@ private function installNodeModules(string $tailwindPath, SymfonyStyle $io, bool
179184 $ io ->success ('Node modules installed successfully. ' );
180185 }
181186
187+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary to restore original directory
182188 chdir ($ currentDir );
183189 return true ;
184190 } catch (\Exception $ e ) {
185191 $ io ->error ('Failed to install node modules: ' . $ e ->getMessage ());
192+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary to restore original directory
186193 chdir ($ currentDir );
187194 return false ;
188195 }
@@ -194,6 +201,7 @@ private function installNodeModules(string $tailwindPath, SymfonyStyle $io, bool
194201 private function checkOutdatedPackages (string $ tailwindPath , SymfonyStyle $ io ): void
195202 {
196203 $ currentDir = getcwd ();
204+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary for npm to run in correct context
197205 chdir ($ tailwindPath );
198206
199207 try {
@@ -206,6 +214,7 @@ private function checkOutdatedPackages(string $tailwindPath, SymfonyStyle $io):
206214 // Ignore errors from npm outdated as it returns non-zero when packages are outdated
207215 }
208216
217+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary to restore original directory
209218 chdir ($ currentDir );
210219 }
211220
@@ -226,6 +235,7 @@ public function watch(string $themePath, SymfonyStyle $io, OutputInterface $outp
226235 }
227236
228237 try {
238+ // phpcs:ignore MEQP1.Security.DiscouragedFunction -- chdir is necessary for npm to run in correct context
229239 chdir ($ tailwindPath );
230240 passthru ('npm run watch ' );
231241 } catch (\Exception $ e ) {
0 commit comments