Skip to content

Commit

Permalink
Bump XdebugHandler to min 3.x (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry authored Feb 21, 2022
1 parent 6dcfac9 commit bba6754
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"composer-plugin-api": "^2.2",
"amphp/parallel-functions": "^1.1",
"composer/semver": "^3.2",
"composer/xdebug-handler": "^2.0 || ^3.0",
"composer/xdebug-handler": "^3.0",
"humbug/php-scoper": "^0.17",
"justinrainbow/json-schema": "^5.2.9",
"laravel/serializable-closure": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 6 additions & 16 deletions src/Console/Php/PhpSettingsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
*/
final class PhpSettingsHandler extends XdebugHandler
{
private $logger;
private $pharReadonly;
private LoggerInterface $logger;
private bool $pharReadonly;

public function __construct(LoggerInterface $logger)
{
Expand All @@ -55,13 +55,7 @@ public function check(): void
parent::check();
}

/**
* TODO: bump to XdebugHandler v3
* No type hint to allow XdebugHandler version 2.
*
* {@inheritdoc}
*/
protected function requiresRestart($default): bool
protected function requiresRestart(bool $default): bool
{
if ($this->pharReadonly) {
$this->logger->debug('phar.readonly is enabled');
Expand All @@ -74,11 +68,7 @@ protected function requiresRestart($default): bool
return parent::requiresRestart($default);
}

/**
* No type hint to allow XdebugHandler version 2
* {@inheritdoc}
*/
protected function restart($command): void
protected function restart(array $command): void
{
// Disable phar.readonly if set
$this->disablePharReadonly();
Expand Down Expand Up @@ -107,13 +97,13 @@ private function bumpMemoryLimit(): void
$memoryLimit = trim(ini_get('memory_limit'));
$memoryLimitInBytes = '-1' === $memoryLimit ? -1 : memory_to_bytes($memoryLimit);

// Whether or not the memory limit should be dumped
// Whether the memory limit should be dumped
$bumpMemoryLimit = (
null === $userDefinedMemoryLimit
&& -1 !== $memoryLimitInBytes
&& $memoryLimitInBytes < 1024 * 1024 * 512
);
// Whether or not the memory limit should be set to the user defined memory limit
// Whether the memory limit should be set to the user defined memory limit
$setUserDefinedMemoryLimit = (
null !== $userDefinedMemoryLimit
&& $memoryLimitInBytes !== $userDefinedMemoryLimit
Expand Down

0 comments on commit bba6754

Please sign in to comment.