diff --git a/src/Configurator.php b/src/Configurator.php index 56976823b..444abb86a 100644 --- a/src/Configurator.php +++ b/src/Configurator.php @@ -104,7 +104,7 @@ public function unconfigure(Recipe $recipe, Lock $lock) private function get($key): AbstractConfigurator { if (!isset($this->configurators[$key]) && !isset($this->postInstallConfigurators[$key])) { - throw new \InvalidArgumentException(sprintf('Unknown configurator "%s".', $key)); + throw new \InvalidArgumentException(\sprintf('Unknown configurator "%s".', $key)); } if (isset($this->cache[$key])) { diff --git a/src/Configurator/EnvConfigurator.php b/src/Configurator/EnvConfigurator.php index 97c62d6f0..4c252fd2f 100644 --- a/src/Configurator/EnvConfigurator.php +++ b/src/Configurator/EnvConfigurator.php @@ -143,12 +143,12 @@ private function unconfigureEnvFiles(Recipe $recipe, $vars) continue; } - $contents = preg_replace(sprintf('{%s*###> %s ###.*###< %s ###%s+}s', "\n", $recipe->getName(), $recipe->getName(), "\n"), "\n", file_get_contents($env), -1, $count); + $contents = preg_replace(\sprintf('{%s*###> %s ###.*###< %s ###%s+}s', "\n", $recipe->getName(), $recipe->getName(), "\n"), "\n", file_get_contents($env), -1, $count); if (!$count) { continue; } - $this->write(sprintf('Removing environment variables from %s', $file)); + $this->write(\sprintf('Removing environment variables from %s', $file)); file_put_contents($env, $contents); } } @@ -161,12 +161,12 @@ private function unconfigurePhpUnit(Recipe $recipe, $vars) continue; } - $contents = preg_replace(sprintf('{%s*\s+.*%s+}s', "\n", $recipe->getName(), $recipe->getName(), "\n"), "\n", file_get_contents($phpunit), -1, $count); + $contents = preg_replace(\sprintf('{%s*\s+.*%s+}s', "\n", $recipe->getName(), $recipe->getName(), "\n"), "\n", file_get_contents($phpunit), -1, $count); if (!$count) { continue; } - $this->write(sprintf('Removing environment variables from %s', $file)); + $this->write(\sprintf('Removing environment variables from %s', $file)); file_put_contents($phpunit, $contents); } } @@ -265,7 +265,7 @@ private function findExistingValue(string $var, string $filename, Recipe $recipe $lines = explode("\n", $section); foreach ($lines as $line) { - if (0 !== strpos($line, sprintf('%s=', $var))) { + if (!str_starts_with($line, \sprintf('%s=', $var))) { continue; }