Skip to content

Commit

Permalink
Merge pull request php-amqp#58 from lstrojny/features/deprecated-decl…
Browse files Browse the repository at this point in the history
…are-methods

Deprecate AMQPQueue::declare() and AMQPExchange::declare() methods
  • Loading branch information
lstrojny committed May 17, 2013
2 parents f818cae + b3f568f commit 4d0c078
Show file tree
Hide file tree
Showing 30 changed files with 53 additions and 53 deletions.
4 changes: 2 additions & 2 deletions amqp.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ zend_function_entry amqp_queue_class_functions[] = {
PHP_ME(amqp_queue_class, cancel, arginfo_amqp_queue_class_cancel, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, delete, arginfo_amqp_queue_class_delete, ZEND_ACC_PUBLIC)
PHP_ME(amqp_queue_class, unbind, arginfo_amqp_queue_class_unbind, ZEND_ACC_PUBLIC)
PHP_MALIAS(amqp_queue_class, declare, declareQueue, arginfo_amqp_queue_class_declareQueue, ZEND_ACC_PUBLIC)
PHP_MALIAS(amqp_queue_class, declare, declareQueue, arginfo_amqp_queue_class_declareQueue, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED)

{NULL, NULL, NULL} /* Must be the last line in amqp_functions[] */
};
Expand All @@ -517,7 +517,7 @@ zend_function_entry amqp_exchange_class_functions[] = {
PHP_ME(amqp_exchange_class, bind, arginfo_amqp_exchange_class_bind, ZEND_ACC_PUBLIC)
PHP_ME(amqp_exchange_class, delete, arginfo_amqp_exchange_class_delete, ZEND_ACC_PUBLIC)
PHP_ME(amqp_exchange_class, publish, arginfo_amqp_exchange_class_publish, ZEND_ACC_PUBLIC)
PHP_MALIAS(amqp_exchange_class, declare, declareExchange, arginfo_amqp_exchange_class_declareExchange, ZEND_ACC_PUBLIC)
PHP_MALIAS(amqp_exchange_class, declare, declareExchange, arginfo_amqp_exchange_class_declareExchange, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED)

{NULL, NULL, NULL} /* Must be the last line in amqp_functions[] */
};
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpenvelope_get_accessors.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange1');
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->declare();
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpenvelope_var_dump.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange1');
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->declare();
$q->declareQueue();
// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
// Publish a message to the exchange with a routing key
Expand Down
2 changes: 1 addition & 1 deletion tests/amqpexchange_channel_refcount.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo $ex->getName() . "\n";

$ex->setType(AMQP_EX_TYPE_FANOUT);

$ex->declare();
$ex->declareExchange();

$ex->delete();

Expand Down
2 changes: 1 addition & 1 deletion tests/amqpexchange_declare_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
echo $ex->declare() ? "true" : "false";
echo $ex->declareExchange() ? "true" : "false";
?>
--EXPECT--
true
2 changes: 1 addition & 1 deletion tests/amqpexchange_invalid_type.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $ex = new AMQPExchange($ch);
$ex->setName("exchange-" . time());
$ex->setType("invalid_exchange_type");
try {
$ex->declare();
$ex->declareExchange();
} catch (Exception $e) {
echo get_class($e);
echo PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion tests/amqpexchange_publish_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
echo $ex->publish('message', 'routing.key') ? 'true' : 'false';
$ex->delete();
?>
Expand Down
2 changes: 1 addition & 1 deletion tests/amqpexchange_publish_empty_routing_key.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
echo $ex->publish('message') ? 'true' : 'false';
$ex->delete();
?>
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_bind_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . time());
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();
$ex->declareExchange();

$queue = new AMQPQueue($ch);
$queue->setName("queue-" . time());
$queue->declare();
$queue->declareQueue();
var_dump($queue->bind($ex->getName(), 'routing.key'));

$queue->delete();
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_bind_basic_empty_routing_key.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . time());
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();
$ex->declareExchange();

$queue = new AMQPQueue($ch);
$queue->setName("queue-" . time());
$queue->declare();
$queue->declareQueue();
var_dump($queue->bind($ex->getName()));

$queue->delete();
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_cancel.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ function create_exchange($channel) {
$exchange = new AMQPExchange($channel);
$exchange->setName('test_cancel_exchange');
$exchange->setType(AMQP_EX_TYPE_DIRECT);
$exchange->declare();
$exchange->declareExchange();
return $exchange;
}

function create_queue($channel) {
$queue = new AMQPQueue($channel);
$queue->setName('test_cancel_queue');
$queue->setFlags(AMQP_NOPARAM);
$queue->declare();
$queue->declareQueue();
$queue->bind('test_cancel_exchange', 'test_cancel_routing_key');
return $queue;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_consume_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();

// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue-' . time());
$q->declare();
$q->declareQueue();

// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
Expand Down
2 changes: 1 addition & 1 deletion tests/amqpqueue_consume_timeout.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $conn->connect();
$chan = new AMQPChannel($conn);
$queue = new AMQPQueue($chan);
$queue->setFlags(AMQP_EXCLUSIVE);
$queue->declare();
$queue->declareQueue();
$start = microtime(true);
try {
$queue->consume('nop');
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_declare_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . time());
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();
$ex->declareExchange();

$queue = new AMQPQueue($ch);
$queue->setName("queue-" . time());
$queue->declare();
$queue->declareQueue();
var_dump($queue->bind($ex->getName(), 'routing.key'));

$queue->delete();
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_empty_name.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . time());
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();
$ex->declareExchange();

