Skip to content

refactor: Code cleanup Pt2#38

Merged
Ninerian merged 17 commits intorefactor/code-cleanupfrom
code-cleanup-pt2
Apr 1, 2026
Merged

refactor: Code cleanup Pt2#38
Ninerian merged 17 commits intorefactor/code-cleanupfrom
code-cleanup-pt2

Conversation

@Ninerian
Copy link
Copy Markdown
Contributor

  • raised phpstan to level 7 and fixed all issues

@Ninerian Ninerian requested a review from a team as a code owner October 29, 2025 13:53
@Ninerian Ninerian requested review from m-seidel and staffmariusz and removed request for a team October 29, 2025 13:53
Ninerian and others added 2 commits October 29, 2025 14:56
- 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>
Ninerian and others added 3 commits October 29, 2025 14:59
- 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>
Copy link
Copy Markdown
Contributor

@m-seidel m-seidel left a comment

Choose a reason for hiding this comment

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

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

Comment on lines +40 to +42
/**
* @return mixed
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/**
* @return mixed
*/

This is a duplication

Comment on lines 46 to +51
*
* @return array
*/
/**
* @return array<string, mixed>
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
*
* @return array
*/
/**
* @return array<string, mixed>
*/
*
* @return array<string, mixed>
*/

Comment on lines +58 to +63
* @param array $tokenData
* @return Token
*/
/**
* @param array<string,mixed> $tokenData
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
* @param array $tokenData
* @return Token
*/
/**
* @param array<string,mixed> $tokenData
*/
* @param array<string,mixed> $tokenData
* @return Token
*/

Comment on lines +50 to +52
/**
* @return array<string,mixed>
*/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pleas update the commented return line above and remove the duplication

* @return array Associative array of claim accessors.
*/
/**
* @return array<string,string>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pleas update the commented return line above and remove the duplication

.gitignore Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think it is needed

Suggested change

Base automatically changed from code-cleanup to refactor/code-cleanup April 1, 2026 07:39
Ninerian and others added 3 commits April 1, 2026 09:43
- 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>
@Ninerian Ninerian requested a review from m-seidel April 1, 2026 09:09
- 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>
@Ninerian Ninerian merged commit 5e8e190 into refactor/code-cleanup Apr 1, 2026
10 checks passed
@Ninerian Ninerian deleted the code-cleanup-pt2 branch April 1, 2026 14:31
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.

2 participants