Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use ::class constants #540

Merged
merged 4 commits into from
Nov 25, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Nov 25, 2022

To fix psalm issues.

See #539

Before:

INFO: PropertyTypeCoercion - src/Config/Auth.php:211:40 - $this->passwordValidators expects 'array<array-key, class-string<CodeIgniter\Shield\Authentication\Passwords\ValidatorInterface>>',  parent type 'array{"CodeIgniter\\Shield\\Authentication\\Passwords\\CompositionValidator", "CodeIgniter\\Shield\\Authentication\\Passwords\\NothingPersonalValidator", "CodeIgniter\\Shield\\Authentication\\Passwords\\DictionaryValidator"}' provided (see https://psalm.dev/198)
    public array $passwordValidators = [
        'CodeIgniter\Shield\Authentication\Passwords\CompositionValidator',
        'CodeIgniter\Shield\Authentication\Passwords\NothingPersonalValidator',
        'CodeIgniter\Shield\Authentication\Passwords\DictionaryValidator',
        // 'CodeIgniter\Shield\Authentication\Passwords\PwnedValidator',
    ];


INFO: PropertyTypeCoercion - src/Config/Auth.php:336:35 - $this->userProvider expects 'class-string<CodeIgniter\Shield\Models\UserModel>',  parent type '"CodeIgniter\\Shield\\Models\\UserModel"' provided (see https://psalm.dev/198)
    public string $userProvider = 'CodeIgniter\Shield\Models\UserModel';


------------------------------
                              
       No errors found!       
                              
------------------------------
2 other issues found.
------------------------------

After:

$ vendor/bin/psalm --show-info=true src/Config/Auth.php 
Target PHP version: 7.4 (inferred from composer.json)
Scanning files...
Analyzing files...


------------------------------
                              
       No errors found!       
                              
------------------------------

Checks took 2.78 seconds and used 347.746MB of memory
Psalm was able to infer types for 93.0133% of the codebase

src/Config/Auth.php Outdated Show resolved Hide resolved
@datamweb
Copy link
Collaborator

What about documents?

@datamweb datamweb added the refactor Pull requests that refactor code label Nov 25, 2022
@kenjis kenjis force-pushed the fix-Config-Auth-class-string branch from 4af6b2a to fafb8ea Compare November 25, 2022 02:28
@kenjis
Copy link
Member Author

kenjis commented Nov 25, 2022

Updated the docs.

@kenjis kenjis requested a review from datamweb November 25, 2022 02:30
Copy link
Collaborator

@datamweb datamweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kenjis
Copy link
Member Author

kenjis commented Nov 25, 2022

@kenjis kenjis merged commit ea747cd into codeigniter4:develop Nov 25, 2022
@kenjis kenjis deleted the fix-Config-Auth-class-string branch November 25, 2022 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Pull requests that refactor code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants