From a60aae47a40649abea2eb29b52d93a9782af9c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Bl=C3=A4ul?= Date: Tue, 20 Feb 2018 22:16:49 +0100 Subject: [PATCH] getDatatypes: Documented the need for PHP 5.5 or higher --- src/extensions/DatatypeTrait.php | 2 ++ tests/methods/ParseTest.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/extensions/DatatypeTrait.php b/src/extensions/DatatypeTrait.php index 9323a2f..ce380c9 100644 --- a/src/extensions/DatatypeTrait.php +++ b/src/extensions/DatatypeTrait.php @@ -43,6 +43,8 @@ trait DatatypeTrait { * Check data type foreach Column * Check data type for each column and returns the most commonly. * + * Requires PHP >= 5.5 + * * @access public * * @uses getDatatypeFromString diff --git a/tests/methods/ParseTest.php b/tests/methods/ParseTest.php index 07eb3b7..d48435f 100644 --- a/tests/methods/ParseTest.php +++ b/tests/methods/ParseTest.php @@ -137,6 +137,12 @@ class ParseTest extends TestCase * @depends testSepRowAutoDetection */ public function testGetColumnDatatypes() { + if (!function_exists('array_column')) { + // getDatatypes requires array_column, but that + // function is only available in PHP >= 5.5 + return; + } + $this->csv->auto(__DIR__ . '/fixtures/datatype.csv'); $this->csv->getDatatypes(); $expected = [