Skip to content

Commit d60cbb9

Browse files
author
Bartosz Kubicki
committed
Fix for numeric argument conversion
1 parent 04b376d commit d60cbb9

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/internal/Magento/Framework/Amqp/Topology/ArgumentProcessor.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<?php
2+
3+
declare(strict_types=1);
4+
25
/**
36
* Copyright © Magento, Inc. All rights reserved.
47
* See COPYING.txt for license details.
58
*/
69
namespace Magento\Framework\Amqp\Topology;
710

11+
use InvalidArgumentException;
12+
813
/**
914
* @deprecated 100.0.0
1015
* see: https://github.com/php-amqplib/php-amqplib/issues/405
@@ -17,22 +22,23 @@ trait ArgumentProcessor
1722
* @param array $arguments
1823
* @return array
1924
*/
20-
public function processArguments($arguments)
25+
public function processArguments($arguments): array
2126
{
2227
$output = [];
2328
foreach ($arguments as $key => $value) {
2429
if (is_array($value)) {
2530
$output[$key] = ['A', $value];
26-
} elseif (is_int($value)) {
27-
$output[$key] = ['I', $value];
31+
} elseif (is_numeric($value)) {
32+
$output[$key] = ['I', (int) $value];
2833
} elseif (is_bool($value)) {
2934
$output[$key] = ['t', $value];
3035
} elseif (is_string($value)) {
3136
$output[$key] = ['S', $value];
3237
} else {
33-
throw new \InvalidArgumentException('Unknown argument type ' . gettype($value));
38+
throw new InvalidArgumentException('Unknown argument type ' . gettype($value));
3439
}
3540
}
41+
3642
return $output;
3743
}
3844
}

0 commit comments

Comments
 (0)