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

Issue #30: Replace Psalm with PHPStan #31

Open
wants to merge 3 commits into
base: 3.0
Choose a base branch
from

Conversation

Howriq
Copy link
Member

@Howriq Howriq commented Mar 6, 2025

No description provided.

@Howriq Howriq requested a review from alexmerlin March 6, 2025 15:04
@Howriq Howriq linked an issue Mar 6, 2025 that may be closed by this pull request
@alexmerlin
Copy link
Member

@arhimede
There are some conflicts between
dot-rbac's src/Assertion/AssertionPluginManager.php using PHPStan
and
vendor/laminas/laminas-servicemanager/src/AbstractPluginManager.php using Psalm.
https://github.com/dotkernel/dot-rbac/actions/runs/13701731048/job/38317054210?pr=31

Should we push forward implementing PHPStan on branch 3.0 (using SM3) once there is branch 4.0 (using SM4)?
If yes, then we will probably have to suppress these errors reported by PHPStan.

Note

This PR was created from branch 3.0 because branch 4.0 is not yet set as default.
3.0 is default one because 4.0 has not been tested yet using a real project, since there is not project with dot-rbac that supports SM4.

@arhimede
Copy link
Member

arhimede commented Mar 7, 2025

@arhimede There are some conflicts between dot-rbac's src/Assertion/AssertionPluginManager.php using PHPStan and vendor/laminas/laminas-servicemanager/src/AbstractPluginManager.php using Psalm. https://github.com/dotkernel/dot-rbac/actions/runs/13701731048/job/38317054210?pr=31

Should we push forward implementing PHPStan on branch 3.0 (using SM3) once there is branch 4.0 (using SM4)? If yes, then we will probably have to suppress these errors reported by PHPStan.

Note

This PR was created from branch 3.0 because branch 4.0 is not yet set as default. 3.0 is default one because 4.0 has not been tested yet using a real project, since there is not project with dot-rbac that supports SM4.

Let's modify the branch 3.0 to use phpstan
and do the same-ish PR to branch 4.0

Copy link
Member

@alexmerlin alexmerlin left a comment

Choose a reason for hiding this comment

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

  1. Replace all occurrences of DotKernel with Dotkernel.

  1. In src/Assertion/AssertionPluginManager.php replace:
/** @var string  */
protected $instanceOf = AssertionInterface::class;

with

/** @var null|class-string<AssertionInterface> $instanceOf */
protected $instanceOf = AssertionInterface::class;

  1. In src/Role/Provider/RoleProviderPluginManager.php replace:
/** @var string  */
protected $instanceOf = RoleProviderInterface::class;

with

/** @var null|class-string<RoleProviderInterface> $instanceOf */
protected $instanceOf = RoleProviderInterface::class;

  1. Add to phpstan.neon's ignoreErrors the 3 errors reported by PHPStan.

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-rbac)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.5.2)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.6.0)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.7.0)

## Badges

![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-rbac)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.6.0)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.6.0)
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-rbac/3.7.0)

"phpunit/phpunit": "^10.2",
"vimeo/psalm": "^5.13",
"laminas/laminas-coding-standard": "^2.5"
"laminas/laminas-coding-standard": "^2.5",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"laminas/laminas-coding-standard": "^2.5",
"laminas/laminas-coding-standard": "^3.0",

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.

Replace Psalm with PHPStan (branch 3.0)
3 participants