Skip to content

Commit c0a0174

Browse files
committed
chore: Gt -> GT
1 parent e214b82 commit c0a0174

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+280
-287
lines changed

composer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@
5151
},
5252

5353
"autoload": {
54+
"files": [
55+
"./src/gt-compat.php"
56+
],
5457
"psr-4": {
55-
"GT\\WebEngine\\": "./src/",
56-
"Gt\\WebEngine\\": "./src/"
58+
"GT\\WebEngine\\": "./src/"
5759
}
5860
},
5961
"autoload-dev": {
@@ -64,7 +66,7 @@
6466

6567
"scripts": {
6668
"phpunit": "vendor/bin/phpunit --configuration phpunit.xml",
67-
"phpstan": "vendor/bin/phpstan analyse --level 6 src",
69+
"phpstan": "vendor/bin/phpstan analyse --memory-limit=512M --level 6 src",
6870
"phpcs": "vendor/bin/phpcs src --standard=phpcs.xml",
6971
"phpmd": "vendor/bin/phpmd src/ text phpmd.xml",
7072
"test": [

composer.lock

Lines changed: 31 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Application.php

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
namespace GT\WebEngine;
33

44
use Closure;
5-
use Gt\Http\ResponseStatusException\ClientError\ClientErrorException;
6-
use Gt\Http\ResponseStatusException\ResponseStatusException;
7-
use Gt\Logger\Log;
8-
use Gt\Logger\LogConfig;
9-
use Gt\Logger\LogHandler\StdErrHandler;
10-
use Gt\Logger\LogLevel;
5+
use GT\Http\ResponseStatusException\ClientError\ClientErrorException;
6+
use GT\Http\ResponseStatusException\ResponseStatusException;
7+
use GT\Logger\Log;
8+
use GT\Logger\LogConfig;
9+
use GT\Logger\LogHandler\StdErrHandler;
10+
use GT\Logger\LogLevel;
1111
use Throwable;
1212
use ErrorException;
1313
use ReflectionMethod;
@@ -16,13 +16,13 @@
1616
use GT\WebEngine\Redirection\Redirect;
1717
use GT\WebEngine\Dispatch\Dispatcher;
1818
use GT\WebEngine\Dispatch\DispatcherFactory;
19-
use Gt\Config\Config;
20-
use Gt\Config\ConfigFactory;
21-
use Gt\Http\Request;
22-
use Gt\Http\RequestFactory;
23-
use Gt\Http\Response;
24-
use Gt\Http\Stream;
25-
use Gt\ProtectedGlobal\Protection;
19+
use GT\Config\Config;
20+
use GT\Config\ConfigFactory;
21+
use GT\Http\Request;
22+
use GT\Http\RequestFactory;
23+
use GT\Http\Response;
24+
use GT\Http\Stream;
25+
use GT\ProtectedGlobal\Protection;
2626
use Psr\Http\Message\ServerRequestInterface;
2727

2828
/**
@@ -216,28 +216,17 @@ private function finish(
216216

217217
/**
218218
* Registers a namespace compatibility autoloader to bridge the
219-
* Gt -> GT namespace transition.
219+
* legacy-to-GT namespace transition.
220220
*
221221
* As part of the PHP.GT rebranding for WebEngine v5, all references to
222222
* "GT" are being standardised to uppercase. However, the framework
223223
* consists of 40+ repositories that cannot all be refactored
224224
* simultaneously. This compatibility layer allows new code to reference
225225
* classes using the GT\ namespace while the underlying packages still
226-
* define classes with the Gt\ namespace.
226+
* define classes with the legacy namespace casing.
227227
*/
228228
private function gtCompatibility():void {
229-
spl_autoload_register(function(string $class):void {
230-
if(str_starts_with($class, 'GT\\')) {
231-
$legacyClass = 'Gt' . substr($class, 2);
232-
// Trigger autoloading for the legacy class
233-
spl_autoload_call($legacyClass);
234-
// Only create alias if it was loaded and target doesn't already exist
235-
if((class_exists($legacyClass, false) || interface_exists($legacyClass, false) || trait_exists($legacyClass, false))
236-
&& !class_exists($class, false) && !interface_exists($class, false) && !trait_exists($class, false)) {
237-
class_alias($legacyClass, $class);
238-
}
239-
}
240-
}, true, true);
229+
registerNamespaceCompatibilityAutoloader();
241230
}
242231

243232
private function protectGlobals():void {

src/Debug/OutputBuffer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Gt\WebEngine\Debug;
2+
namespace GT\WebEngine\Debug;
33

44
use Closure;
55

src/Debug/Timer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace Gt\WebEngine\Debug;
2+
namespace GT\WebEngine\Debug;
33

44
use Closure;
55

0 commit comments

Comments
 (0)