1--TEST-- 2Incrementing objects which are castable to numeric types 3--EXTENSIONS-- 4zend_test 5--FILE-- 6<?php 7 8$l = new LongCastableNoOperations(5); 9$f = new FloatCastableNoOperations(15.8); 10$nl = new NumericCastableNoOperations(52); 11$nf = new NumericCastableNoOperations(58.3); 12 13/* Check normal arithmetic */ 14try { 15 var_dump($l + 1); 16} catch (\TypeError $e) { 17 echo $e->getMessage(), PHP_EOL; 18} 19 20try { 21 var_dump($f + 1); 22} catch (\TypeError $e) { 23 echo $e->getMessage(), PHP_EOL; 24} 25 26try { 27 var_dump($nl + 1); 28} catch (\TypeError $e) { 29 echo $e->getMessage(), PHP_EOL; 30} 31 32try { 33 var_dump($nf + 1); 34} catch (\TypeError $e) { 35 echo $e->getMessage(), PHP_EOL; 36} 37 38/* Decrement */ 39try { 40 $l++; 41 var_dump($l); 42} catch (\TypeError $e) { 43 echo $e->getMessage(), PHP_EOL; 44} 45 46try { 47 $f++; 48 var_dump($f); 49} catch (\TypeError $e) { 50 echo $e->getMessage(), PHP_EOL; 51} 52 53try { 54 $nl++; 55 var_dump($nl); 56} catch (\TypeError $e) { 57 echo $e->getMessage(), PHP_EOL; 58} 59 60try { 61 $nf++; 62 var_dump($nf); 63} catch (\TypeError $e) { 64 echo $e->getMessage(), PHP_EOL; 65} 66 67?> 68--EXPECT-- 69Unsupported operand types: LongCastableNoOperations + int 70Unsupported operand types: FloatCastableNoOperations + int 71int(53) 72float(59.3) 73Cannot increment LongCastableNoOperations 74Cannot increment FloatCastableNoOperations 75int(53) 76float(59.3) 77