Skip to content

Commit

Permalink
Fix compatibility by removing type constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 24, 2024
1 parent c8d526a commit 3a1ae4c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/main/php/peer/stomp/ReceivedMessage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ protected function assertConnection() {
/**
* Acknowledge given message
*
* @param peer.stomp.Transaction $t
* @param ?peer.stomp.Transaction $t
*/
public function ack(Transaction $t= null) {
public function ack($t= null) {
$this->assertConnection();
$frame= new AckFrame($this->getMessageId(), $this->getSubscription()->getId());
if ($t) {
Expand All @@ -115,9 +115,9 @@ public function ack(Transaction $t= null) {
/**
* Reject given message
*
* @param peer.stomp.Transaction $t
* @param ?peer.stomp.Transaction $t
*/
public function nack(Transaction $t= null) {
public function nack($t= null) {
$this->assertConnection();
$frame= new NackFrame($this->getMessageId(), $this->getSubscription()->getId());
if ($t) {
Expand All @@ -129,18 +129,16 @@ public function nack(Transaction $t= null) {
/**
* Determine whether message is ackable
*
* @return boolean
* @return bool
*/
public function ackable() {
return in_array($this->getSubscription()->getAckMode(), [
\peer\stomp\AckMode::CLIENT,
\peer\stomp\AckMode::INDIVIDUAL
]);
return in_array($this->getSubscription()->getAckMode(), [AckMode::CLIENT, AckMode::INDIVIDUAL]);
}

/**
*
* @return [type]
* Creates a sendable message
*
* @return peer.stomp.SendableMessage
*/
public function toSendable() {
$message= new SendableMessage($this->getBody(), $this->getContentType());
Expand All @@ -153,6 +151,7 @@ public function toSendable() {
return $message;
}

/** @return string */
public function toString() {
$s= nameof($this).'('.$this->hashCode().") {\n";
$s.= " [ destination ] ".Objects::stringOf($this->getDestination(), ' ')."\n";
Expand All @@ -161,7 +160,6 @@ public function toString() {
$s.= " [ content-type ] ".$this->getContentType()."\n";
$s.= " [ headers ] ".Objects::stringOf($this->getHeaders(), ' ')."\n";
$s.= " [ body ] ".$this->getBody()."\n";

return $s.'}';
}
}

0 comments on commit 3a1ae4c

Please sign in to comment.