diff --git a/%plugin_name%.php b/%plugin_name%.php index 4d3d511..664bd26 100644 --- a/%plugin_name%.php +++ b/%plugin_name%.php @@ -1,4 +1,5 @@ getMessage()}\n"; $failed++; @@ -97,7 +97,7 @@ function run(string $command): array $process = proc_open($command.' 2>&1', $descriptors, $pipes); if (! is_resource($process)) { - throw new \RuntimeException("could not run: {$command}"); + throw new RuntimeException("could not run: {$command}"); } $out = stream_get_contents($pipes[1]) ?: ''; @@ -112,7 +112,7 @@ function wpEval(string $php): string $result = run('wp eval '.escapeshellarg($php)); if ($result['code'] !== 0) { - throw new \RuntimeException("wp eval failed: {$result['out']}"); + throw new RuntimeException("wp eval failed: {$result['out']}"); } return $result['out']; @@ -176,14 +176,14 @@ function ensureActiveTheme(): void .' --theme-version=1.0.0 --no-interaction'); if ($scaffold['code'] !== 0) { - throw new \RuntimeException("could not scaffold a theme: {$scaffold['out']}"); + throw new RuntimeException("could not scaffold a theme: {$scaffold['out']}"); } $installed = array_values(array_filter(explode("\n", run('wp theme list --field=name')['out']))); } if ($installed === []) { - throw new \RuntimeException('the site still has no theme after scaffolding one'); + throw new RuntimeException('the site still has no theme after scaffolding one'); } $active = run('wp theme list --status=active --field=name')['out']; @@ -195,7 +195,7 @@ function ensureActiveTheme(): void $activated = run('wp theme activate '.escapeshellarg($installed[0])); if ($activated['code'] !== 0) { - throw new \RuntimeException("could not activate {$installed[0]}: {$activated['out']}"); + throw new RuntimeException("could not activate {$installed[0]}: {$activated['out']}"); } } @@ -210,7 +210,7 @@ function pluginsDirectory(): string $path = wpEval('echo WP_PLUGIN_DIR;'); if ($path === '' || ! is_dir($path)) { - throw new \RuntimeException("WP_PLUGIN_DIR is {$path}, which does not exist"); + throw new RuntimeException("WP_PLUGIN_DIR is {$path}, which does not exist"); } return $path; diff --git a/bin/replacements.php b/bin/replacements.php index 3e440f2..8f81971 100644 --- a/bin/replacements.php +++ b/bin/replacements.php @@ -19,7 +19,7 @@ * placeholder the scaffolder does not substitute": a key that disappears here * or a token that appears in the template without a key both fail it. * - * @return array placeholder => a plausible substituted value + * @return array placeholder => a plausible substituted value */ function scaffolderReplacements(string $name = 'my-plugin'): array { diff --git a/bin/tests/compat.php b/bin/tests/compat.php index a359907..3d448f9 100644 --- a/bin/tests/compat.php +++ b/bin/tests/compat.php @@ -39,7 +39,7 @@ function scaffoldedPluginFile(): string $source = pluginPath('%plugin_name%.php'); if (! is_file($source)) { - throw new \RuntimeException('the template has no %plugin_name%.php — the main file was renamed'); + throw new RuntimeException('the template has no %plugin_name%.php — the main file was renamed'); } $replacements = scaffolderReplacements(TEST_SLUG); @@ -131,7 +131,7 @@ function checkRegistrationGuard(): void return str_starts_with($result['out'], 'pollora_register:plugin:'.TEST_SLUG) ? true - : "expected pollora_register:plugin:".TEST_SLUG.", got '{$result['out']}'"; + : 'expected pollora_register:plugin:'.TEST_SLUG.", got '{$result['out']}'"; }); test('Framework >= 13.32: does not also call the registrar', function () { @@ -151,7 +151,7 @@ function checkRegistrationGuard(): void return str_starts_with($result['out'], 'registrar::register:'.TEST_SLUG) ? true - : "expected registrar::register:".TEST_SLUG.", got '{$result['out']}'"; + : 'expected registrar::register:'.TEST_SLUG.", got '{$result['out']}'"; }); test('Neither is available: leaves the plugin unregistered, without a fatal', function () { diff --git a/bin/tests/contract.php b/bin/tests/contract.php index 0a2b5e8..be7d253 100644 --- a/bin/tests/contract.php +++ b/bin/tests/contract.php @@ -24,7 +24,7 @@ const CODE_NAMES = ['pollora-demo-plugin', 'PolloraDemoPlugin', 'pollora_demo_plugin', 'POLLORA_DEMO_PLUGIN']; /** - * @return array every shipped file, repository-relative + * @return array every shipped file, repository-relative */ function shippedFiles(): array { diff --git a/bin/tests/lib.php b/bin/tests/lib.php index 78c8b3b..c50fb8e 100644 --- a/bin/tests/lib.php +++ b/bin/tests/lib.php @@ -13,7 +13,6 @@ * A check returns true (pass), or a string explaining the failure. There is no * skip: a check that cannot fail is the defect this suite exists to prevent. */ - final class Results { public static int $passed = 0; @@ -35,7 +34,7 @@ function test(string $name, callable $fn): void { try { $result = $fn(); - } catch (\Throwable $e) { + } catch (Throwable $e) { echo " \033[31m✗\033[0m {$name} — {$e->getMessage()}\n"; Results::$failed++; @@ -99,7 +98,7 @@ function phpRun(string $code): array if (! is_resource($process)) { unlink($file); - throw new \RuntimeException('could not start a PHP process'); + throw new RuntimeException('could not start a PHP process'); } $out = stream_get_contents($pipes[1]) ?: '';