Skip to content

Commit

Permalink
ENH Add generic types (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli authored Jan 18, 2024
1 parent 8b0c8f5 commit 8c847f5
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/AuditHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace SilverStripe\Auditor;

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\Controller;
use SilverStripe\Control\Email\Email;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataExtension;
Expand All @@ -16,6 +18,8 @@

/**
* Provides logging hooks that are inserted into Framework objects.
*
* @extends DataExtension<Member|SiteTree|Controller>
*/
class AuditHook extends DataExtension
{
Expand All @@ -38,7 +42,6 @@ public static function handle_manipulation($manipulation)
return false;
}

/** @var DataObjectSchema $schema */
$schema = DataObject::getSchema();

// The tables that we watch for manipulation on
Expand Down
4 changes: 4 additions & 0 deletions code/AuditHookMFA.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

use Psr\Log\LoggerInterface;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\MFA\Authenticator\LoginHandler;
use SilverStripe\MFA\Method\MethodInterface;
use SilverStripe\MFA\Service\RegisteredMethodManager;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Security\Member;

/**
* Provides logging actions on extension hooks from certain silverstripe/mfa actions.
*
* @extends DataExtension<LoginHandler|RegisteredMethodManager>
*/
class AuditHookMFA extends DataExtension
{
Expand Down
4 changes: 4 additions & 0 deletions code/AuditHookManyManyList.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SilverStripe\Auditor;

use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\ManyManyList;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
Expand All @@ -11,6 +12,9 @@
/**
* AuditHookManyManyList is meant to override ManyManyList. When a Member is
* removed from a Group, it logs the event.
*
* @template T of DataObject
* @extends ManyManyList<T>
*/
class AuditHookManyManyList extends ManyManyList
{
Expand Down
3 changes: 3 additions & 0 deletions code/AuditHookSessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Security\Security;
use SilverStripe\SessionManager\Controllers\LoginSessionController;
use SilverStripe\SessionManager\Models\LoginSession;

/**
* Provides logging actions on extension hooks from certain silverstripe/session-manager actions.
*
* @extends DataExtension<LoginSessionController>
*/
class AuditHookSessionManager extends DataExtension
{
Expand Down
4 changes: 4 additions & 0 deletions code/Extensions/ProxyDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
use SilverStripe\Auditor\AuditHook;
use SilverStripe\Core\Extension;
use TractorCow\ClassProxy\Generators\ProxyGenerator;
use TractorCow\SilverStripeProxyDB\ProxyDBFactory;

/**
* @extends Extension<ProxyDBFactory>
*/
class ProxyDBExtension extends Extension
{
/**
Expand Down

0 comments on commit 8c847f5

Please sign in to comment.