Skip to content

Commit

Permalink
Support level 10 (#787)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Dec 13, 2024
1 parent 635866c commit 9d7c22b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion lib/RexResultsRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ public static function getResultEmoji(int $level): string
case 9:
$emoji = '🏆';
break;
case 10:
$emoji = '👑';
break;
}
return $emoji;
}

public static function getLevel9Jseffect(): string
public static function getLevel10Jseffect(): string
{
$nonce = method_exists(rex_response::class, 'getNonce') ? ' nonce="'.rex_response::getNonce().'"' : '';
return
Expand Down
4 changes: 2 additions & 2 deletions lib/RexStanSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ public static function createForm()
self::fixAbsoluteToRelativePaths();

$form = rex_config_form::factory('rexstan');
$field = $form->addInputField('number', 'level', null, ['class' => 'form-control', 'min' => 0, 'max' => 9]);
$field = $form->addInputField('number', 'level', null, ['class' => 'form-control', 'min' => 0, 'max' => 10]);
$field->setLabel('Level');
$field->setNotice('von 0 einfach, bis 9 sehr strikt - <a href="https://phpstan.org/user-guide/rule-levels">PHPStan Rule Levels</a>');
$field->setNotice('von 0 einfach, bis 10 sehr strikt - <a href="https://phpstan.org/user-guide/rule-levels">PHPStan Rule Levels</a>');

$field = $form->addCheckboxField('baseline');
$field->addOption('Baseline verwenden', self::BASELINE_ENABLED);
Expand Down
2 changes: 1 addition & 1 deletion lib/command.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$arguments = '';
if ($input->getOption('level') !== null) {
$level = $input->getOption('level');
if (!preg_match('/^[0-9]$/', $level)) {
if (!preg_match('/^1?[0-9]$/', $level)) {
throw new Exception('Invalid level: '. $level);
}
$arguments .= ' --level='.$level;
Expand Down
4 changes: 2 additions & 2 deletions pages/analysis.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
echo '<span class="rexstan-achievement">'.$emoji .'</span>';
echo rex_view::success('Gratulation, es wurden keine Fehler in Level '. $level .' gefunden.');

if ($level === 9) {
echo RexResultsRenderer::getLevel9Jseffect();
if ($level === 10) {
echo RexResultsRenderer::getLevel10Jseffect();
} else {
echo '<p>';

Expand Down

0 comments on commit 9d7c22b

Please sign in to comment.