refactor: Code cleanup Pt2#38
Merged
Ninerian merged 17 commits intorefactor/code-cleanupfrom Apr 1, 2026
Merged
Conversation
Contributor
Ninerian
commented
Oct 29, 2025
- raised phpstan to level 7 and fixed all issues
- Updated phpstan.neon.dist to level 4 - Removed unused expressions in PluginSessionTest - Fixed always-true ternary in SSODataTest - Refined assertion in SSOTokenTest to avoid redundant type check - Removed unreachable code after markTestSkipped statements - Added proper assertions to make mock object usage meaningful 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated phpstan.neon.dist to level 5 - Fixed type parameter in HasInstanceId::hasInstanceId() method from Plain to UnencryptedToken - Removed unused Plain token import - Aligns with lcobucci/jwt library token type hierarchy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
e88e6fe to
3300537
Compare
- Updated phpstan.neon.dist to level 4 - Removed unused expressions in PluginSessionTest - Fixed always-true ternary in SSODataTest - Refined assertion in SSOTokenTest to avoid redundant type check - Removed unreachable code after markTestSkipped statements - Added proper assertions to make mock object usage meaningful 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated phpstan.neon.dist to level 6 - Added comprehensive array type annotations (array<string,mixed>) - Added missing return type declarations for all methods - Added missing property type declarations - Fixed PHPUnit mock template type resolution - Added proper DocBlock annotations for complex types - Removed unused properties - Applied fixes across src/ and test/ directories Major improvements: - AbstractToken.php: array types and return types - SSOData traits: comprehensive type annotations - Test classes: complete type coverage and mock annotations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Updated phpstan.neon.dist to level 7 - Added non-empty-string validation for JWT library methods - Enhanced AbstractToken with proper string validation for claim names and keys - Fixed SSOToken and SSOTokenGenerator with empty string checks - Improved SessionHandlerTrait type handling for session_id() return values - Added proper class-string annotations in test files - Maintained backward compatibility while ensuring type safety Key improvements: - hasClaim/getClaim methods validate non-empty claim names - Key handling methods validate non-empty PEM strings and file paths - Session handling properly manages string|false vs string|null types - All string parameters validated before passing to strict library functions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1fa3c3c to
6a34427
Compare
acc47ef to
0ed5e27
Compare
m-seidel
requested changes
Nov 20, 2025
Contributor
m-seidel
left a comment
There was a problem hiding this comment.
Could you also run the linter and commit the changes from it.
It brought up some changes in
modified: src/AbstractToken.php
modified: test/SSOData/SSODataTest.php
src/SSOData/ClaimAccessTrait.php
Outdated
Comment on lines
+40
to
+42
| /** | ||
| * @return mixed | ||
| */ |
Contributor
There was a problem hiding this comment.
Suggested change
| /** | |
| * @return mixed | |
| */ |
This is a duplication
Comment on lines
46
to
+51
| * | ||
| * @return array | ||
| */ | ||
| /** | ||
| * @return array<string, mixed> | ||
| */ |
Contributor
There was a problem hiding this comment.
Suggested change
| * | |
| * @return array | |
| */ | |
| /** | |
| * @return array<string, mixed> | |
| */ | |
| * | |
| * @return array<string, mixed> | |
| */ |
src/SSOTokenGenerator.php
Outdated
Comment on lines
+58
to
+63
| * @param array $tokenData | ||
| * @return Token | ||
| */ | ||
| /** | ||
| * @param array<string,mixed> $tokenData | ||
| */ |
Contributor
There was a problem hiding this comment.
Suggested change
| * @param array $tokenData | |
| * @return Token | |
| */ | |
| /** | |
| * @param array<string,mixed> $tokenData | |
| */ | |
| * @param array<string,mixed> $tokenData | |
| * @return Token | |
| */ |
test/SSOTestData.php
Outdated
Comment on lines
+50
to
+52
| /** | ||
| * @return array<string,mixed> | ||
| */ |
Contributor
There was a problem hiding this comment.
Pleas update the commented return line above and remove the duplication
test/SSOTestData.php
Outdated
| * @return array Associative array of claim accessors. | ||
| */ | ||
| /** | ||
| * @return array<string,string> |
Contributor
There was a problem hiding this comment.
Pleas update the commented return line above and remove the duplication
.gitignore
Outdated
Contributor
There was a problem hiding this comment.
I don't think it is needed
Suggested change
- Keep higher phpstan level (7) from code-cleanup-pt2 - Take updated composer dependencies (php-cs-fixer ^3.89) from refactor/code-cleanup - Merge type annotations: use ?Signer nullable syntax in SSOTokenGenerator - Take HEAD versions for AbstractToken (extra null check), SessionHandlerTrait - Take restored destroy session tests from code-cleanup-pt2 - Fix SSODataTest assertion message to use print_r for all value types Co-authored-by: opencode <opencode@noreply.opencode.ai> Co-authored-by: GitHub Copilot <copilot@noreply.github.com>
- Fix operator_linebreak style in AbstractToken.php - Fix implicitly nullable parameters in PluginSessionTest.php - Fix array.invalidKey phpstan ignore in SSODataTest.php Co-Authored-By: Opencode <opencode@noreply.opencode.ai> Co-Authored-By: GitHub Copilot <copilot@noreply.github.com>
Use array of pairs instead of null-keyed map to avoid phpstan array.invalidKey/array.duplicateKey warnings across PHP 8.3/8.4/8.5. Co-Authored-By: Opencode <opencode@noreply.opencode.ai> Co-Authored-By: GitHub Copilot <copilot@noreply.github.com>
- Remove duplicate docblocks in ClaimAccessTrait, SSOTokenGenerator, and SSOTestData; merge typed @return/@param into existing blocks - Remove !/.gitignore from .gitignore (not needed) Co-Authored-By: Opencode <opencode@noreply.opencode.ai> Co-Authored-By: GitHub Copilot <copilot@noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.