Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into 4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 19, 2023
2 parents 4a5cb90 + 502be28 commit 4907a18
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Config/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Publisher extends BasePublisher
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string,string>
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
Expand Down
4 changes: 4 additions & 0 deletions system/Autoloader/FileLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public function locateFile(string $file, ?string $folder = null, string $ext = '
*/
public function getClassname(string $file): string
{
if (is_dir($file)) {
return '';
}

$php = file_get_contents($file);
$tokens = token_get_all($php);
$dlm = false;
Expand Down
2 changes: 1 addition & 1 deletion system/Config/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Publisher extends BaseConfig
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string,string>
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
Expand Down
15 changes: 14 additions & 1 deletion system/Config/Routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Routing extends BaseConfig
* Default: APPPATH . 'Config/Routes.php'
*/
public array $routeFiles = [
APPPATH . 'Routes.php',
APPPATH . 'Config/Routes.php',
];

/**
Expand Down Expand Up @@ -95,4 +95,17 @@ class Routing extends BaseConfig
* Default: false
*/
public bool $prioritize = false;

/**
* Map of URI segments and namespaces. For Auto Routing (Improved).
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array [ uri_segment => namespace ]
*/
public array $moduleRoutes = [];
}
8 changes: 8 additions & 0 deletions tests/system/Autoloader/FileLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,12 @@ public function testGetClassNameFromNonClassFile(): void
$this->locator->getClassname(SYSTEMPATH . 'bootstrap.php')
);
}

public function testGetClassNameFromDirectory(): void
{
$this->assertSame(
'',
$this->locator->getClassname(SYSTEMPATH)
);
}
}

0 comments on commit 4907a18

Please sign in to comment.