Skip to content

Commit

Permalink
Compatibility with Symfony 6.x (#49)
Browse files Browse the repository at this point in the history
* Compatibility with Symfony 6.x

* Updated phpstan to avoid parsing issues and fix most new errors
  • Loading branch information
yann-eugone authored May 31, 2022
1 parent a43ecfe commit c39d17e
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 12 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ jobs:
include:
- php-version: 7.4
symfony-version: 4.4.*
- php-version: 8.0
- php-version: 8.1
symfony-version: 4.4.*
- php-version: 7.4
symfony-version: 5.3.*
- php-version: 8.0
symfony-version: 5.3.*
symfony-version: 5.4.*
- php-version: 8.1
symfony-version: 5.4.*
- php-version: 8.1
symfony-version: 6.1.*

steps:
- name: "Checkout"
Expand All @@ -48,7 +50,7 @@ jobs:
strategy:
matrix:
include:
- php-version: 8.0
- php-version: 8.1

steps:
- name: "Checkout"
Expand All @@ -73,7 +75,7 @@ jobs:
strategy:
matrix:
include:
- php-version: 8.0
- php-version: 8.1

steps:
- name: "Checkout"
Expand All @@ -98,7 +100,7 @@ jobs:
strategy:
matrix:
include:
- php-version: 8.0
- php-version: 8.1

steps:
- name: "Checkout"
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
"require": {
"php": "^7.4|^8.0",
"ext-openssl": "*",
"symfony/framework-bundle": "^4.4|^5.0",
"symfony/framework-bundle": "^4.4|^5.0|^6.0",
"doctrine/orm": "^2.7",
"doctrine/doctrine-bundle": "^2.0",
"yokai/dependency-injection": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpspec/prophecy-phpunit": "^2.0",
"symfony/yaml": "^4.4|^5.2",
"phpstan/phpstan": "^0.12",
"symfony/yaml": "^4.4|^5.2|^6.0",
"phpstan/phpstan": "^1.7",
"squizlabs/php_codesniffer": "^3.6"
},
"autoload": {
Expand Down
35 changes: 35 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,38 @@ parameters:
count: 1
path: src/DependencyInjection/Configuration.php

-
message: "#^Method Yokai\\\\SecurityTokenBundle\\\\Entity\\\\Token\\:\\:getLastUsage\\(\\) should return Yokai\\\\SecurityTokenBundle\\\\Entity\\\\TokenUsage\\|null but returns mixed\\.$#"
count: 1
path: src/Entity/Token.php

-
message: "#^Method Yokai\\\\SecurityTokenBundle\\\\Entity\\\\Token\\:\\:getUsages\\(\\) should return array\\<Yokai\\\\SecurityTokenBundle\\\\Entity\\\\TokenUsage\\> but returns array\\.$#"
count: 1
path: src/Entity/Token.php

-
message: "#^Property Yokai\\\\SecurityTokenBundle\\\\Entity\\\\Token\\:\\:\\$id is never written, only read\\.$#"
count: 1
path: src/Entity/Token.php

-
message: "#^Property Yokai\\\\SecurityTokenBundle\\\\Entity\\\\TokenUsage\\:\\:\\$id is never written, only read\\.$#"
count: 1
path: src/Entity/TokenUsage.php

-
message: "#^Call to an undefined method Symfony\\\\Component\\\\HttpFoundation\\\\RequestStack\\:\\:getMasterRequest\\(\\)\\.$#"
count: 1
path: src/InformationGuesser/InformationGuesser.php

-
message: "#^Cannot cast mixed to string\\.$#"
count: 1
path: src/Manager/ChainUserManager.php

-
message: "#^Cannot cast mixed to string\\.$#"
count: 1
path: src/Manager/DoctrineUserManager.php

2 changes: 1 addition & 1 deletion src/Entity/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Token
private $keepUntil;

/**
* @var Collection|TokenUsage[]
* @var Collection<TokenUsage>
*/
private $usages;

Expand Down
4 changes: 3 additions & 1 deletion src/Manager/DoctrineUserManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public function getClass($user): string
*/
public function getId($user): string
{
/** @var object $user */
/** @var class-string $class */
$class = $this->getClass($user);
$identifiers = $this->getManagerFor($class)->getClassMetadata($class)->getIdentifierValues($user);

Expand All @@ -90,7 +92,7 @@ public function getId($user): string
/**
* Get doctrine object manager for a class.
*
* @param string $class The user class
* @param class-string $class The user class
*
* @return ObjectManager
*/
Expand Down

0 comments on commit c39d17e

Please sign in to comment.