Skip to content

Commit 9d7dbe9

Browse files
nikophilkbond
andauthored
chore: support Symfony 8 (#184)
* chore: support Symfony 8 * mb_trim to trim --------- Co-authored-by: Kevin Bond <kevinbond@gmail.com>
1 parent 1831b54 commit 9d7dbe9

19 files changed

Lines changed: 86 additions & 176 deletions

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/.github export-ignore
22
/tests export-ignore
3+
/stubs export-ignore

composer.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,26 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=8.0",
15+
"php": ">=8.1",
1616
"behat/mink": "^1.8",
17-
"symfony/browser-kit": "^5.4|^6.0|^7.0",
18-
"symfony/css-selector": "^5.4|^6.0|^7.0",
19-
"symfony/dom-crawler": "^5.4|^6.0|^7.0",
20-
"symfony/framework-bundle": "^5.4|^6.0|^7.0",
17+
"symfony/browser-kit": "^6.4|^7.0|^8.0",
18+
"symfony/css-selector": "^6.4|^7.0|^8.0",
19+
"symfony/dom-crawler": "^6.4|^7.0|^8.0",
20+
"symfony/framework-bundle": "^6.4|^7.0|^8.0",
2121
"zenstruck/assert": "^1.1",
2222
"zenstruck/callback": "^1.4.2"
2323
},
2424
"require-dev": {
2525
"dbrekelmans/bdi": "^1.0",
2626
"justinrainbow/json-schema": "^5.3",
2727
"mtdowling/jmespath.php": "^2.6",
28-
"phpstan/phpstan": "^1.4",
28+
"phpstan/phpstan": "^2.0",
2929
"phpunit/phpunit": "^9.6.21|^10.4",
30-
"symfony/mime": "^5.4|^6.0|^7.0",
30+
"symfony/console": "^6.4|^7.0|^8.0",
31+
"symfony/mime": "^6.4|^7.0|^8.0",
3132
"symfony/panther": "^1.1|^2.0.1",
32-
"symfony/phpunit-bridge": "^6.0|^7.0",
33-
"symfony/security-bundle": "^5.4|^6.0|^7.0"
33+
"symfony/phpunit-bridge": "^6.4|^7.0|^8.0",
34+
"symfony/security-bundle": "^6.4|^7.0|^8.0"
3435
},
3536
"suggest": {
3637
"justinrainbow/json-schema": "Json schema validator. Needed to use Json::assertMatchesSchema().",

phpstan-baseline.neon

Lines changed: 0 additions & 142 deletions
This file was deleted.

phpstan.neon

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
includes:
2-
- phpstan-baseline.neon
3-
41
parameters:
5-
level: 8
2+
level: 5
63
paths:
74
- src
5+
- stubs
86

97
excludePaths:
108
# skip phpunit 10 missing classes

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
5-
bootstrap="vendor/autoload.php"
5+
bootstrap="tests/bootstrap.php"
66
failOnRisky="true"
77
failOnWarning="true"
88
colors="true"

src/Browser.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
use Psr\Container\ContainerInterface;
1616
use Symfony\Component\BrowserKit\AbstractBrowser;
1717
use Symfony\Component\BrowserKit\CookieJar;
18+
use Symfony\Component\BrowserKit\Request;
1819
use Symfony\Component\DomCrawler\Crawler;
1920
use Symfony\Component\Filesystem\Filesystem;
21+
use Symfony\Component\HttpFoundation\Response;
2022
use Zenstruck\Browser\Assertion\SameUrlAssertion;
2123
use Zenstruck\Browser\Component;
2224
use Zenstruck\Browser\Session;
@@ -47,6 +49,9 @@ public function __construct(Driver $driver, array $options = [])
4749
$this->sourceDebug = $options['source_debug'] ?? false;
4850
}
4951

52+
/**
53+
* @return AbstractBrowser<Request, Response>
54+
*/
5055
final public function client(): AbstractBrowser
5156
{
5257
return $this->session->client();
@@ -409,7 +414,7 @@ final public function use(callable $callback): self
409414
final public function saveSource(string $filename): self
410415
{
411416
if ($this->sourceDir) {
412-
$filename = \sprintf('%s/%s', mb_rtrim($this->sourceDir, '/'), mb_ltrim($filename, '/'));
417+
$filename = \sprintf('%s/%s', \rtrim($this->sourceDir, '/'), \ltrim($filename, '/'));
413418
}
414419

415420
(new Filesystem())->dumpFile($this->savedSources[] = $filename, $this->session()->source($this->sourceDebug));

src/Browser/Json.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function decoded()
167167
return $this->decoded;
168168
}
169169

170-
if ('' === mb_trim($this->source)) {
170+
if ('' === \trim($this->source)) {
171171
return null;
172172
}
173173

src/Browser/KernelBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final public function __construct(SymfonyKernelBrowser $client, array $options =
4343
$client->followRedirects((bool) ($options['follow_redirects'] ?? true));
4444
$client->catchExceptions((bool) ($options['catch_exceptions'] ?? true));
4545

46-
parent::__construct(new BrowserKitDriver($client), $options);
46+
parent::__construct(new BrowserKitDriver($client), $options); // @phpstan-ignore argument.type
4747
}
4848

4949
/**

src/Browser/PantherBrowser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ final public function pause(): self
149149
final public function takeScreenshot(string $filename): self
150150
{
151151
if ($this->screenshotDir) {
152-
$filename = \sprintf('%s/%s', mb_rtrim($this->screenshotDir, '/'), mb_ltrim($filename, '/'));
152+
$filename = \sprintf('%s/%s', \rtrim($this->screenshotDir, '/'), \ltrim($filename, '/'));
153153
}
154154

155155
$this->client()->takeScreenshot($this->savedScreenshots[] = $filename);
@@ -160,7 +160,7 @@ final public function takeScreenshot(string $filename): self
160160
final public function saveConsoleLog(string $filename): self
161161
{
162162
if ($this->consoleLogDir) {
163-
$filename = \sprintf('%s/%s', mb_rtrim($this->consoleLogDir, '/'), mb_ltrim($filename, '/'));
163+
$filename = \sprintf('%s/%s', \rtrim($this->consoleLogDir, '/'), \ltrim($filename, '/'));
164164
}
165165

166166
$log = $this->client()->manage()->getLog('browser');

src/Browser/Session.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
use Behat\Mink\Session as MinkSession;
1818
use Behat\Mink\WebAssert;
1919
use Symfony\Component\BrowserKit\AbstractBrowser;
20+
use Symfony\Component\BrowserKit\Request;
2021
use Symfony\Component\DomCrawler\Crawler;
22+
use Symfony\Component\HttpFoundation\Response;
2123
use Zenstruck\Assert as ZenstruckAssert;
2224
use Zenstruck\Browser\Session\Assert;
2325
use Zenstruck\Browser\Session\Driver;
@@ -44,6 +46,9 @@ public static function varDump($what): void
4446
\function_exists('dump') ? dump($what) : \var_dump($what);
4547
}
4648

49+
/**
50+
* @return AbstractBrowser<Request, Response>
51+
*/
4752
public function client(): AbstractBrowser
4853
{
4954
return $this->getDriver()->client();

0 commit comments

Comments
 (0)