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

ENH Add generic types #177

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Extensions/MemberExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

/**
* Augment `Member` to allow relationship to the LoginSession DataObject
*
* @method SilverStripe\ORM\HasManyList<LoginSession> LoginSessions()
*
* @extends DataExtension<Member>
*/
class MemberExtension extends DataExtension
{
Expand Down
4 changes: 4 additions & 0 deletions src/Extensions/QueuedJobDescriptorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

use SilverStripe\Core\Extension;
use SilverStripe\SessionManager\Jobs\GarbageCollectionJob;
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;

/**
* @extends Extension<QueuedJobDescriptor>
*/
class QueuedJobDescriptorExtension extends Extension
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Extensions/RememberLoginHashExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Extension;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Security\RememberLoginHash;
use SilverStripe\SessionManager\Models\LoginSession;
use SilverStripe\SessionManager\Security\LogInAuthenticationHandler;

/**
* @method LoginSession LoginSession()
*
* @extends Extension<RememberLoginHash>
*/
class RememberLoginHashExtension extends Extension
{
Expand Down
2 changes: 0 additions & 2 deletions src/FormFields/SessionManagerField.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public function getSchemaDataDefaults()
if (!$this->value && $this->getForm() && $this->getForm()->getRecord() instanceof Member) {
$member = $this->getForm()->getRecord();
} else {
/** @var Member $member */
$member = DataObject::get_by_id(Member::class, $this->value);
}

Expand All @@ -122,7 +121,6 @@ protected function getLoginSessions(Member $member)
$logOutEndpoint = LoginSessionController::singleton()->Link();

$loginSessions = [];
/** @var LoginSession $loginSession */
foreach (LoginSession::getCurrentSessions($member) as $loginSession) {
if (!$loginSession->canView()) {
continue;
Expand Down
1 change: 0 additions & 1 deletion src/Middleware/LoginSessionMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public function process(HTTPRequest $request, callable $delegate)

try {
$loginSessionID = $request->getSession()->get($loginHandler->getSessionVariable());
/** @var LoginSession $loginSession */
$loginSession = LoginSession::get_by_id($loginSessionID);

// If the session has already been revoked, or we've got a mismatched
Expand Down
2 changes: 1 addition & 1 deletion src/Models/LoginSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function isCurrent(?HTTPRequest $request = null): bool

/**
* @param Member $member
* @return DataList|LoginSession[]
* @return DataList<LoginSession>
*/
public static function getCurrentSessions(Member $member)
{
Expand Down