Skip to content

Commit

Permalink
ISSUE-337: fix phpmd
Browse files Browse the repository at this point in the history
  • Loading branch information
tatevikg1 committed Dec 9, 2024
1 parent 9658c6c commit 822d258
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/Core/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Bootstrap
*/
private ApplicationStructure $applicationStructure;

private ErrorHandler $errorHandler;

/**
* Protected constructor to avoid direct instantiation of this class.
*
Expand All @@ -62,6 +64,7 @@ class Bootstrap
protected function __construct()
{
$this->applicationStructure = new ApplicationStructure();
$this->errorHandler = new ErrorHandler();
}

/**
Expand Down Expand Up @@ -219,7 +222,7 @@ public function dispatch()
private function configureDebugging(): Bootstrap
{
if ($this->isDebugEnabled()) {
ErrorHandler::register();
$this->errorHandler->register();
}

return $this;
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Repository/Identity/AdministratorRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class AdministratorRepository extends AbstractRepository
private HashGenerator $hashGenerator;

public function __construct(
EntityManagerInterface $em,
EntityManagerInterface $entityManager,
ClassMetadata $class,
HashGenerator $hashGenerator = null
) {
parent::__construct($em, $class);
parent::__construct($entityManager, $class);
$this->hashGenerator = $hashGenerator ?? new HashGenerator();
}

Expand Down
14 changes: 7 additions & 7 deletions src/TestingSupport/Traits/SymfonyServerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ trait SymfonyServerTrait
private ?Process $serverProcess = null;

private static string $lockFileName = '.web-server-pid';
private static int $maximumWaitTimeForServerLockFile = 5000000;
private static int $waitTimeBetweenServerCommands = 50000;
private static int $lockWaitTimeout = 5000000;
private static int $serverCommandTimeout = 50000;

private static ?ApplicationStructure $applicationStructure = null;

Expand All @@ -46,9 +46,9 @@ protected function startSymfonyServer(): void
);
$this->serverProcess->start();

usleep(self::$waitTimeBetweenServerCommands);
usleep(self::$serverCommandTimeout);
$this->waitForServerLockFileToAppear();
usleep(self::$waitTimeBetweenServerCommands);
usleep(self::$serverCommandTimeout);
}

private function lockFileExists(): bool
Expand All @@ -73,7 +73,7 @@ protected function getBaseUrl(): string
private function waitForServerLockFileToAppear(): void
{
$currentWaitTime = 0;
while (!$this->lockFileExists() && $currentWaitTime < self::$maximumWaitTimeForServerLockFile) {
while (!$this->lockFileExists() && $currentWaitTime < self::$lockWaitTimeout) {
$process = new Process(['symfony', 'server:status', '--no-ansi']);
$process->run();

Expand All @@ -84,8 +84,8 @@ private function waitForServerLockFileToAppear(): void
file_put_contents(self::$lockFileName, trim($port));
}
}
usleep(self::$waitTimeBetweenServerCommands);
$currentWaitTime += self::$waitTimeBetweenServerCommands;
usleep(self::$serverCommandTimeout);
$currentWaitTime += self::$serverCommandTimeout;
}

if (!$this->lockFileExists()) {
Expand Down

0 comments on commit 822d258

Please sign in to comment.