/** * will this string co-erce to any numeric types? * * @param string $item * the item to examine * @return string[] */ private static function detectNumbers($item) { // what do we think this might be? $retval = GetNumericType::from($item); // special case - return an empty list if the string // isn't numeric at all if ($retval === null) { return []; } // if we get here, then $item will coerce to a PHP numeric type :) return [$retval => $retval, 'numeric' => 'numeric']; }
/** * do we have a numeric type? if so, what is it? * * @param mixed $item * the item to examine * @return string|null * the numeric type, or null if it is not numeric */ function get_numeric_type($item) { return GetNumericType::from($item); }
/** * @covers ::from * @dataProvider provideDataToTest */ public function testCanCallStatically($data, $expectedTypes) { // ---------------------------------------------------------------- // setup your test // ---------------------------------------------------------------- // perform the change $actualTypes = GetNumericType::from($data); // ---------------------------------------------------------------- // test the results $this->assertEquals($expectedTypes, $actualTypes); }