Skip to content

Commit c39d17e

Browse files
authored
Compatibility with Symfony 6.x (#49)
* Compatibility with Symfony 6.x * Updated phpstan to avoid parsing issues and fix most new errors
1 parent a43ecfe commit c39d17e

File tree

5 files changed

+51
-12
lines changed

5 files changed

+51
-12
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ jobs:
1616
include:
1717
- php-version: 7.4
1818
symfony-version: 4.4.*
19-
- php-version: 8.0
19+
- php-version: 8.1
2020
symfony-version: 4.4.*
2121
- php-version: 7.4
22-
symfony-version: 5.3.*
23-
- php-version: 8.0
24-
symfony-version: 5.3.*
22+
symfony-version: 5.4.*
23+
- php-version: 8.1
24+
symfony-version: 5.4.*
25+
- php-version: 8.1
26+
symfony-version: 6.1.*
2527

2628
steps:
2729
- name: "Checkout"
@@ -48,7 +50,7 @@ jobs:
4850
strategy:
4951
matrix:
5052
include:
51-
- php-version: 8.0
53+
- php-version: 8.1
5254

5355
steps:
5456
- name: "Checkout"
@@ -73,7 +75,7 @@ jobs:
7375
strategy:
7476
matrix:
7577
include:
76-
- php-version: 8.0
78+
- php-version: 8.1
7779

7880
steps:
7981
- name: "Checkout"
@@ -98,7 +100,7 @@ jobs:
98100
strategy:
99101
matrix:
100102
include:
101-
- php-version: 8.0
103+
- php-version: 8.1
102104

103105
steps:
104106
- name: "Checkout"

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
"require": {
1212
"php": "^7.4|^8.0",
1313
"ext-openssl": "*",
14-
"symfony/framework-bundle": "^4.4|^5.0",
14+
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
1515
"doctrine/orm": "^2.7",
1616
"doctrine/doctrine-bundle": "^2.0",
1717
"yokai/dependency-injection": "^1.0"
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": "^9.5",
2121
"phpspec/prophecy-phpunit": "^2.0",
22-
"symfony/yaml": "^4.4|^5.2",
23-
"phpstan/phpstan": "^0.12",
22+
"symfony/yaml": "^4.4|^5.2|^6.0",
23+
"phpstan/phpstan": "^1.7",
2424
"squizlabs/php_codesniffer": "^3.6"
2525
},
2626
"autoload": {

phpstan-baseline.neon

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,38 @@ parameters:
1515
count: 1
1616
path: src/DependencyInjection/Configuration.php
1717

18+
-
19+
message: "#^Method Yokai\\\\SecurityTokenBundle\\\\Entity\\\\Token\\:\\:getLastUsage\\(\\) should return Yokai\\\\SecurityTokenBundle\\\\Entity\\\\TokenUsage\\|null but returns mixed\\.$#"
20+
count: 1
21+
path: src/Entity/Token.php
22+
23+
-
24+
message: "#^Method Yokai\\\\SecurityTokenBundle\\\\Entity\\\\Token\\:\\:getUsages\\(\\) should return array\\<Yokai\\\\SecurityTokenBundle\\\\Entity\\\\TokenUsage\\> but returns array\\.$#"
25+
count: 1
26+
path: src/Entity/Token.php
27+
28+
-
29+
message: "#^Property Yokai\\\\SecurityTokenBundle\\\\Entity\\\\Token\\:\\:\\$id is never written, only read\\.$#"
30+
count: 1
31+
path: src/Entity/Token.php
32+
33+
-
34+
message: "#^Property Yokai\\\\SecurityTokenBundle\\\\Entity\\\\TokenUsage\\:\\:\\$id is never written, only read\\.$#"
35+
count: 1
36+
path: src/Entity/TokenUsage.php
37+
38+
-
39+
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\RequestStack\\:\\:getMasterRequest\\(\\)\\.$#"
40+
count: 1
41+
path: src/InformationGuesser/InformationGuesser.php
42+
43+
-
44+
message: "#^Cannot cast mixed to string\\.$#"
45+
count: 1
46+
path: src/Manager/ChainUserManager.php
47+
48+
-
49+
message: "#^Cannot cast mixed to string\\.$#"
50+
count: 1
51+
path: src/Manager/DoctrineUserManager.php
52+

src/Entity/Token.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Token
7070
private $keepUntil;
7171

7272
/**
73-
* @var Collection|TokenUsage[]
73+
* @var Collection<TokenUsage>
7474
*/
7575
private $usages;
7676

src/Manager/DoctrineUserManager.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ public function getClass($user): string
7777
*/
7878
public function getId($user): string
7979
{
80+
/** @var object $user */
81+
/** @var class-string $class */
8082
$class = $this->getClass($user);
8183
$identifiers = $this->getManagerFor($class)->getClassMetadata($class)->getIdentifierValues($user);
8284

@@ -90,7 +92,7 @@ public function getId($user): string
9092
/**
9193
* Get doctrine object manager for a class.
9294
*
93-
* @param string $class The user class
95+
* @param class-string $class The user class
9496
*
9597
* @return ObjectManager
9698
*/

0 commit comments

Comments
 (0)