From 0b18ab84474ef9733487fd3b48eea135b0cd4569 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 28 Oct 2021 17:10:54 +0900 Subject: [PATCH] style: change global_namespace_import to true in php-cs-fixer https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.19/doc/rules/import/global_namespace_import.rst --- tests/_support/Commands/AppInfo.php | 3 ++- tests/_support/Commands/InvalidCommand.php | 3 ++- tests/_support/Controllers/Popcorn.php | 3 ++- tests/_support/Widgets/SomeWidget.php | 4 +++- tests/system/I18n/TimeTest.php | 20 ++++++++++---------- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/_support/Commands/AppInfo.php b/tests/_support/Commands/AppInfo.php index 562cc9dd3847..e7bf3093e658 100644 --- a/tests/_support/Commands/AppInfo.php +++ b/tests/_support/Commands/AppInfo.php @@ -14,6 +14,7 @@ use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\CLI; use CodeIgniter\CodeIgniter; +use RuntimeException; class AppInfo extends BaseCommand { @@ -31,7 +32,7 @@ public function bomb() { try { CLI::color('test', 'white', 'Background'); - } catch (\RuntimeException $oops) { + } catch (RuntimeException $oops) { $this->showError($oops); } } diff --git a/tests/_support/Commands/InvalidCommand.php b/tests/_support/Commands/InvalidCommand.php index a6d13d6fe494..5b4acf936b08 100644 --- a/tests/_support/Commands/InvalidCommand.php +++ b/tests/_support/Commands/InvalidCommand.php @@ -14,6 +14,7 @@ use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\CLI; use CodeIgniter\CodeIgniter; +use ReflectionException; class InvalidCommand extends BaseCommand { @@ -23,7 +24,7 @@ class InvalidCommand extends BaseCommand public function __construct() { - throw new \ReflectionException(); + throw new ReflectionException(); } public function run(array $params) diff --git a/tests/_support/Controllers/Popcorn.php b/tests/_support/Controllers/Popcorn.php index a0aa972c635f..71a316685a32 100644 --- a/tests/_support/Controllers/Popcorn.php +++ b/tests/_support/Controllers/Popcorn.php @@ -13,6 +13,7 @@ use CodeIgniter\API\ResponseTrait; use CodeIgniter\Controller; +use RuntimeException; /** * This is a testing only controller, intended to blow up in multiple @@ -34,7 +35,7 @@ public function pop() public function popper() { - throw new \RuntimeException('Surprise', 500); + throw new RuntimeException('Surprise', 500); } public function weasel() diff --git a/tests/_support/Widgets/SomeWidget.php b/tests/_support/Widgets/SomeWidget.php index 380449f14b9b..c6e2b3da8652 100644 --- a/tests/_support/Widgets/SomeWidget.php +++ b/tests/_support/Widgets/SomeWidget.php @@ -11,7 +11,9 @@ namespace Tests\Support\Widgets; +use stdClass; + // Extends a trivial class to test the instanceOf directive -class SomeWidget extends \stdClass +class SomeWidget extends stdClass { } diff --git a/tests/system/I18n/TimeTest.php b/tests/system/I18n/TimeTest.php index da1ef5b3c5ef..e1e683c98d07 100644 --- a/tests/system/I18n/TimeTest.php +++ b/tests/system/I18n/TimeTest.php @@ -90,7 +90,7 @@ public function testTimeWithDateTimeZone() 'yyyy-MM-dd HH:mm:ss' ); - $time = new Time('now', new \DateTimeZone('Europe/London'), 'fr_FR'); + $time = new Time('now', new DateTimeZone('Europe/London'), 'fr_FR'); $this->assertSame($formatter->format($time), (string) $time); } @@ -101,13 +101,13 @@ public function testToDateTime() $obj = $time->toDateTime(); - $this->assertInstanceOf(\DateTime::class, $obj); + $this->assertInstanceOf(DateTime::class, $obj); } public function testNow() { $time = Time::now(); - $time1 = new \DateTime(); + $time1 = new DateTime(); $this->assertInstanceOf(Time::class, $time); $this->assertSame($time->getTimestamp(), $time1->getTimestamp()); @@ -116,7 +116,7 @@ public function testNow() public function testParse() { $time = Time::parse('next Tuesday', 'America/Chicago'); - $time1 = new \DateTime('now', new \DateTimeZone('America/Chicago')); + $time1 = new DateTime('now', new DateTimeZone('America/Chicago')); $time1->modify('next Tuesday'); $this->assertSame($time->getTimestamp(), $time1->getTimestamp()); @@ -134,7 +134,7 @@ public function testToDateTimeStringWithTimeZone() { $time = Time::parse('2017-01-12 00:00', 'Europe/London'); - $expects = new \DateTime('2017-01-12', new \DateTimeZone('Europe/London')); + $expects = new DateTime('2017-01-12', new DateTimeZone('Europe/London')); $this->assertSame($expects->format('Y-m-d H:i:s'), $time->toDateTimeString()); } @@ -204,7 +204,7 @@ public function testCreateFromTimeLocalized() public function testCreateFromFormat() { - $now = new \DateTime('now'); + $now = new DateTime('now'); Time::setTestNow($now); $time = Time::createFromFormat('F j, Y', 'January 15, 2017', 'America/Chicago'); @@ -222,7 +222,7 @@ public function testCreateFromFormatWithTimezoneString() public function testCreateFromFormatWithTimezoneObject() { - $tz = new \DateTimeZone('Europe/London'); + $tz = new DateTimeZone('Europe/London'); $time = Time::createFromFormat('F j, Y', 'January 15, 2017', $tz); @@ -422,7 +422,7 @@ public function testGetTimezone() { $instance = Time::now()->getTimezone(); - $this->assertInstanceOf(\DateTimeZone::class, $instance); + $this->assertInstanceOf(DateTimeZone::class, $instance); } public function testGetTimezonename() @@ -776,7 +776,7 @@ public function testEqualWithSame() public function testEqualWithDateTime() { $time1 = Time::parse('January 10, 2017 21:50:00', 'America/Chicago'); - $time2 = new \DateTime('January 11, 2017 03:50:00', new \DateTimeZone('Europe/London')); + $time2 = new DateTime('January 11, 2017 03:50:00', new DateTimeZone('Europe/London')); $this->assertTrue($time1->equals($time2)); } @@ -784,7 +784,7 @@ public function testEqualWithDateTime() public function testEqualWithSameDateTime() { $time1 = Time::parse('January 10, 2017 21:50:00', 'America/Chicago'); - $time2 = new \DateTime('January 10, 2017 21:50:00', new \DateTimeZone('America/Chicago')); + $time2 = new DateTime('January 10, 2017 21:50:00', new DateTimeZone('America/Chicago')); $this->assertTrue($time1->equals($time2)); }