Skip to content

Commit d77b8d2

Browse files
committed
Merge branch 'release/0.11.x'
2 parents 97ed6a0 + f01a22e commit d77b8d2

File tree

5 files changed

+36
-35
lines changed

5 files changed

+36
-35
lines changed

.github/workflows/php-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
phpstan-level: 10
1313
allow-style-failures: false
1414
allow-phpstan-failures: false
15-
codestyle-branch: '0.10.2'
15+
codestyle-branch: '0.11.0'
1616
phpcs-whitelist: tests/phan.config.php tests/phpstan.autoload.inc.php tests/test.bootstrap.inc.php
1717
php-extensions: uopz
1818
stable-php-versions: '["8.1"]'

src/Lunr/Shadow/GetoptCliParser.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,13 @@ protected function wrapArgument(bool|string|array $value): array
112112
{
113113
return [];
114114
}
115-
elseif (is_array($value))
115+
116+
if (is_array($value))
116117
{
117118
return $value;
118119
}
119-
else
120-
{
121-
return [ $value ];
122-
}
120+
121+
return [ $value ];
123122
}
124123

125124
}

src/Lunr/Shadow/LunrCliParser.php

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ public function parse(): array
120120

121121
foreach ($this->args as $index => $arg)
122122
{
123-
if (!in_array($arg, $this->checked) && $index != 0)
123+
if (in_array($arg, $this->checked) || $index == 0)
124124
{
125-
$this->isOpt($arg, $index, TRUE);
125+
continue;
126126
}
127+
128+
$this->isOpt($arg, $index, TRUE);
127129
}
128130

129131
return $this->ast;
@@ -183,12 +185,11 @@ private function isOpt(string $opt, int $index, bool $toplevel = FALSE): bool
183185
{
184186
return $this->isValidLong(substr($param, 1), $index);
185187
}
186-
else
187-
{
188-
return $this->isValidLong($opt, $index);
189-
}
188+
189+
return $this->isValidLong($opt, $index);
190190
}
191-
elseif ($toplevel)
191+
192+
if ($toplevel)
192193
{
193194
trigger_error('Superfluous argument: ' . $opt, E_USER_NOTICE);
194195
}
@@ -235,18 +236,20 @@ private function isValidLong(string $opt, int $index): bool
235236

236237
foreach ($this->long as $key => $arg)
237238
{
238-
if ($opt == substr($arg, 0, strlen($opt)))
239+
if ($opt != substr($arg, 0, strlen($opt)))
239240
{
240-
if (strlen($arg) == strlen($opt))
241-
{
242-
$match = TRUE;
243-
$args = $key;
244-
}
245-
elseif ($arg[strlen($opt)] == ':' || $arg[strlen($opt)] == ';')
246-
{
247-
$match = TRUE;
248-
$args = $key;
249-
}
241+
continue;
242+
}
243+
244+
if (strlen($arg) == strlen($opt))
245+
{
246+
$match = TRUE;
247+
$args = $key;
248+
}
249+
elseif ($arg[strlen($opt)] == ':' || $arg[strlen($opt)] == ';')
250+
{
251+
$match = TRUE;
252+
$args = $key;
250253
}
251254
}
252255

@@ -301,12 +304,11 @@ private function checkArgument(string $opt, int $index, int $pos, string $a): bo
301304
{
302305
return $this->checkArgument($opt, $next, $pos + 1, $a);
303306
}
304-
else
305-
{
306-
return TRUE;
307-
}
307+
308+
return TRUE;
308309
}
309-
elseif ($type == ':')
310+
311+
if ($type == ':')
310312
{
311313
trigger_error('Missing argument for -' . $opt, E_USER_WARNING);
312314
$this->error = TRUE;

tests/phpstan.autoload.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
if (file_exists($base . '/vendor/autoload.php') == TRUE)
1515
{
1616
// Load composer autoloader.
17-
$autoload_file = $base . '/vendor/autoload.php';
17+
$autoloadFile = $base . '/vendor/autoload.php';
1818
}
1919
else
2020
{
2121
// Load decomposer autoloade.
22-
$autoload_file = $base . '/decomposer.autoload.inc.php';
22+
$autoloadFile = $base . '/decomposer.autoload.inc.php';
2323
}
2424

25-
require_once $autoload_file;
25+
require_once $autoloadFile;
2626

2727
// Define application config lookup path
2828
$paths = [

tests/test.bootstrap.inc.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
if (file_exists($base . '/vendor/autoload.php') == TRUE)
2626
{
2727
// Load composer autoloader.
28-
$autoload_file = $base . '/vendor/autoload.php';
28+
$autoloadFile = $base . '/vendor/autoload.php';
2929
}
3030
else
3131
{
3232
// Load decomposer autoloader.
33-
$autoload_file = $base . '/decomposer.autoload.inc.php';
33+
$autoloadFile = $base . '/decomposer.autoload.inc.php';
3434
}
3535

36-
require_once $autoload_file;
36+
require_once $autoloadFile;
3737

3838
define('REFLECTION_BUG_72194', (PHP_MAJOR_VERSION > 5));
3939

0 commit comments

Comments
 (0)