Skip to content

Enable phpstan's bleedingEdge.neon#842

Merged
paulbalandan merged 1 commit intocodeigniter4:developfrom
paulbalandan:bleeding-edge
Sep 20, 2023
Merged

Enable phpstan's bleedingEdge.neon#842
paulbalandan merged 1 commit intocodeigniter4:developfrom
paulbalandan:bleeding-edge

Conversation

@paulbalandan
Copy link
Copy Markdown
Member

Description
To early enjoy newest PHPStan features.

I'm not sure if the error is correct. The tests in question uses fake() and I don't see AccessToken being returned.

 ------ ------------------------------------------------------------------------------------------------------------------------------------ 
  Line   tests\Authentication\HasHmacTokensTest.php
 ------ ------------------------------------------------------------------------------------------------------------------------------------
  :49    PHPDoc tag @var with type CodeIgniter\Shield\Entities\AccessToken is not subtype of type CodeIgniter\Shield\Entities\UserIdentity.
         ✏️  tests/Authentication/HasHmacTokensTest.php:49
  :55    PHPDoc tag @var with type CodeIgniter\Shield\Entities\AccessToken is not subtype of type CodeIgniter\Shield\Entities\UserIdentity.
         ✏️  tests/Authentication/HasHmacTokensTest.php:55
 ------ ------------------------------------------------------------------------------------------------------------------------------------

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis
Copy link
Copy Markdown
Member

kenjis commented Sep 19, 2023

The errors are correct.
The usage in the test are wrong.

--- a/tests/Authentication/HasHmacTokensTest.php
+++ b/tests/Authentication/HasHmacTokensTest.php
@@ -50,6 +50,7 @@ public function testHmacTokens(): void
             UserIdentityModel::class,
             ['user_id' => $this->user->id, 'type' => 'hmac_sha256', 'secret' => 'key1', 'secret2' => 'secretKey1']
         );
+        dd(get_class($token1));
 
         /** @var AccessToken $token2 */
         $token2 = fake(
┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ get_class(...)                                                                                                                    │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
string (40) "CodeIgniter\Shield\Entities\UserIdentity"
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Called from <ROOT>/tests/Authentication/HasHmacTokensTest.php:53 [dd()]

@paulbalandan
Copy link
Copy Markdown
Member Author

I'm not sure why rector fails.
cc @samsonasik

Comment thread rector.php Outdated
Comment thread rector.php Outdated
Comment thread phpstan.neon.dist Outdated
@paulbalandan paulbalandan merged commit 98d1069 into codeigniter4:develop Sep 20, 2023
@paulbalandan paulbalandan deleted the bleeding-edge branch September 20, 2023 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants