Skip to content

Commit

Permalink
Merge branch '2.x' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Jan 10, 2024
2 parents 7dacbd1 + cfb7436 commit 8420d8c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"license": "MIT",
"require": {
"php": "^8.2",
"phpstan/phpstan": "^1.10.52",
"phpstan/phpstan": "^1.10.55",
"tomasvotruba/type-coverage": "^0.2.1",
"pestphp/pest-plugin": "^3.0.0"
},
Expand Down
22 changes: 22 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,28 @@ public function handleArguments(array $arguments): array
$this->coverageMin = (float) explode('=', $argument)[1];
}

if (str_starts_with($argument, '--memory-limit')) {
$memoryLimit = explode('=', $argument)[1] ?? '';

if (preg_match('/^-?\d+[kMG]?$/', $memoryLimit) !== 1) {
View::render('components.badge', [
'type' => 'ERROR',
'content' => 'Invalid memory limit: '.$memoryLimit,
]);

$this->exit(1);
}

if (ini_set('memory_limit', $memoryLimit) === false) {
View::render('components.badge', [
'type' => 'ERROR',
'content' => 'Failed to set memory limit: '.$memoryLimit,
]);

$this->exit(1);
}
}

if (str_starts_with($argument, '--type-coverage-json')) {
$outputPath = explode('=', $argument)[1] ?? null;

Expand Down

0 comments on commit 8420d8c

Please sign in to comment.