$queue = new AMQPQueue($ch);
$queue->declare();
$queue->declareQueue();
var_dump(substr($queue->getName(), 0, strlen('amq.gen-')));

$queue->delete();
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_get_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange1');
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();

// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->declare();
$q->declareQueue();

// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_get_empty_body.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();

// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->declare();
$q->declareQueue();

// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_get_headers.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();

// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->declare();
$q->declareQueue();

// Bind it on the exchange to routing.key
$q->bind($ex->getName(), 'routing.*');
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_nack.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('testnack' . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
$exchangeName = $ex->getName();

// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('testnack' . time());
$q->declare();
$q->declareQueue();
$q->bind($exchangeName, '#');

// Bind it on the exchange to routing.key
Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_nested_arrays.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . time());
$ex->setType(AMQP_EX_TYPE_TOPIC);
$ex->declare();
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->declare();
$q->declareQueue();
$q->bind($ex->getName(), '#');


Expand Down
8 changes: 4 additions & 4 deletions tests/amqpqueue_nested_headers.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ $ch = new AMQPChannel($cnn);
$errorXchange = new AMQPExchange($ch);
$errorXchange->setName('errorXchange' . time());
$errorXchange->setType(AMQP_EX_TYPE_TOPIC);
$errorXchange->declare();
$errorXchange->declareExchange();

$errorQ = new AMQPQueue($ch);
$errorQ->setName('errorQueue' . time());
$errorQ->declare();
$errorQ->declareQueue();
$errorQ->bind($errorXchange->getName(), '#');


// Declare a new exchange and queue using this dead-letter-exchange:
$ex = new AMQPExchange($ch);
$ex->setName('exchange' . time());
$ex->setType(AMQP_EX_TYPE_TOPIC);
$ex->declare();
$ex->declareExchange();
$q = new AMQPQueue($ch);
$q->setName('queue1' . time());
$q->setArgument('x-dead-letter-exchange', $errorXchange->getName());
$q->declare();
$q->declareQueue();
$q->bind($ex->getName(), '#');


Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_unbind_basic_empty_routing_key.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange-' . time());
$ex->setType(AMQP_EX_TYPE_DIRECT);
$ex->declare();
$ex->declareExchange();

$queue = new AMQPQueue($ch);
$queue->setName("queue-" . time());
$queue->declare();
$queue->declareQueue();
var_dump($queue->bind($ex->getName()));
var_dump($queue->unbind($ex->getName()));

Expand Down
4 changes: 2 additions & 2 deletions tests/amqpqueue_var_dump.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName('exchange1');
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
// Create a new queue
$q = new AMQPQueue($ch);
$q->setName('queue_var_dump');
$q->declare();
$q->declareQueue();
var_dump($q);
?>
--EXPECT--
Expand Down
2 changes: 1 addition & 1 deletion tests/bug_17831.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $ch = new AMQPChannel($c);
$ex = new AMQPExchange($ch);
$ex->setName("exchange-" . time());
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();
try {
$ex->publish("data", "bar");
echo "Success\n";
Expand Down
4 changes: 2 additions & 2 deletions tests/bug_19707.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ $ch = new AMQPChannel($cnn);
$ex = new AMQPExchange($ch);
$ex->setName("exchange_testing_19707");
$ex->setType(AMQP_EX_TYPE_FANOUT);
$ex->declare();
$ex->declareExchange();

$q = new AMQPQueue($ch);
$q->setName('queue' . time());
$q->setFlags(AMQP_DURABLE);
$q->declare();
$q->declareQueue();

$q->bind($ex->getName(), 'routing.key');

Expand Down
2 changes: 1 addition & 1 deletion tests/bug_gh50-1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for ($i = 0; $i < 3; $i++) {
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);

$queue->declare();
$queue->declareQueue();
$queue->delete();
}
?>
Expand Down
2 changes: 1 addition & 1 deletion tests/bug_gh50-2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for ($i = 0; $i < 3; $i++) {
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);

$queue->declare();
$queue->declareQueue();
$queue->delete();

unset($queue);
Expand Down
4 changes: 2 additions & 2 deletions tests/bug_gh50-3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for ($i = 0; $i < 3; $i++) {
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);

$queue->declare();
$queue->declareQueue();
$queue->delete();
}

Expand All @@ -30,7 +30,7 @@ for ($i = 0; $i < 3; $i++) {
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);

$queue->declare();
$queue->declareQueue();
$queue->delete();
}

Expand Down
4 changes: 2 additions & 2 deletions tests/bug_gh50-4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ for ($i = 0; $i < 3; $i++) {
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);

$queue->declare();
$queue->declareQueue();
$queue->delete();
}

Expand All @@ -32,7 +32,7 @@ for ($i = 0; $i < 3; $i++) {
$queue = new AMQPQueue($channel);
$queue->setName('test' . $i);

$queue->declare();
$queue->declareQueue();
$queue->delete();
}

Expand Down
Loading

0 comments on commit 4d0c078

Please sign in to comment.