Skip to content

Commit 4907a18

Browse files
committed
Merge remote-tracking branch 'upstream/develop' into 4.5
2 parents 4a5cb90 + 502be28 commit 4907a18

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

app/Config/Publisher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Publisher extends BasePublisher
1919
* result in a PublisherException. Files that do no fit the
2020
* pattern will cause copy/merge to fail.
2121
*
22-
* @var array<string,string>
22+
* @var array<string, string>
2323
*/
2424
public $restrictions = [
2525
ROOTPATH => '*',

system/Autoloader/FileLocator.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
119119
*/
120120
public function getClassname(string $file): string
121121
{
122+
if (is_dir($file)) {
123+
return '';
124+
}
125+
122126
$php = file_get_contents($file);
123127
$tokens = token_get_all($php);
124128
$dlm = false;

system/Config/Publisher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Publisher extends BaseConfig
2626
* result in a PublisherException. Files that do no fit the
2727
* pattern will cause copy/merge to fail.
2828
*
29-
* @var array<string,string>
29+
* @var array<string, string>
3030
*/
3131
public $restrictions = [
3232
ROOTPATH => '*',

system/Config/Routing.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Routing extends BaseConfig
2424
* Default: APPPATH . 'Config/Routes.php'
2525
*/
2626
public array $routeFiles = [
27-
APPPATH . 'Routes.php',
27+
APPPATH . 'Config/Routes.php',
2828
];
2929

3030
/**
@@ -95,4 +95,17 @@ class Routing extends BaseConfig
9595
* Default: false
9696
*/
9797
public bool $prioritize = false;
98+
99+
/**
100+
* Map of URI segments and namespaces. For Auto Routing (Improved).
101+
*
102+
* The key is the first URI segment. The value is the controller namespace.
103+
* E.g.,
104+
* [
105+
* 'blog' => 'Acme\Blog\Controllers',
106+
* ]
107+
*
108+
* @var array [ uri_segment => namespace ]
109+
*/
110+
public array $moduleRoutes = [];
98111
}

tests/system/Autoloader/FileLocatorTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,4 +313,12 @@ public function testGetClassNameFromNonClassFile(): void
313313
$this->locator->getClassname(SYSTEMPATH . 'bootstrap.php')
314314
);
315315
}
316+
317+
public function testGetClassNameFromDirectory(): void
318+
{
319+
$this->assertSame(
320+
'',
321+
$this->locator->getClassname(SYSTEMPATH)
322+
);
323+
}
316324
}

0 commit comments

Comments
 (0)