Skip to content

Commit

Permalink
Allow to set PHPStan Pro web port via environment variable (for Docker)
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 29, 2020
1 parent e7203bc commit cec7a55
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Command/FixerApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,13 @@ private function getFixerProcess(OutputInterface $output, int $serverPort): Proc
throw new \PHPStan\Command\FixerProcessException();
}

return new Process(sprintf('%s -d memory_limit=%s %s --port %d', PHP_BINARY, escapeshellarg(ini_get('memory_limit')), escapeshellarg($pharPath), $serverPort), null, null, []);
$env = null;
$forcedPort = $_SERVER['PHPSTAN_PRO_WEB_PORT'] ?? null;
if ($forcedPort !== null) {
$env['PHPSTAN_PRO_WEB_PORT'] = $_SERVER['PHPSTAN_PRO_WEB_PORT'];
}

return new Process(sprintf('%s -d memory_limit=%s %s --port %d', PHP_BINARY, escapeshellarg(ini_get('memory_limit')), escapeshellarg($pharPath), $serverPort), null, $env, []);
}

private function downloadPhar(
Expand Down

0 comments on commit cec7a55

Please sign in to comment.