Make activity events strict

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-10-11 15:06:23 +02:00
parent b5753d0efa
commit 16817f3743
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
4 changed files with 119 additions and 133 deletions

View File

@ -98,7 +98,7 @@ class ProviderTest extends TestCase {
return [ return [
[[42 => '/FortyTwo.txt'], null, '42', 'FortyTwo.txt', 'FortyTwo.txt'], [[42 => '/FortyTwo.txt'], null, '42', 'FortyTwo.txt', 'FortyTwo.txt'],
[['23' => '/Twenty/Three.txt'], null, '23', 'Three.txt', 'Twenty/Three.txt'], [['23' => '/Twenty/Three.txt'], null, '23', 'Three.txt', 'Twenty/Three.txt'],
['/Foo/Bar.txt', '128', '128', 'Bar.txt', 'Foo/Bar.txt'], // Legacy from ownCloud 8.2 and before ['/Foo/Bar.txt', '128', 128, 'Bar.txt', 'Foo/Bar.txt'], // Legacy from ownCloud 8.2 and before
]; ];
} }

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
/** /**
* @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2016, ownCloud, Inc.
* @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
@ -71,8 +72,8 @@ class Event implements IEvent {
/** @var string */ /** @var string */
protected $icon = ''; protected $icon = '';
/** @var IEvent */ /** @var IEvent|null */
protected $child = null; protected $child;
/** @var IValidator */ /** @var IValidator */
protected $richValidator; protected $richValidator;
@ -91,18 +92,18 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the app id is invalid * @throws \InvalidArgumentException if the app id is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setApp($app) { public function setApp(string $app): IEvent {
if (!is_string($app) || $app === '' || isset($app[32])) { if ($app === '' || isset($app[32])) {
throw new \InvalidArgumentException('The given app is invalid'); throw new \InvalidArgumentException('The given app is invalid');
} }
$this->app = (string) $app; $this->app = $app;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getApp() { public function getApp(): string {
return $this->app; return $this->app;
} }
@ -114,18 +115,18 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the type is invalid * @throws \InvalidArgumentException if the type is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setType($type) { public function setType(string $type): IEvent {
if (!is_string($type) || $type === '' || isset($type[255])) { if ($type === '' || isset($type[255])) {
throw new \InvalidArgumentException('The given type is invalid'); throw new \InvalidArgumentException('The given type is invalid');
} }
$this->type = (string) $type; $this->type = $type;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getType() { public function getType(): string {
return $this->type; return $this->type;
} }
@ -137,18 +138,18 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the affected user is invalid * @throws \InvalidArgumentException if the affected user is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setAffectedUser($affectedUser) { public function setAffectedUser(string $affectedUser): IEvent {
if (!is_string($affectedUser) || $affectedUser === '' || isset($affectedUser[64])) { if ($affectedUser === '' || isset($affectedUser[64])) {
throw new \InvalidArgumentException('The given affected user is invalid'); throw new \InvalidArgumentException('The given affected user is invalid');
} }
$this->affectedUser = (string) $affectedUser; $this->affectedUser = $affectedUser;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getAffectedUser() { public function getAffectedUser(): string {
return $this->affectedUser; return $this->affectedUser;
} }
@ -160,18 +161,18 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the author is invalid * @throws \InvalidArgumentException if the author is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setAuthor($author) { public function setAuthor(string $author): IEvent {
if (!is_string($author) || isset($author[64])) { if (isset($author[64])) {
throw new \InvalidArgumentException('The given author user is invalid'. serialize($author)); throw new \InvalidArgumentException('The given author user is invalid');
} }
$this->author = (string) $author; $this->author = $author;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getAuthor() { public function getAuthor(): string {
return $this->author; return $this->author;
} }
@ -183,18 +184,15 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the timestamp is invalid * @throws \InvalidArgumentException if the timestamp is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setTimestamp($timestamp) { public function setTimestamp(int $timestamp): IEvent {
if (!is_int($timestamp)) { $this->timestamp = $timestamp;
throw new \InvalidArgumentException('The given timestamp is invalid');
}
$this->timestamp = (int) $timestamp;
return $this; return $this;
} }
/** /**
* @return int * @return int
*/ */
public function getTimestamp() { public function getTimestamp(): int {
return $this->timestamp; return $this->timestamp;
} }
@ -207,11 +205,11 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the subject or parameters are invalid * @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setSubject($subject, array $parameters = []) { public function setSubject(string $subject, array $parameters = []): IEvent {
if (!is_string($subject) || isset($subject[255])) { if (isset($subject[255])) {
throw new \InvalidArgumentException('The given subject is invalid'); throw new \InvalidArgumentException('The given subject is invalid');
} }
$this->subject = (string) $subject; $this->subject = $subject;
$this->subjectParameters = $parameters; $this->subjectParameters = $parameters;
return $this; return $this;
} }
@ -219,14 +217,14 @@ class Event implements IEvent {
/** /**
* @return string * @return string
*/ */
public function getSubject() { public function getSubject(): string {
return $this->subject; return $this->subject;
} }
/** /**
* @return array * @return array
*/ */
public function getSubjectParameters() { public function getSubjectParameters(): array {
return $this->subjectParameters; return $this->subjectParameters;
} }
@ -236,8 +234,8 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the subject is invalid * @throws \InvalidArgumentException if the subject is invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setParsedSubject($subject) { public function setParsedSubject(string $subject): IEvent {
if (!is_string($subject) || $subject === '') { if ($subject === '') {
throw new \InvalidArgumentException('The given parsed subject is invalid'); throw new \InvalidArgumentException('The given parsed subject is invalid');
} }
$this->subjectParsed = $subject; $this->subjectParsed = $subject;
@ -248,7 +246,7 @@ class Event implements IEvent {
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getParsedSubject() { public function getParsedSubject(): string {
return $this->subjectParsed; return $this->subjectParsed;
} }
@ -259,15 +257,11 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the subject or parameters are invalid * @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setRichSubject($subject, array $parameters = []) { public function setRichSubject(string $subject, array $parameters = []): IEvent {
if (!is_string($subject) || $subject === '') { if ($subject === '') {
throw new \InvalidArgumentException('The given parsed subject is invalid'); throw new \InvalidArgumentException('The given parsed subject is invalid');
} }
$this->subjectRich = $subject; $this->subjectRich = $subject;
if (!is_array($parameters)) {
throw new \InvalidArgumentException('The given subject parameters are invalid');
}
$this->subjectRichParameters = $parameters; $this->subjectRichParameters = $parameters;
return $this; return $this;
@ -277,7 +271,7 @@ class Event implements IEvent {
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichSubject() { public function getRichSubject(): string {
return $this->subjectRich; return $this->subjectRich;
} }
@ -285,7 +279,7 @@ class Event implements IEvent {
* @return array[] * @return array[]
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichSubjectParameters() { public function getRichSubjectParameters(): array {
return $this->subjectRichParameters; return $this->subjectRichParameters;
} }
@ -298,11 +292,11 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the message or parameters are invalid * @throws \InvalidArgumentException if the message or parameters are invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setMessage($message, array $parameters = []) { public function setMessage(string $message, array $parameters = []): IEvent {
if (!is_string($message) || isset($message[255])) { if (isset($message[255])) {
throw new \InvalidArgumentException('The given message is invalid'); throw new \InvalidArgumentException('The given message is invalid');
} }
$this->message = (string) $message; $this->message = $message;
$this->messageParameters = $parameters; $this->messageParameters = $parameters;
return $this; return $this;
} }
@ -310,14 +304,14 @@ class Event implements IEvent {
/** /**
* @return string * @return string
*/ */
public function getMessage() { public function getMessage(): string {
return $this->message; return $this->message;
} }
/** /**
* @return array * @return array
*/ */
public function getMessageParameters() { public function getMessageParameters(): array {
return $this->messageParameters; return $this->messageParameters;
} }
@ -327,10 +321,7 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the message is invalid * @throws \InvalidArgumentException if the message is invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setParsedMessage($message) { public function setParsedMessage(string $message): IEvent {
if (!is_string($message)) {
throw new \InvalidArgumentException('The given parsed message is invalid');
}
$this->messageParsed = $message; $this->messageParsed = $message;
return $this; return $this;
} }
@ -339,7 +330,7 @@ class Event implements IEvent {
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getParsedMessage() { public function getParsedMessage(): string {
return $this->messageParsed; return $this->messageParsed;
} }
@ -350,15 +341,8 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the subject or parameters are invalid * @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setRichMessage($message, array $parameters = []) { public function setRichMessage(string $message, array $parameters = []): IEvent {
if (!is_string($message)) {
throw new \InvalidArgumentException('The given parsed message is invalid');
}
$this->messageRich = $message; $this->messageRich = $message;
if (!is_array($parameters)) {
throw new \InvalidArgumentException('The given message parameters are invalid');
}
$this->messageRichParameters = $parameters; $this->messageRichParameters = $parameters;
return $this; return $this;
@ -368,7 +352,7 @@ class Event implements IEvent {
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichMessage() { public function getRichMessage(): string {
return $this->messageRich; return $this->messageRich;
} }
@ -376,7 +360,7 @@ class Event implements IEvent {
* @return array[] * @return array[]
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichMessageParameters() { public function getRichMessageParameters(): array {
return $this->messageRichParameters; return $this->messageRichParameters;
} }
@ -390,40 +374,37 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the object is invalid * @throws \InvalidArgumentException if the object is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setObject($objectType, $objectId, $objectName = '') { public function setObject(string $objectType, int $objectId, string $objectName = ''): IEvent {
if (!is_string($objectType) || isset($objectType[255])) { if (isset($objectType[255])) {
throw new \InvalidArgumentException('The given object type is invalid'); throw new \InvalidArgumentException('The given object type is invalid');
} }
if (!is_int($objectId)) { if (isset($objectName[4000])) {
throw new \InvalidArgumentException('The given object id is invalid');
}
if (!is_string($objectName) || isset($objectName[4000])) {
throw new \InvalidArgumentException('The given object name is invalid'); throw new \InvalidArgumentException('The given object name is invalid');
} }
$this->objectType = (string) $objectType; $this->objectType = $objectType;
$this->objectId = (int) $objectId; $this->objectId = $objectId;
$this->objectName = (string) $objectName; $this->objectName = $objectName;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getObjectType() { public function getObjectType(): string {
return $this->objectType; return $this->objectType;
} }
/** /**
* @return string * @return int
*/ */
public function getObjectId() { public function getObjectId(): int {
return $this->objectId; return $this->objectId;
} }
/** /**
* @return string * @return string
*/ */
public function getObjectName() { public function getObjectName(): string {
return $this->objectName; return $this->objectName;
} }
@ -435,18 +416,18 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the link is invalid * @throws \InvalidArgumentException if the link is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setLink($link) { public function setLink(string $link): IEvent {
if (!is_string($link) || isset($link[4000])) { if (isset($link[4000])) {
throw new \InvalidArgumentException('The given link is invalid'); throw new \InvalidArgumentException('The given link is invalid');
} }
$this->link = (string) $link; $this->link = $link;
return $this; return $this;
} }
/** /**
* @return string * @return string
*/ */
public function getLink() { public function getLink(): string {
return $this->link; return $this->link;
} }
@ -456,8 +437,8 @@ class Event implements IEvent {
* @throws \InvalidArgumentException if the icon is invalid * @throws \InvalidArgumentException if the icon is invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setIcon($icon) { public function setIcon(string $icon): IEvent {
if (!is_string($icon) || isset($icon[4000])) { if (isset($icon[4000])) {
throw new \InvalidArgumentException('The given icon is invalid'); throw new \InvalidArgumentException('The given icon is invalid');
} }
$this->icon = $icon; $this->icon = $icon;
@ -468,16 +449,18 @@ class Event implements IEvent {
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getIcon() { public function getIcon(): string {
return $this->icon; return $this->icon;
} }
/** /**
* @param IEvent $child * @param IEvent $child
* @since 11.0.0 * @return $this
* @since 11.0.0 - Since 15.0.0 returns $this
*/ */
public function setChildEvent(IEvent $child) { public function setChildEvent(IEvent $child): IEvent {
$this->child = $child; $this->child = $child;
return $this;
} }
/** /**
@ -492,7 +475,7 @@ class Event implements IEvent {
* @return bool * @return bool
* @since 8.2.0 * @since 8.2.0
*/ */
public function isValid() { public function isValid(): bool {
return return
$this->isValidCommon() $this->isValidCommon()
&& &&
@ -504,7 +487,7 @@ class Event implements IEvent {
* @return bool * @return bool
* @since 8.2.0 * @since 8.2.0
*/ */
public function isValidParsed() { public function isValidParsed(): bool {
if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) { if ($this->getRichSubject() !== '' || !empty($this->getRichSubjectParameters())) {
try { try {
$this->richValidator->validate($this->getRichSubject(), $this->getRichSubjectParameters()); $this->richValidator->validate($this->getRichSubject(), $this->getRichSubjectParameters());
@ -528,10 +511,7 @@ class Event implements IEvent {
; ;
} }
/** protected function isValidCommon(): bool {
* @return bool
*/
protected function isValidCommon() {
return return
$this->getApp() !== '' $this->getApp() !== ''
&& &&

View File

@ -1,4 +1,5 @@
<?php <?php
declare(strict_types=1);
/** /**
* @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2016, ownCloud, Inc.
* @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com> * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
@ -45,7 +46,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the app id is invalid * @throws \InvalidArgumentException if the app id is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setApp($app); public function setApp(string $app): self;
/** /**
* Set the type of the activity * Set the type of the activity
@ -55,7 +56,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the type is invalid * @throws \InvalidArgumentException if the type is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setType($type); public function setType(string $type): self;
/** /**
* Set the affected user of the activity * Set the affected user of the activity
@ -65,7 +66,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the affected user is invalid * @throws \InvalidArgumentException if the affected user is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setAffectedUser($user); public function setAffectedUser(string $user): self;
/** /**
* Set the author of the activity * Set the author of the activity
@ -75,7 +76,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the author is invalid * @throws \InvalidArgumentException if the author is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setAuthor($author); public function setAuthor(string $author): self;
/** /**
* Set the author of the activity * Set the author of the activity
@ -85,7 +86,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the timestamp is invalid * @throws \InvalidArgumentException if the timestamp is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setTimestamp($timestamp); public function setTimestamp(int $timestamp): self;
/** /**
* Set the subject of the activity * Set the subject of the activity
@ -96,7 +97,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the subject or parameters are invalid * @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setSubject($subject, array $parameters = []); public function setSubject(string $subject, array $parameters = []): self;
/** /**
* @param string $subject * @param string $subject
@ -104,13 +105,13 @@ interface IEvent {
* @throws \InvalidArgumentException if the subject is invalid * @throws \InvalidArgumentException if the subject is invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setParsedSubject($subject); public function setParsedSubject(string $subject): self;
/** /**
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getParsedSubject(); public function getParsedSubject(): string;
/** /**
* @param string $subject * @param string $subject
@ -119,19 +120,19 @@ interface IEvent {
* @throws \InvalidArgumentException if the subject or parameters are invalid * @throws \InvalidArgumentException if the subject or parameters are invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setRichSubject($subject, array $parameters = []); public function setRichSubject(string $subject, array $parameters = []): self;
/** /**
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichSubject(); public function getRichSubject(): string;
/** /**
* @return array[] * @return array[]
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichSubjectParameters(); public function getRichSubjectParameters(): array;
/** /**
* Set the message of the activity * Set the message of the activity
@ -142,7 +143,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the message or parameters are invalid * @throws \InvalidArgumentException if the message or parameters are invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setMessage($message, array $parameters = []); public function setMessage(string $message, array $parameters = []): self;
/** /**
* @param string $message * @param string $message
@ -150,13 +151,13 @@ interface IEvent {
* @throws \InvalidArgumentException if the message is invalid * @throws \InvalidArgumentException if the message is invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setParsedMessage($message); public function setParsedMessage(string $message): self;
/** /**
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getParsedMessage(); public function getParsedMessage(): string;
/** /**
* @param string $message * @param string $message
@ -165,19 +166,19 @@ interface IEvent {
* @throws \InvalidArgumentException if the message or parameters are invalid * @throws \InvalidArgumentException if the message or parameters are invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setRichMessage($message, array $parameters = []); public function setRichMessage(string $message, array $parameters = []): self;
/** /**
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichMessage(); public function getRichMessage(): string;
/** /**
* @return array[] * @return array[]
* @since 11.0.0 * @since 11.0.0
*/ */
public function getRichMessageParameters(); public function getRichMessageParameters(): array;
/** /**
* Set the object of the activity * Set the object of the activity
@ -189,7 +190,7 @@ interface IEvent {
* @throws \InvalidArgumentException if the object is invalid * @throws \InvalidArgumentException if the object is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setObject($objectType, $objectId, $objectName = ''); public function setObject(string $objectType, int $objectId, string $objectName = ''): self;
/** /**
* Set the link of the activity * Set the link of the activity
@ -199,85 +200,85 @@ interface IEvent {
* @throws \InvalidArgumentException if the link is invalid * @throws \InvalidArgumentException if the link is invalid
* @since 8.2.0 * @since 8.2.0
*/ */
public function setLink($link); public function setLink(string $link): self;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getApp(); public function getApp(): string;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getType(); public function getType(): string;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getAffectedUser(); public function getAffectedUser(): string;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getAuthor(); public function getAuthor(): string;
/** /**
* @return int * @return int
* @since 8.2.0 * @since 8.2.0
*/ */
public function getTimestamp(); public function getTimestamp(): int;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getSubject(); public function getSubject(): string;
/** /**
* @return array * @return array
* @since 8.2.0 * @since 8.2.0
*/ */
public function getSubjectParameters(); public function getSubjectParameters(): array;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getMessage(); public function getMessage(): string;
/** /**
* @return array * @return array
* @since 8.2.0 * @since 8.2.0
*/ */
public function getMessageParameters(); public function getMessageParameters(): array;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getObjectType(); public function getObjectType(): string;
/**
* @return int
* @since 8.2.0
*/
public function getObjectId(): int;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getObjectId(); public function getObjectName(): string;
/** /**
* @return string * @return string
* @since 8.2.0 * @since 8.2.0
*/ */
public function getObjectName(); public function getLink(): string;
/**
* @return string
* @since 8.2.0
*/
public function getLink();
/** /**
* @param string $icon * @param string $icon
@ -285,19 +286,20 @@ interface IEvent {
* @throws \InvalidArgumentException if the icon is invalid * @throws \InvalidArgumentException if the icon is invalid
* @since 11.0.0 * @since 11.0.0
*/ */
public function setIcon($icon); public function setIcon(string $icon): self;
/** /**
* @return string * @return string
* @since 11.0.0 * @since 11.0.0
*/ */
public function getIcon(); public function getIcon(): string;
/** /**
* @param IEvent $child * @param IEvent $child
* @since 11.0.0 * @return $this
* @since 11.0.0 - Since 15.0.0 returns $this
*/ */
public function setChildEvent(IEvent $child); public function setChildEvent(IEvent $child): self;
/** /**
* @return IEvent|null * @return IEvent|null
@ -309,11 +311,11 @@ interface IEvent {
* @return bool * @return bool
* @since 11.0.0 * @since 11.0.0
*/ */
public function isValid(); public function isValid(): bool;
/** /**
* @return bool * @return bool
* @since 11.0.0 * @since 11.0.0
*/ */
public function isValidParsed(); public function isValidParsed(): bool;
} }

View File

@ -103,6 +103,10 @@ class SecurityProviderTest extends TestCase {
$event->expects($this->once()) $event->expects($this->once())
->method('getSubject') ->method('getSubject')
->willReturn($subject); ->willReturn($subject);
$event->method('getSubjectParameters')
->willReturn([
'provider' => 'myProvider',
]);
$event->expects($this->once()) $event->expects($this->once())
->method('setParsedSubject'); ->method('setParsedSubject');