Skip to content

Commit

Permalink
bot: fix cs [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond committed Jul 14, 2023
1 parent 9b4887d commit 835961c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/Browser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
];
}
}
2 changes: 1 addition & 1 deletion src/Browser/KernelBrowser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Browser/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowserTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixture/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/KernelBrowserTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 835961c

Please sign in to comment.