Skip to content

Commit e810904

Browse files
committed
removed code for PHP < 5.3.9
1 parent 95a248f commit e810904

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

Extension/Core/DataTransformer/DateTimeToStringTransformer.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,13 @@ class DateTimeToStringTransformer extends BaseDateTimeTransformer
6161
*
6262
* @throws UnexpectedTypeException if a timezone is not a string
6363
*/
64-
public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = null)
64+
public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = true)
6565
{
6666
parent::__construct($inputTimezone, $outputTimezone);
6767

6868
$this->generateFormat = $this->parseFormat = $format;
6969

70-
// The pipe in the parser pattern only works as of PHP 5.3.7
71-
// See http://bugs.php.net/54316
72-
$this->parseUsingPipe = null === $parseUsingPipe
73-
? PHP_VERSION_ID >= 50307
74-
: $parseUsingPipe;
70+
$this->parseUsingPipe = $parseUsingPipe || null === $parseUsingPipe;
7571

7672
// See http://php.net/manual/en/datetime.createfromformat.php
7773
// The character "|" in the format makes sure that the parts of a date

Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ public function dataProvider()
5757

5858
// seconds since Unix
5959
array('U', '1265213106', '2010-02-03 16:05:06 UTC'),
60-
);
6160

62-
// This test will fail < 5.3.9 - see https://bugs.php.net/51994
63-
if (PHP_VERSION_ID >= 50309) {
64-
$data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC');
65-
}
61+
array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC'),
62+
);
6663

6764
return $data;
6865
}
@@ -111,10 +108,6 @@ public function testTransformExpectsDateTime()
111108
*/
112109
public function testReverseTransformUsingPipe($format, $input, $output)
113110
{
114-
if (PHP_VERSION_ID < 50307) {
115-
$this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
116-
}
117-
118111
$reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true);
119112

120113
$output = new \DateTime($output);

0 commit comments

Comments
 (0)