1--TEST--
2BcMath\Number calc methods (add, sub, mul, div, mod, pow) scale arg error
3--EXTENSIONS--
4bcmath
5--FILE--
6<?php
7$args = [
8    [[], 'array'],
9    [new stdClass(), 'other object'],
10    [0.1, 'float'],
11];
12
13$methods = [
14    'add',
15    'sub',
16    'mul',
17    'div',
18    'mod',
19    'pow',
20];
21
22$num = new BcMath\Number('100.0000');
23foreach ($methods as $method) {
24    echo "========== {$method} ==========\n";
25    foreach ($args as [$val, $type]) {
26        echo "{$type}:\n";
27        try {
28            $num->$method(1, $val);
29        } catch (Error $e) {
30            echo $e->getMessage() . "\n";
31        }
32    }
33    echo "\n";
34}
35?>
36--EXPECTF--
37========== add ==========
38array:
39BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, array given
40other object:
41BcMath\Number::add(): Argument #2 ($scale) must be of type ?int, stdClass given
42float:
43
44Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
45
46========== sub ==========
47array:
48BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, array given
49other object:
50BcMath\Number::sub(): Argument #2 ($scale) must be of type ?int, stdClass given
51float:
52
53Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
54
55========== mul ==========
56array:
57BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, array given
58other object:
59BcMath\Number::mul(): Argument #2 ($scale) must be of type ?int, stdClass given
60float:
61
62Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
63
64========== div ==========
65array:
66BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, array given
67other object:
68BcMath\Number::div(): Argument #2 ($scale) must be of type ?int, stdClass given
69float:
70
71Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
72
73========== mod ==========
74array:
75BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, array given
76other object:
77BcMath\Number::mod(): Argument #2 ($scale) must be of type ?int, stdClass given
78float:
79
80Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
81
82========== pow ==========
83array:
84BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, array given
85other object:
86BcMath\Number::pow(): Argument #2 ($scale) must be of type ?int, stdClass given
87float:
88
89Deprecated: Implicit conversion from float 0.1 to int loses precision in %s
90