From 835961cd9947330c89aba631bac3de7feae93c29 Mon Sep 17 00:00:00 2001 From: kbond Date: Fri, 14 Jul 2023 19:37:41 +0000 Subject: [PATCH] bot: fix cs [skip ci] --- src/Browser.php | 2 +- src/Browser/KernelBrowser.php | 2 +- src/Browser/Session.php | 10 +++++----- tests/BrowserTests.php | 4 ++-- tests/Fixture/Kernel.php | 2 +- tests/KernelBrowserTests.php | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Browser.php b/src/Browser.php index 544bf51..7bbae52 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -495,7 +495,7 @@ protected function useParameters(): array Parameter::typed(Crawler::class, Parameter::factory(fn() => $this->client()->getCrawler())), Parameter::typed(CookieJar::class, Parameter::factory(fn() => $this->client()->getCookieJar())), Parameter::typed(AbstractBrowser::class, Parameter::factory(fn() => $this->client())), - Parameter::typed(ContainerInterface::class, Parameter::factory(fn() => method_exists($this->client(), 'getContainer') ? $this->client()->getContainer() : null))->optional(), + Parameter::typed(ContainerInterface::class, Parameter::factory(fn() => \method_exists($this->client(), 'getContainer') ? $this->client()->getContainer() : null))->optional(), ]; } } diff --git a/src/Browser/KernelBrowser.php b/src/Browser/KernelBrowser.php index 74296a3..8791af7 100644 --- a/src/Browser/KernelBrowser.php +++ b/src/Browser/KernelBrowser.php @@ -499,7 +499,7 @@ protected function useParameters(): array Parameter::typed(Json::class, Parameter::factory(fn() => $this->json())), Parameter::typed(DataCollectorInterface::class, Parameter::factory(function(string $class) { foreach ($this->profile()->getCollectors() as $collector) { - if ($class === \get_class($collector)) { + if ($class === $collector::class) { return $collector; } } diff --git a/src/Browser/Session.php b/src/Browser/Session.php index 5c5246b..0077f4b 100644 --- a/src/Browser/Session.php +++ b/src/Browser/Session.php @@ -70,7 +70,7 @@ public function isRedirect(): bool public function json(): Json { - if (str_contains((string) $this->getResponseHeader('content-type'), 'json')) { + if (\str_contains((string) $this->getResponseHeader('content-type'), 'json')) { return new Json($this->page()->getContent()); } @@ -182,10 +182,10 @@ private function isTextContent(): bool { try { return match (true) { - str_contains((string) $this->getResponseHeader('Content-Type'), 'text/plain'), - str_contains((string) $this->getResponseHeader('Content-Type'), 'xml'), // to cover all possible XML content-types: "application/xml (is recommended as of RFC 7303 (section 4.1)), text/xml " - str_contains((string) $this->getResponseHeader('Content-Type'), 'html'), // to cover all possible (x)HTML content-types: "text/html, application/xhtml+xml" - str_contains((string) $this->getResponseHeader('Content-Type'), 'json'), // to cover all possible JSON content-types: "application/json, application/ld+json" + \str_contains((string) $this->getResponseHeader('Content-Type'), 'text/plain'), + \str_contains((string) $this->getResponseHeader('Content-Type'), 'xml'), // to cover all possible XML content-types: "application/xml (is recommended as of RFC 7303 (section 4.1)), text/xml " + \str_contains((string) $this->getResponseHeader('Content-Type'), 'html'), // to cover all possible (x)HTML content-types: "text/html, application/xhtml+xml" + \str_contains((string) $this->getResponseHeader('Content-Type'), 'json'), // to cover all possible JSON content-types: "application/json, application/ld+json" => true, default => false, }; diff --git a/tests/BrowserTests.php b/tests/BrowserTests.php index 6dda580..64a3f2b 100644 --- a/tests/BrowserTests.php +++ b/tests/BrowserTests.php @@ -180,8 +180,8 @@ public function with_can_accept_multiple_browsers_and_components(): void ->use(function(Browser $browser1, $browser2, TestComponent1 $component1, TestComponent2 $component2, Crawler $crawler, AbstractBrowser $inner) use ($browser) { $this->assertInstanceOf(Browser::class, $browser1); $this->assertInstanceOf(Browser::class, $browser2); - $this->assertInstanceOf(\get_class($browser), $browser1); - $this->assertInstanceOf(\get_class($browser), $browser2); + $this->assertInstanceOf($browser::class, $browser1); + $this->assertInstanceOf($browser::class, $browser2); $this->assertInstanceOf(TestComponent1::class, $component1); $this->assertInstanceOf(TestComponent2::class, $component2); }) diff --git a/tests/Fixture/Kernel.php b/tests/Fixture/Kernel.php index ca3dfad..49f9b97 100644 --- a/tests/Fixture/Kernel.php +++ b/tests/Fixture/Kernel.php @@ -145,7 +145,7 @@ public function user(Security $security): Response $user = $token->getUser(); - return new Response("user: {$user->getUserIdentifier()}/{$user->getPassword()}/".\get_class($token)); + return new Response("user: {$user->getUserIdentifier()}/{$user->getPassword()}/".$token::class); } public function login(): Response diff --git a/tests/KernelBrowserTests.php b/tests/KernelBrowserTests.php index 9c6610d..2721884 100644 --- a/tests/KernelBrowserTests.php +++ b/tests/KernelBrowserTests.php @@ -46,7 +46,7 @@ public function can_use_kernel_browser_as_typehint(): void public function can_use_container_as_typehint(): void { $browser = $this->browser(); - $c=$browser->client()->getContainer(); + $c = $browser->client()->getContainer(); $browser ->use(function(ContainerInterface $container) use ($c) {