diff --git a/config.xsd b/config.xsd index 9d785d39b04..6b32c873204 100644 --- a/config.xsd +++ b/config.xsd @@ -729,6 +729,7 @@ + diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 93fecd99d7d..e13fa5db833 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -629,6 +629,7 @@ class Config * @var array */ public $php_extensions = [ + "amqp" => null, "apcu" => null, "decimal" => null, "dom" => null, diff --git a/stubs/extensions/amqp.phpstub b/stubs/extensions/amqp.phpstub new file mode 100644 index 00000000000..3b40ae3766d --- /dev/null +++ b/stubs/extensions/amqp.phpstub @@ -0,0 +1,2081 @@ + amqp.host The host to connect too. Note: Max 1024 characters. + * 'port' => amqp.port Port on the host. + * 'vhost' => amqp.vhost The virtual host on the host. Note: Max 128 characters. + * 'login' => amqp.login The login name to use. Note: Max 128 characters. + * 'password' => amqp.password Password. Note: Max 128 characters. + * 'read_timeout' => Timeout in for consume. Note: 0 or greater seconds. May be fractional. + * 'write_timeout' => Timeout in for publish. Note: 0 or greater seconds. May be fractional. + * 'connect_timeout' => Connection timeout. Note: 0 or greater seconds. May be fractional. + * 'rpc_timeout' => Timeout for RPC-style AMQP methods. Note: 0 or greater seconds. May be fractional. + * + * Connection tuning options (see http://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.tune for details): + * 'channel_max' => Specifies highest channel number that the server permits. 0 means standard extension limit + * (see PHP_AMQP_MAX_CHANNELS constant) + * 'frame_max' => The largest frame size that the server proposes for the connection, including frame header + * and end-byte. 0 means standard extension limit (depends on librabbimq default frame size limit) + * 'heartbeat' => The delay, in seconds, of the connection heartbeat that the server wants. + * 0 means the server does not want a heartbeat. Note, librabbitmq has limited heartbeat support, + * which means heartbeats checked only during blocking calls. + * + * TLS support (see https://www.rabbitmq.com/ssl.html for details): + * 'cacert' => Path to the CA cert file in PEM format.. + * 'cert' => Path to the client certificate in PEM foramt. + * 'key' => Path to the client key in PEM format. + * 'verify' => Enable or disable peer verification. If peer verification is enabled then the common name in the + * server certificate must match the server name. Peer verification is enabled by default. + * + * 'connection_name' => A user determined name for the connection + * ) + * + * @param array $credentials Optional array of credential information for + * connecting to the AMQP broker. + */ + public function __construct(array $credentials = []) + { + } + + /** + * Check whether the connection to the AMQP broker is still valid. + * + * Cannot reliably detect dropped connections or unusual socket errors, as it does not actively + * engage the socket. + * + * @return boolean TRUE if connected, FALSE otherwise. + */ + public function isConnected(): bool + { + } + + /** + * Whether connection persistent. + * + * When no connection is established, it will always return FALSE. The same disclaimer as for + * {@see AMQPConnection::isConnected()} applies. + * + * @return boolean TRUE if persistently connected, FALSE otherwise. + */ + public function isPersistent(): bool + { + } + + /** + * Establish a transient connection with the AMQP broker. + * + * This method will initiate a connection with the AMQP broker. + * + * @throws AMQPConnectionException + */ + public function connect(): void + { + } + + /** + * Closes the transient connection with the AMQP broker. + * + * This method will close an open connection with the AMQP broker. + * + * @throws AMQPConnectionException When attempting to disconnect a persistent connection + */ + public function disconnect(): void + { + } + + /** + * Close any open transient connections and initiate a new one with the AMQP broker. + * + * @throws AMQPConnectionException + */ + public function reconnect(): void + { + } + + /** + * Establish a persistent connection with the AMQP broker. + * + * This method will initiate a connection with the AMQP broker + * or reuse an existing one if present. + * + * @throws AMQPConnectionException + */ + public function pconnect(): void + { + } + + /** + * Closes a persistent connection with the AMQP broker. + * + * This method will close an open persistent connection with the AMQP + * broker. + * + * @throws AMQPConnectionException When attempting to disconnect a transient connection + */ + public function pdisconnect(): void + { + } + + /** + * Close any open persistent connections and initiate a new one with the AMQP broker. + * + * @throws AMQPConnectionException + */ + public function preconnect(): void + { + } + + /** + * Get the configured host. + * + * @return string The configured hostname of the broker + */ + public function getHost(): string + { + } + + /** + * Get the configured login. + * + * @return string The configured login as a string. + */ + public function getLogin(): string + { + } + + /** + * Get the configured password. + * + * @return string The configured password as a string. + */ + public function getPassword(): string + { + } + + /** + * Get the configured port. + * + * @return int The configured port as an integer. + */ + public function getPort(): int + { + } + + /** + * Get the configured vhost. + * + * @return string The configured virtual host as a string. + */ + public function getVhost(): string + { + } + + /** + * Set the hostname used to connect to the AMQP broker. + * + * @param string $host The hostname of the AMQP broker. + * + * @throws AMQPConnectionException If host is longer then 1024 characters. + */ + public function setHost(string $host): void + { + } + + /** + * Set the login string used to connect to the AMQP broker. + * + * @param string $login The login string used to authenticate + * with the AMQP broker. + * + * @throws AMQPConnectionException If login is longer then 32 characters. + */ + public function setLogin(string $login): void + { + } + + /** + * Set the password string used to connect to the AMQP broker. + * + * @param string $password The password string used to authenticate + * with the AMQP broker. + * + * @throws AMQPConnectionException If password is longer then 32characters. + */ + public function setPassword(string $password): void + { + } + + /** + * Set the port used to connect to the AMQP broker. + * + * @param integer $port The port used to connect to the AMQP broker. + * + * @throws AMQPConnectionException If port is longer not between + * 1 and 65535. + */ + public function setPort(int $port): void + { + } + + /** + * Sets the virtual host to which to connect on the AMQP broker. + * + * @param string $vhost The virtual host to use on the AMQP + * broker. + * + * @throws AMQPConnectionException If host is longer then 32 characters. + */ + public function setVhost(string $vhost): void + { + } + + /** + * Sets the interval of time to wait for income activity from AMQP broker + * + * @deprecated use AMQPConnection::setReadTimeout($timeout) instead + * + * @throws AMQPConnectionException If timeout is less than 0. + */ + public function setTimeout(float $timeout): void + { + } + + /** + * Get the configured interval of time to wait for income activity + * from AMQP broker + * + * @deprecated use AMQPConnection::getReadTimeout() instead + */ + public function getTimeout(): float + { + } + + /** + * Sets the interval of time (in seconds) to wait for income activity from AMQP broker + * + * @throws AMQPConnectionException If timeout is less than 0. + */ + public function setReadTimeout(float $timeout): void + { + } + + /** + * Get the configured interval of time (in seconds) to wait for income activity + * from AMQP broker + */ + public function getReadTimeout(): float + { + } + + /** + * Sets the interval of time (in seconds) to wait for outcome activity to AMQP broker + * + * @throws AMQPConnectionException If timeout is less than 0. + */ + public function setWriteTimeout(float $timeout): void + { + } + + /** + * Get the configured interval of time (in seconds) to wait for outcome activity + * to AMQP broker + */ + public function getWriteTimeout(): float + { + } + + /** + * Get the configured timeout (in seconds) for connecting to the AMQP broker + */ + public function getConnectTimeout(): float + { + } + + /** + * Sets the interval of time to wait (in seconds) for RPC activity to AMQP broker + * + * @throws AMQPConnectionException If timeout is less than 0. + */ + public function setRpcTimeout(float $timeout): void + { + } + + /** + * Get the configured interval of time (in seconds) to wait for RPC activity + * to AMQP broker + */ + public function getRpcTimeout(): float + { + } + + /** + * Return last used channel id during current connection session. + */ + public function getUsedChannels(): int + { + } + + /** + * Get the maximum number of channels the connection can handle. + * + * When connection is connected, effective connection value returned, which is normally the same as original + * correspondent value passed to constructor, otherwise original value passed to constructor returned. + */ + public function getMaxChannels(): int + { + } + + /** + * Get max supported frame size per connection in bytes. + * + * When connection is connected, effective connection value returned, which is normally the same as original + * correspondent value passed to constructor, otherwise original value passed to constructor returned. + */ + public function getMaxFrameSize(): int + { + } + + /** + * Get number of seconds between heartbeats of the connection in seconds. + * + * When connection is connected, effective connection value returned, which is normally the same as original + * correspondent value passed to constructor, otherwise original value passed to constructor returned. + */ + public function getHeartbeatInterval(): int + { + } + + /** + * Get path to the CA cert file in PEM format + */ + public function getCACert(): ?string + { + } + + /** + * Set path to the CA cert file in PEM format + */ + public function setCACert(?string $cacert): void + { + } + + /** + * Get path to the client certificate in PEM format + */ + public function getCert(): ?string + { + } + + /** + * Set path to the client certificate in PEM format + */ + public function setCert(?string $cert): void + { + } + + /** + * Get path to the client key in PEM format + */ + public function getKey(): ?string + { + } + + /** + * Set path to the client key in PEM format + */ + public function setKey(?string $key): void + { + } + + /** + * Get whether peer verification enabled or disabled + */ + public function getVerify(): bool + { + } + + /** + * Enable or disable peer verification + */ + public function setVerify(bool $verify): void + { + } + + /** + * set authentication method + * + * @param int $saslMethod AMQP_SASL_METHOD_PLAIN | AMQP_SASL_METHOD_EXTERNAL + */ + public function setSaslMethod(int $saslMethod): void + { + } + + public function getSaslMethod(): int + { + } + + public function setConnectionName(?string $connectionName): void + { + } + + public function getConnectionName(): ?string + { + } +} + +/** + * stub class representing AMQPConnectionException from pecl-amqp + */ +class AMQPConnectionException extends AMQPException +{ +} + +/** + * stub class representing AMQPDecimal from pecl-amqp + * + * @readonly + */ +final /* readonly */ class AMQPDecimal implements AMQPValue +{ + /** + * @var int + */ + public const EXPONENT_MIN = 0; + + /** + * @var int + */ + public const EXPONENT_MAX = 255; + + /** + * @var int + */ + public const SIGNIFICAND_MIN = 0; + + /** + * @var int + */ + public const SIGNIFICAND_MAX = 4294967295; + + private int $exponent; + + private int $significand; + + /** + * @throws AMQPValueException + */ + public function __construct(int $exponent, int $significand) + { + } + + public function getExponent(): int + { + } + + public function getSignificand(): int + { + } + + public function toAmqpValue() + { + } +} + +/** + * stub class representing AMQPEnvelope from pecl-amqp + */ +class AMQPEnvelope extends AMQPBasicProperties +{ + private string $body = ''; + + private ?string $consumerTag = null; + + private ?int $deliveryTag = null; + + private bool $isRedelivery = false; + + private ?string $exchangeName = null; + + private string $routingKey = ''; + + public function __construct() + { + } + + /** + * Get the body of the message. + * + * @return string The contents of the message body. + */ + public function getBody(): string + { + } + + /** + * Get the routing key of the message. + * + * @return string The message routing key. + */ + public function getRoutingKey(): string + { + } + + /** + * Get the consumer tag of the message. + * + * @return string|null The consumer tag of the message. + */ + public function getConsumerTag(): ?string + { + } + + /** + * Get the delivery tag of the message. + * + * @return integer|null The delivery tag of the message. + */ + public function getDeliveryTag(): ?int + { + } + + /** + * Get the exchange name on which the message was published. + * + * @return string|null The exchange name on which the message was published. + */ + public function getExchangeName(): ?string + { + } + + /** + * Whether this is a redelivery of the message. + * + * Whether this is a redelivery of a message. If this message has been + * delivered and AMQPEnvelope::nack() was called, the message will be put + * back on the queue to be redelivered, at which point the message will + * always return TRUE when this method is called. + * + * @return bool TRUE if this is a redelivery, FALSE otherwise. + */ + public function isRedelivery(): bool + { + } + + /** + * Get a specific message header. + * + * @param string $headerName Name of the header to get the value from. + * + * @return mixed The contents of the specified header or null if not set. + */ + public function getHeader(string $headerName) + { + } + + /** + * Check whether specific message header exists. + * + * @param string $headerName Name of the header to check. + * + * @return boolean + */ + public function hasHeader(string $headerName): bool + { + } +} + +/** + * stub class representing AMQPEnvelopeException from pecl-amqp + */ +class AMQPEnvelopeException extends AMQPException +{ + private AMQPEnvelope $envelope; + + public function getEnvelope(): AMQPEnvelope + { + } +} + +/** + * stub class representing AMQPException from pecl-amqp + */ +class AMQPException extends Exception +{ +} + +/** + * stub class representing AMQPExchange from pecl-amqp + */ +class AMQPExchange +{ + private AMQPConnection $connection; + + private AMQPChannel $channel; + + private ?string $name = null; + + private ?string $type = null; + + private bool $passive = false; + + private bool $durable = false; + + private bool $autoDelete = false; + + private bool $internal = false; + + private array $arguments = []; + + /** + * Create an instance of AMQPExchange. + * + * Returns a new instance of an AMQPExchange object, associated with the + * given AMQPChannel object. + * + * @param AMQPChannel $channel A valid AMQPChannel object, connected + * to a broker. + * + * @throws AMQPExchangeException When amqp_channel is not connected to + * a broker. + * @throws AMQPConnectionException If the connection to the broker was + * lost. + */ + public function __construct(AMQPChannel $channel) + { + } + + /** + * Bind to another exchange. + * + * Bind an exchange to another exchange using the specified routing key. + * + * @param string $exchangeName Name of the exchange to bind. + * @param string|null $routingKey The routing key to use for binding. + * @param array $arguments Additional binding arguments. + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPExchangeException On failure. + */ + public function bind(string $exchangeName, ?string $routingKey = null, array $arguments = []): void + { + } + + /** + * Remove binding to another exchange. + * + * Remove a routing key binding on an another exchange from the given exchange. + * + * @param string $exchangeName Name of the exchange to bind. + * @param string|null $routingKey The routing key to use for binding. + * @param array $arguments Additional binding arguments. + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPExchangeException On failure. + */ + public function unbind(string $exchangeName, ?string $routingKey = null, array $arguments = []): void + { + } + + /** + * Declare a new exchange on the broker. + * + * @throws AMQPExchangeException On failure. + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + */ + public function declareExchange(): void + { + } + + /** + * Declare a new exchange on the broker. + * + * @throws AMQPExchangeException On failure. + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + */ + public function declare(): void + { + } + + /** + * Delete the exchange from the broker. + * + * @param string $exchangeName Optional name of exchange to delete. If not specified it uses the name of the + * exchange object + * @param integer $flags Optionally AMQP_IFUNUSED can be specified + * to indicate the exchange should not be + * deleted until no clients are connected to + * it. + * + * @throws AMQPExchangeException On failure. + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + */ + public function delete(?string $exchangeName = null, ?int $flags = null): void + { + } + + /** + * Get the argument associated with the given key. + * + * @param string $argumentName The key to look up. + * @throws AMQPExchangeException If key does not exist + * @return bool|int|double|string|null + */ + public function getArgument(string $argumentName) + { + } + + /** + * Check whether argument associated with the given key exists. + * + * @param string $argumentName The key to look up. + * + * @return boolean + */ + public function hasArgument(string $argumentName): bool + { + } + + /** + * Get all arguments set on the given exchange. + * + * @return array An array containing all the set key/value pairs. + */ + public function getArguments(): array + { + } + + /** + * Get all the flags currently set on the given exchange. + * + * @return int An integer bitmask of all the flags currently set on this + * exchange object. + */ + public function getFlags(): int + { + } + + /** + * Get the configured name. + * + * @return string|null The configured name as a string. + */ + public function getName(): ?string + { + } + + /** + * Get the configured type. + * + * @return string|null The configured type as a string. + */ + public function getType(): ?string + { + } + + /** + * Publish a message to an exchange. + * + * Publish a message to the exchange represented by the AMQPExchange object. + * + * @param string $message The message to publish. + * @param string|null $routingKey The optional routing key to which to + * publish to. + * @param integer $flags One or more of AMQP_MANDATORY and + * AMQP_IMMEDIATE. + * @param array $headers One of content_type, content_encoding, + * message_id, user_id, app_id, delivery_mode, + * priority, timestamp, expiration, type + * or reply_to, headers. + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPExchangeException On failure. + */ + public function publish( + string $message, + ?string $routingKey = null, + ?int $flags = null, + array $headers = [] + ): void { + } + + /** + * Set the value for the given key. + * + * @param string $argumentName Name of the argument to set. + * @param bool|int|double|string|null $argumentValue Value of the argument to set. + */ + public function setArgument(string $argumentName, $argumentValue): void + { + } + + /** + * Set the value for the given key. + * + * @param string $argumentName Name of the argument to remove. + */ + public function removeArgument(string $argumentName): void + { + } + + /** + * Set all arguments on the exchange. + * + * @param array $arguments An array of key/value pairs of arguments. + */ + public function setArguments(array $arguments): void + { + } + + /** + * Set the flags on an exchange. + * + * @param integer $flags A bitmask of flags. This call currently only + * considers the following flags: + * AMQP_DURABLE, AMQP_PASSIVE + * (and AMQP_DURABLE, if librabbitmq version >= 0.5.3) + */ + public function setFlags(?int $flags): void + { + } + + /** + * Set the name of the exchange. + * + * @param string|null $exchangeName The name of the exchange to set as string. + */ + public function setName(?string $exchangeName): void + { + } + + /** + * Set the type of the exchange. + * + * Set the type of the exchange. This can be any of AMQP_EX_TYPE_DIRECT, + * AMQP_EX_TYPE_FANOUT, AMQP_EX_TYPE_HEADERS or AMQP_EX_TYPE_TOPIC. + * + * @param string|null $exchangeType The type of exchange as a string. + */ + public function setType(?string $exchangeType): void + { + } + + /** + * Get the AMQPChannel object in use + */ + public function getChannel(): AMQPChannel + { + } + + /** + * Get the AMQPConnection object in use + */ + public function getConnection(): AMQPConnection + { + } +} + +/** + * stub class representing AMQPExchangeException from pecl-amqp + */ +class AMQPExchangeException extends AMQPException +{ +} + +/** + * stub class representing AMQPQueue from pecl-amqp + */ +class AMQPQueue +{ + private AMQPConnection $connection; + + private AMQPChannel $channel; + + private ?string $name = null; + + private ?string $consumerTag = null; + + private bool $passive = false; + + private bool $durable = false; + + private bool $exclusive = false; + + private bool $autoDelete = true; + + private array $arguments = []; + + /** + * Create an instance of an AMQPQueue object. + * + * @param AMQPChannel $channel The amqp channel to use. + * + * @throws AMQPQueueException When amqp_channel is not connected to a + * broker. + * @throws AMQPConnectionException If the connection to the broker was lost. + */ + public function __construct(AMQPChannel $channel) + { + } + + /** + * Acknowledge the receipt of a message. + * + * This method allows the acknowledgement of a message that is retrieved + * without the AMQP_AUTOACK flag through AMQPQueue::get() or + * AMQPQueue::consume() + * + * @param integer $deliveryTag The message delivery tag of which to + * acknowledge receipt. + * @param integer $flags The only valid flag that can be passed is + * AMQP_MULTIPLE. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function ack(int $deliveryTag, ?int $flags = null): void + { + } + + /** + * Bind the given queue to a routing key on an exchange. + * + * @param string $exchangeName Name of the exchange to bind to. + * @param string $routingKey Pattern or routing key to bind with. + * @param array $arguments Additional binding arguments. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function bind(string $exchangeName, ?string $routingKey = null, array $arguments = []): void + { + } + + /** + * Cancel a queue that is already bound to an exchange and routing key. + * + * @param string $consumerTag The consumer tag to cancel. If no tag is provided, + * or it is empty string, the latest consumer + * tag on this queue will be taken and after + * the successful cancellation request it will set to null. + * If the consumer_tag parameter is empty and the latest + * consumer tag is empty, no `basic.cancel` request will be + * sent. + * If either the consumer tag passed matches the latest tag + * or no consumer tag was passed and the latest tag was used + * the internal consumer tag will be set to null, so that + * `AMQPQueue::getConsumerTag()` will return null afterwards. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function cancel(string $consumerTag = ''): void + { + } + + /** + * Consume messages from a queue. + * + * Blocking function that will retrieve the next message from the queue as + * it becomes available and will pass it off to the callback. + * + * @param callable|null $callback A callback function to which the + * consumed message will be passed. The + * function must accept at a minimum + * one parameter, an AMQPEnvelope object, + * and an optional second parameter + * the AMQPQueue object from which callback + * was invoked. The AMQPQueue::consume() will + * not return the processing thread back to + * the PHP script until the callback + * function returns FALSE. + * If the callback is omitted or null is passed, + * then the messages delivered to this client will + * be made available to the first real callback + * registered. That allows one to have a single + * callback consuming from multiple queues. + * @param integer $flags A bitmask of any of the flags: AMQP_AUTOACK, + * AMQP_JUST_CONSUME. Note: when AMQP_JUST_CONSUME + * flag used all other flags are ignored and + * $consumerTag parameter has no sense. + * AMQP_JUST_CONSUME flag prevent from sending + * `basic.consume` request and just run $callback + * if it provided. Calling method with empty $callback + * and AMQP_JUST_CONSUME makes no sense. + * @param string|null $consumerTag A string describing this consumer. Used + * for canceling subscriptions with cancel(). + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPEnvelopeException When no queue found for envelope. + * @throws AMQPQueueException If timeout occurs or queue is not exists. + */ + public function consume(callable $callback = null, ?int $flags = null, ?string $consumerTag = null): void + { + } + + /** + * Declare a new queue on the broker. + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPQueueException On failure. + * + * @return integer the message count. + */ + public function declareQueue(): int + { + } + + /** + * Declare a new queue on the broker. + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPQueueException On failure. + * + * @return integer the message count. + */ + public function declare(): int + { + } + + /** + * Delete a queue from the broker. + * + * This includes its entire contents of unread or unacknowledged messages. + * + * @param integer $flags Optionally AMQP_IFUNUSED can be specified + * to indicate the queue should not be + * deleted until no clients are connected to + * it. + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * + * @return integer The number of deleted messages. + */ + public function delete(?int $flags = null): int + { + } + + /** + * Retrieve the next message from the queue. + * + * Retrieve the next available message from the queue. If no messages are + * present in the queue, this function will return NULL immediately. This + * is a non blocking alternative to the AMQPQueue::consume() method. + * Currently, the only supported flag for the flags parameter is + * AMQP_AUTOACK. If this flag is passed in, then the message returned will + * automatically be marked as acknowledged by the broker as soon as the + * frames are sent to the client. + * + * @param integer $flags A bitmask of supported flags for the + * method call. Currently, the only the + * supported flag is AMQP_AUTOACK. If this + * value is not provided, it will use the + * value of ini-setting amqp.auto_ack. + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPQueueException If queue is not exist. + */ + public function get(?int $flags = null): ?AMQPEnvelope + { + } + + /** + * Get all the flags currently set on the given queue. + * + * @return int An integer bitmask of all the flags currently set on this + * exchange object. + */ + public function getFlags(): int + { + } + + /** + * Get the configured name. + * + * @return string|null The configured name as a string. + */ + public function getName(): ?string + { + } + + /** + * Mark a message as explicitly not acknowledged. + * + * Mark the message identified by delivery_tag as explicitly not + * acknowledged. This method can only be called on messages that have not + * yet been acknowledged, meaning that messages retrieved with by + * AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK + * flag are not eligible. When called, the broker will immediately put the + * message back onto the queue, instead of waiting until the connection is + * closed. This method is only supported by the RabbitMQ broker. The + * behavior of calling this method while connected to any other broker is + * undefined. + * + * @param integer $deliveryTag Delivery tag of last message to reject. + * @param integer $flags AMQP_REQUEUE to requeue the message(s), + * AMQP_MULTIPLE to nack all previous + * unacked messages as well. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function nack(int $deliveryTag, ?int $flags = null): void + { + } + + /** + * Mark one message as explicitly not acknowledged. + * + * Mark the message identified by delivery_tag as explicitly not + * acknowledged. This method can only be called on messages that have not + * yet been acknowledged, meaning that messages retrieved with by + * AMQPQueue::consume() and AMQPQueue::get() and using the AMQP_AUTOACK + * flag are not eligible. + * + * @param integer $deliveryTag Delivery tag of the message to reject. + * @param integer $flags AMQP_REQUEUE to requeue the message(s). + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function reject(int $deliveryTag, ?int $flags = null): void + { + } + + /** + * Recover unacknowledged messages delivered to the current consumer. + * + * Recover all the unacknowledged messages delivered to the current consumer. + * If $requeue is true, the broker can redeliver the messages to different + * consumers. If $requeue is FALSE, it can only redeliver it to the current + * consumer. RabbitMQ does not implement $request = false. + * This method exposes `basic.recover` from the AMQP spec. + * + * @param bool $requeue If TRUE, deliver to any consumer, if FALSE, deliver to the current consumer only + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function recover(bool $requeue = true): void + { + } + + /** + * Purge the contents of a queue. + * + * Returns the number of purged messages + * + * @throws AMQPChannelException If the channel is not open. + * @throws AMQPConnectionException If the connection to the broker was lost. + */ + public function purge(): int + { + } + + /** + * Get the argument associated with the given key. + * + * @param string $argumentName The key to look up. + * @throws AMQPQueueException If key does not exist + * @return bool|int|double|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp + */ + public function getArgument(string $argumentName) + { + } + + /** + * Set a queue argument. + * + * @param string $argumentName The argument name to set. + * @param bool|int|double|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp $argumentValue The argument value to set. + */ + public function setArgument(string $argumentName, $argumentValue): void + { + } + + /** + * Set a queue argument. + * + * @param string $argumentName The argument name to set. + */ + public function removeArgument(string $argumentName): void + { + } + + /** + * Set all arguments on the given queue. + * + * All other argument settings will be wiped. + * + * @param array $arguments An array of name/value pairs of arguments. + */ + public function setArguments(array $arguments): void + { + } + + /** + * Get all set arguments as an array of key/value pairs. + * + * @return array An array containing all the set key/value pairs. + */ + public function getArguments(): array + { + } + + /** + * Check whether a queue has specific argument. + * + * @param string $argumentName The argument name to check. + * + * @return boolean + */ + public function hasArgument(string $argumentName): bool + { + } + + /** + * Set the flags on the queue. + * + * @param integer|null $flags A bitmask of flags: + * AMQP_DURABLE, AMQP_PASSIVE, + * AMQP_EXCLUSIVE, AMQP_AUTODELETE. + */ + public function setFlags(?int $flags): void + { + } + + /** + * Set the queue name. + * + * @param string $name The name of the queue. + */ + public function setName(string $name): void + { + } + + /** + * Remove a routing key binding on an exchange from the given queue. + * + * @param string $exchangeName The name of the exchange on which the queue is bound. + * @param string $routingKey The binding routing key used by the + * @param array $arguments Additional binding arguments. + * @throws AMQPConnectionException If the connection to the broker was lost. + * @throws AMQPChannelException If the channel is not open. + */ + public function unbind(string $exchangeName, ?string $routingKey = null, array $arguments = []): void + { + } + + /** + * Get the AMQPChannel object in use + */ + public function getChannel(): AMQPChannel + { + } + + /** + * Get the AMQPConnection object in use + */ + public function getConnection(): AMQPConnection + { + } + + /** + * Get latest consumer tag. If no consumer available or the latest on was canceled null will be returned. + */ + public function getConsumerTag(): ?string + { + } +} + +/** + * stub class representing AMQPQueueException from pecl-amqp + */ +class AMQPQueueException extends AMQPException +{ +} + +/** + * stub class representing AMQPTimestamp from pecl-amqp + * + * @readonly + */ +final /* readonly */ class AMQPTimestamp implements AMQPValue +{ + /** + * @var float + */ + public const MIN = 0.0; + + /** + * @var float + */ + public const MAX = 18446744073709551616; + + private float $timestamp; + + /** + * @throws AMQPValueException + */ + public function __construct(float $timestamp) + { + } + + public function __toString(): string + { + } + + public function getTimestamp(): float + { + } + + public function toAmqpValue() + { + } +} + +/** + * Interface representing AMQP values + */ +interface AMQPValue +{ + /** + * @return bool|int|double|string|null|array|AMQPValue|AMQPDecimal|AMQPTimestamp + */ + public function toAmqpValue(); +} + +/** + * stub class representing AMQPValueException from pecl-amqp + */ +class AMQPValueException extends AMQPException +{ +}