Skip to content

Commit 8b2b2b8

Browse files
committed
Upgraded phpstan to ^2.0
1 parent e4cd9f6 commit 8b2b2b8

6 files changed

Lines changed: 20 additions & 23 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/features/fixtures/project/var/mysql/*
88
!/features/fixtures/project/var/.gitkeep
99
!/features/fixtures/project/var/data/.gitkeep
10+
/features/fixtures/project/config/reference.php
1011
/features/fixtures/project/config/parameters.yaml
1112
*.sqlite
1213
.phpcs-cache

Behat/Context/AdminUserManagementContext.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Behat\Gherkin\Node\TableNode;
1616
use Behat\Mink\Driver\BrowserKitDriver;
1717
use FriendsOfBehat\PageObjectExtension\Page\UnexpectedPageException;
18+
use FriendsOfBehat\SymfonyExtension\Driver\SymfonyDriver;
1819
use FSi\Bundle\AdminSecurityBundle\Behat\Element\BatchAction;
1920
use FSi\Bundle\AdminSecurityBundle\Behat\Element\Datagrid;
2021
use FSi\Bundle\AdminSecurityBundle\Behat\Page\UserList;
@@ -125,7 +126,7 @@ private function performBatchAction(string $action, int $cellIndex): void
125126
]
126127
];
127128

128-
/** @var BrowserKitDriver $driver */
129+
/** @var SymfonyDriver $driver */
129130
$driver = $this->getSession()->getDriver();
130131

131132
$batchActionUrl = $batchActionNode->getAttribute('value');

Behat/Element/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
final class Form extends Element
1919
{
20-
public function getField(string $locator): ?NodeElement
20+
public function getField(string $locator): NodeElement
2121
{
2222
$field = $this->getElement('form')->findField($locator);
2323
if (null === $field) {

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"beberlei/assert": "^3.3",
1616
"doctrine/doctrine-bundle": "^2.7",
1717
"doctrine/orm": "^2.7|^3.0",
18-
"doctrine/persistence": "^2.5|^3.0",
18+
"doctrine/persistence": "^2.5.7|^3.0|^4.0",
1919
"fsi/admin-bundle" : "^4.0",
2020
"fsi/data" : "^1.0.2",
2121
"psr/clock": "^1.0",
@@ -36,19 +36,19 @@
3636
"behat/behat": "^3.11",
3737
"behat/mink": "^1.10",
3838
"behat/mink-selenium2-driver": "^1.6",
39+
"behat/mink-browserkit-driver": "^2.0",
3940
"caciobanu/behat-deprecation-extension": "^2.1",
4041
"egulias/email-validator": "^3.2|^4.0",
4142
"friendsofphp/proxy-manager-lts": "^1.0",
42-
"friends-of-behat/mink-browserkit-driver": "^1.6.1",
4343
"friends-of-behat/mink-extension": "^2.7.4",
4444
"friends-of-behat/page-object-extension": "^0.3.2",
4545
"friends-of-behat/symfony-extension": "^2.4.1",
4646
"fsi/resource-repository-bundle": "^2.2|^3.0.2|^4.0",
4747
"fsi/translatable": "^1.0",
4848
"ocramius/proxy-manager": "^2.5",
4949
"phpspec/phpspec": "^7.0|^8.0",
50-
"phpstan/phpstan": "^1.10",
51-
"phpstan/phpstan-beberlei-assert": "^1.0",
50+
"phpstan/phpstan": "^2.0",
51+
"phpstan/phpstan-beberlei-assert": "^2.0",
5252
"squizlabs/php_codesniffer": "^3.7",
5353
"symfony/dom-crawler": "^4.4|^5.4|^6.0|^7.0",
5454
"symfony/error-handler": "^4.4|^5.4|^6.0|^7.0",

features/fixtures/project/src/Time/Clock.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,23 @@
1717
final class Clock implements ClockInterface
1818
{
1919
private static ?DateTimeImmutable $now = null;
20-
private static ?DateTimeImmutable $traveledAt = null;
2120

2221
public function now(): DateTimeImmutable
2322
{
2423
if (null === self::$now) {
2524
return new DateTimeImmutable();
2625
}
2726

28-
if (null === self::$traveledAt) {
29-
return clone self::$now;
30-
}
31-
32-
// TODO this works reliably only for short periods like under 60 seconds
33-
$interval = self::$traveledAt->diff(new DateTimeImmutable());
34-
return self::$now->add($interval);
27+
return clone self::$now;
3528
}
3629

3730
public function freeze(DateTimeImmutable $time): void
3831
{
3932
self::$now = $time;
40-
self::$traveledAt = null;
4133
}
4234

4335
public function return(): void
4436
{
4537
self::$now = null;
46-
self::$traveledAt = null;
4738
}
4839
}

phpstan.neon

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ parameters:
77
paths:
88
- .
99
excludePaths:
10-
- DependencyInjection/Configuration
11-
- '%rootDir%/../../../docker'
12-
- '%rootDir%/../../../features/fixtures/project/config/reference.php'
13-
- '%rootDir%/../../../features/fixtures/project/var'
14-
- '%rootDir%/../../../spec'
15-
- '%rootDir%/../../../var'
16-
- '%rootDir%/../../../vendor'
10+
- DependencyInjection/Configuration.php
11+
- features/fixtures/project/config
12+
- features/fixtures/project/var
13+
- spec
14+
- vendor
1715
ignoreErrors:
1816
- '#Property FSi\\Bundle\\AdminSecurityBundle\\EventListener\\EncodePasswordListener::\$passwordHasherFactory has unknown class Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherFactoryInterface as its type\.#'
1917
- '#Parameter \$passwordHasherFactory of method FSi\\Bundle\\AdminSecurityBundle\\EventListener\\EncodePasswordListener::__construct\(\) has invalid type Symfony\\Component\\PasswordHasher\\Hasher\\PasswordHasherFactoryInterface\.#'
@@ -24,5 +22,11 @@ parameters:
2422
path: %currentWorkingDirectory%/FSiAdminSecurityBundle.php
2523
- message: '#Call to an undefined method Symfony\\Component\\HttpFoundation\\RequestStack\:\:get(Main|Master)Request\(\)\.#'
2624
path: %currentWorkingDirectory%/EventListener/LogoutUserListener.php
25+
- message: '#Call to function method_exists\(\) with Symfony\\Component\\HttpFoundation\\RequestStack and ''get(Main|Master)Request'' will always evaluate to true\.#'
26+
path: %currentWorkingDirectory%/EventListener/LogoutUserListener.php
27+
- message: '#Call to function method_exists\(\) with Symfony\\Component\\Security\\Core\\User\\UserInterface and ''getUser(name|Identifier)'' will always evaluate to true\.#'
28+
path: %currentWorkingDirectory%/Security/User/UserIdentifierHelper.php
29+
- message: '#Call to function method_exists\(\) with Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface and ''getUser(name|Identifier)'' will always evaluate to true\.#'
30+
path: %currentWorkingDirectory%/Security/User/UserIdentifierHelper.php
2731
- message: '#.*Symfony\\Component\\Routing\\RouteCollectionBuilder.*#'
2832
path: %currentWorkingDirectory%/features/fixtures/project/src/Kernel.php

0 commit comments

Comments
 (0)