Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow setting memory limit for commands
- Loading branch information
Showing
22 changed files
with
812 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
parameters: | ||
tmpDir: ./build/cache/phpstan | ||
treatPhpDocTypesAsCertain: false | ||
level: max | ||
paths: | ||
- ./src | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ramsey\Dev\Tools\Command; | ||
|
||
use Ramsey\Dev\Tools\Composer\ExtraConfiguration; | ||
|
||
/** | ||
* @phpstan-import-type CommandDefinition from ExtraConfiguration | ||
*/ | ||
trait MemoryLimitIniOption | ||
{ | ||
/** | ||
* @return string[] | ||
*/ | ||
private function getMemoryLimitOption(): array | ||
{ | ||
/** @var CommandDefinition $commandConfig */ | ||
$commandConfig = $this->extra->commands[(string) $this->getName()] ?? []; | ||
$memoryLimit = $commandConfig['memory-limit'] ?? $this->extra->memoryLimit ?? null; | ||
|
||
if ($memoryLimit !== null) { | ||
return ['-d', "memory_limit=$memoryLimit"]; | ||
} | ||
|
||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ramsey\Dev\Tools\Command; | ||
|
||
use Ramsey\Dev\Tools\Composer\ExtraConfiguration; | ||
|
||
/** | ||
* @phpstan-import-type CommandDefinition from ExtraConfiguration | ||
*/ | ||
trait MemoryLimitLongOption | ||
{ | ||
/** | ||
* @return string[] | ||
*/ | ||
private function getMemoryLimitOption(): array | ||
{ | ||
/** @var CommandDefinition $commandConfig */ | ||
$commandConfig = $this->extra->commands[(string) $this->getName()] ?? []; | ||
$memoryLimit = $commandConfig['memory-limit'] ?? $this->extra->memoryLimit ?? null; | ||
|
||
if ($memoryLimit !== null) { | ||
return ["--memory-limit=$memoryLimit"]; | ||
} | ||
|
||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.