Skip to content

refactor: Code cleanup Pt1#37

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

refactor: Code cleanup Pt1#37
Ninerian merged 16 commits intorefactor/code-cleanupfrom
code-cleanup

Conversation

@Ninerian
Copy link
Copy Markdown
Contributor

  • added code quality dependencies
  • raised phpstan level to 5 and fixed all errors
  • updated phpunit to 10

@Ninerian Ninerian requested a review from a team as a code owner October 29, 2025 13:52
@Ninerian Ninerian requested review from Magnet-js and MrLeonix and removed request for a team October 29, 2025 13:52
Ninerian and others added 12 commits October 29, 2025 15:09
- 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>
Comment on lines +5 to +7
branches:
- 'main'
- '**/**'
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.

What is the goal here? Why not just

Suggested change
branches:
- 'main'
- '**/**'
branches:
- '**'

Comment on lines +10 to +12
branches:
- 'main'
- '**/**'
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.

Same as above

* @see \Staffbase\plugins\sdk\SSOToken::CLAIM_AUDIENCE
*/
const CLAIM_AUDIENCE = 'aud';
public const CLAIM_AUDIENCE = 'aud';
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.

Why do we want to switch to public when it is already marked as deprecated? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just for the sake of lint error fixing 😬

@@ -460,84 +472,10 @@ public function testSessionIdCheck()
public function testDestroyOtherSession()
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.

What is the plan for this empty test?

$session->destroySession($sessionHash);
}

public function testDestroyOwnSession()
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.

What is the plan for this empty test?

# CodeSniffer
phpcs.xml

/vendor/*
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.

this one is already covered by line 13

Restored testDestroyOtherSession and testDestroyOwnSession which had been
emptied with markTestSkipped due to PHPUnit 10 incompatibilities.

- Replace removed setMethodsExcept()->getMock() with getMock() (PHPUnit 10)
- Add gc() stub required by SessionHandlerInterface
- Set mock expectations before destroySession() call for correct isolation

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 06:40
# CodeSniffer
phpcs.xml

/vendor/*
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.

Line 13 is already excluyding the vendor folder

Suggested change
/vendor/*

- Do not create code outside of src/ and test/ unless explicitly requested. Never create example or playground code that is not integrated into the SDK or its tests.

## Documentation
- Consult CLAUDE.md at project root for further architectural guidance and standard commands.
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.

That's a good way 👍

@Ninerian Ninerian merged commit 8e10f11 into refactor/code-cleanup Apr 1, 2026
10 checks passed
@Ninerian Ninerian deleted the code-cleanup branch April 1, 2026 07:39
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