This commit is contained in:
Markus
2022-04-28 09:40:10 +02:00
commit 795794f992
9586 changed files with 1146991 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Tests\Support\Autoloader;
use CodeIgniter\Autoloader\FileLocator;
use RuntimeException;
/**
* Class FatalLocator
*
* A locator replacement designed to throw
* exceptions when used to indicate when
* a lookup actually happens.
*/
class FatalLocator extends FileLocator
{
/**
* Throws.
*
* @param string $file The namespaced file to locate
* @param string $folder The folder within the namespace that we should look for the file.
* @param string $ext The file extension the file should have.
*
* @return false|string The path to the file, or false if not found.
*/
public function locateFile(string $file, ?string $folder = null, string $ext = 'php')
{
$folder = $folder ?? 'null';
throw new RuntimeException("locateFile({$file}, {$folder}, {$ext})");
}
/**
* Searches through all of the defined namespaces looking for a file.
* Returns an array of all found locations for the defined file.
*
* Example:
*
* $locator->search('Config/Routes.php');
* // Assuming PSR4 namespaces include foo and bar, might return:
* [
* 'app/Modules/foo/Config/Routes.php',
* 'app/Modules/bar/Config/Routes.php',
* ]
*/
public function search(string $path, string $ext = 'php', bool $prioritizeApp = true): array
{
$prioritizeApp = $prioritizeApp ? 'true' : 'false';
throw new RuntimeException("search({$path}, {$ext}, {$prioritizeApp})");
}
}

View File

@@ -0,0 +1,14 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
class UnnamespacedClass
{
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
if (! function_exists('autoload_foo')) {
function autoload_foo(): string
{
return 'I am autoloaded by Autoloader through $files!';
}
}
if (! defined('AUTOLOAD_CONSTANT')) {
define('AUTOLOAD_CONSTANT', 'foo');
}