Skip to content

Commit 11d0631

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.6
Conflicts: phpstan-baseline.php
2 parents cd82a0d + d6d1434 commit 11d0631

File tree

9 files changed

+3210
-46
lines changed

9 files changed

+3210
-46
lines changed

phpstan-baseline.php

Lines changed: 3148 additions & 41 deletions
Large diffs are not rendered by default.

system/Commands/Database/ShowTableInfo.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,11 @@ private function restoreDBPrefix(): void
188188
$this->db->setPrefix($this->DBPrefix);
189189
}
190190

191+
/**
192+
* Show Data of Table
193+
*
194+
* @return void
195+
*/
191196
private function showDataOfTable(string $tableName, int $limitRows, int $limitFieldValue)
192197
{
193198
CLI::write("Data of Table \"{$tableName}\":", 'black', 'yellow');
@@ -207,6 +212,13 @@ private function showDataOfTable(string $tableName, int $limitRows, int $limitFi
207212
CLI::table($this->tbody, $thead);
208213
}
209214

215+
/**
216+
* Show All Tables
217+
*
218+
* @param list<string> $tables
219+
*
220+
* @return void
221+
*/
210222
private function showAllTables(array $tables)
211223
{
212224
CLI::write('The following is a list of the names of all database tables:', 'black', 'yellow');
@@ -219,6 +231,13 @@ private function showAllTables(array $tables)
219231
CLI::newLine();
220232
}
221233

234+
/**
235+
* Make body for table
236+
*
237+
* @param list<string> $tables
238+
*
239+
* @return list<list<int|string>>
240+
*/
222241
private function makeTbodyForShowAllTables(array $tables): array
223242
{
224243
$this->removeDBPrefix();
@@ -244,6 +263,11 @@ private function makeTbodyForShowAllTables(array $tables): array
244263
return $this->tbody;
245264
}
246265

266+
/**
267+
* Make table rows
268+
*
269+
* @return list<list<int|string>>
270+
*/
247271
private function makeTableRows(
248272
string $tableName,
249273
int $limitRows,

system/Commands/ListCommands.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ public function run(array $params)
8585

8686
/**
8787
* Lists the commands with accompanying info.
88+
*
89+
* @return void
8890
*/
8991
protected function listFull(array $commands)
9092
{
@@ -126,6 +128,8 @@ protected function listFull(array $commands)
126128

127129
/**
128130
* Lists the commands only.
131+
*
132+
* @return void
129133
*/
130134
protected function listSimple(array $commands)
131135
{

system/Commands/Utilities/Routes/AutoRouterImproved/AutoRouteCollector.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ final class AutoRouteCollector
2727
* @param string $namespace namespace to search
2828
* @param list<class-string> $protectedControllers List of controllers in Defined
2929
* Routes that should not be accessed via Auto-Routing.
30+
* @param list<string> $httpMethods
3031
* @param string $prefix URI prefix for Module Routing
3132
*/
3233
public function __construct(
@@ -91,6 +92,13 @@ public function get(): array
9192
return $tbody;
9293
}
9394

95+
/**
96+
* Adding Filters
97+
*
98+
* @param list<array<string, array|string>> $routes
99+
*
100+
* @return list<array<string, array|string>>
101+
*/
94102
private function addFilters($routes)
95103
{
96104
$filterCollector = new FilterCollector(true);

system/Commands/Utilities/Routes/FilterFinder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
use CodeIgniter\Exceptions\PageNotFoundException;
1717
use CodeIgniter\Filters\Filters;
18+
use CodeIgniter\HTTP\Exceptions\BadRequestException;
1819
use CodeIgniter\HTTP\Exceptions\RedirectException;
1920
use CodeIgniter\Router\Router;
2021
use Config\Feature;
@@ -72,7 +73,7 @@ public function find(string $uri): array
7273
'before' => [],
7374
'after' => [],
7475
];
75-
} catch (PageNotFoundException) {
76+
} catch (BadRequestException|PageNotFoundException) {
7677
return [
7778
'before' => ['<unknown>'],
7879
'after' => ['<unknown>'],

system/Config/BaseService.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ public static function serviceExists(string $name): ?string
346346
* Reset shared instances and mocks for testing.
347347
*
348348
* @return void
349+
*
350+
* @testTag only available to test code
349351
*/
350352
public static function reset(bool $initAutoloader = true)
351353
{
@@ -362,6 +364,8 @@ public static function reset(bool $initAutoloader = true)
362364
* Resets any mock and shared instances for a single service.
363365
*
364366
* @return void
367+
*
368+
* @testTag only available to test code
365369
*/
366370
public static function resetSingle(string $name)
367371
{
@@ -375,6 +379,8 @@ public static function resetSingle(string $name)
375379
* @param object $mock
376380
*
377381
* @return void
382+
*
383+
* @testTag only available to test code
378384
*/
379385
public static function injectMock(string $name, $mock)
380386
{

system/Database/BaseBuilder.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,11 +1448,12 @@ public function orHaving($key, $value = null, ?bool $escape = null)
14481448
*/
14491449
public function orderBy(string $orderBy, string $direction = '', ?bool $escape = null)
14501450
{
1451-
$qbOrderBy = [];
14521451
if ($orderBy === '') {
14531452
return $this;
14541453
}
14551454

1455+
$qbOrderBy = [];
1456+
14561457
$direction = strtoupper(trim($direction));
14571458

14581459
if ($direction === 'RANDOM') {
@@ -1463,7 +1464,7 @@ public function orderBy(string $orderBy, string $direction = '', ?bool $escape =
14631464
$direction = in_array($direction, ['ASC', 'DESC'], true) ? ' ' . $direction : '';
14641465
}
14651466

1466-
if (! is_bool($escape)) {
1467+
if ($escape === null) {
14671468
$escape = $this->db->protectIdentifiers;
14681469
}
14691470

@@ -1474,8 +1475,6 @@ public function orderBy(string $orderBy, string $direction = '', ?bool $escape =
14741475
'escape' => false,
14751476
];
14761477
} else {
1477-
$qbOrderBy = [];
1478-
14791478
foreach (explode(',', $orderBy) as $field) {
14801479
$qbOrderBy[] = ($direction === '' && preg_match('/\s+(ASC|DESC)$/i', rtrim($field), $match, PREG_OFFSET_CAPTURE))
14811480
? [

system/Router/Router.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public function __construct(RouteCollectionInterface $routes, ?Request $request
189189
*
190190
* @return (Closure(mixed...): (ResponseInterface|string|void))|string Controller classname or Closure
191191
*
192+
* @throws BadRequestException
192193
* @throws PageNotFoundException
193194
* @throws RedirectException
194195
*/

tests/system/Commands/RoutesTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,18 @@ public function testRoutesCommandRouteLegacy(): void
240240
EOL;
241241
$this->assertStringContainsString($expected, $this->getBuffer());
242242
}
243+
244+
public function testRoutesCommandRouteWithRegexp(): void
245+
{
246+
$routes = Services::routes();
247+
$routes->resetRoutes();
248+
$routes->options('picker/(.+)', 'Options::index');
249+
250+
command('routes');
251+
252+
$expected = <<<'EOL'
253+
| OPTIONS | picker/(.+) | » | \App\Controllers\Options::index | <unknown> | <unknown> |
254+
EOL;
255+
$this->assertStringContainsString($expected, $this->getBuffer());
256+
}
243257
}

0 commit comments

Comments
 (0)