Skip to content

Commit

Permalink
add timeout in seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Sep 5, 2024
1 parent 3f36b2d commit 66f8a2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"require": {
"php": ">=8.2",
"illuminate/container": "^11.0",
"illuminate/container": "^11.20",
"nette/robot-loader": "^4.0",
"nette/utils": "^4.0",
"nikic/php-parser": "^4.19",
Expand Down
11 changes: 9 additions & 2 deletions src/Command/PrivatizeConstantsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ final class PrivatizeConstantsCommand extends Command
*/
private const PUBLIC_CONST_REGEX = '#( |\t)(public )?const #ms';

/**
* @var int
*/
private const TIMEOUT_IN_SECONDS = 300;

public function __construct(
private readonly SymfonyStyle $symfonyStyle,
private readonly ClassConstantResultAnalyser $classConstantResultAnalyser,
Expand Down Expand Up @@ -153,15 +158,17 @@ private function runPHPStanAnalyse(array $paths): array
{
$this->symfonyStyle->note('Running PHPStan to spot false-private class constants');

$phpStanAnalyseProcess = new Process([
$commandOptions = [
'vendor/bin/phpstan',
'analyse',
...$paths,
'--configuration',
__DIR__ . '/../../config/privatize-constants-phpstan-ruleset.neon',
'--error-format',
'json',
]);
];

$phpStanAnalyseProcess = new Process($commandOptions, null, null, null, self::TIMEOUT_IN_SECONDS);
$phpStanAnalyseProcess->run();

$this->symfonyStyle->success('PHPStan analysis finished');
Expand Down

0 comments on commit 66f8a2f

Please sign in to comment.