Skip to content

Commit 287ad01

Browse files
authored
Merge pull request #10 from carlosV2/master
Support PHP 5.3
2 parents 9f07544 + eec73ec commit 287ad01

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
language: php
22

3-
php: [5.4, 5.5, 5.6, 7.0, 7.1, hhvm]
3+
php: [5.3, 5.4, 5.5, 5.6, 7.0, 7.1, hhvm]
44

55
branches:
66
except:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">5.4,<7.2"
16+
"php": ">5.3,<7.2"
1717
},
1818

1919
"require-dev": {

src/CallbackObjectIdentifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ final class CallbackObjectIdentifier implements ObjectIdentifier
66
{
77
private $callable;
88

9-
public function __construct(callable $callable)
9+
public function __construct($callable)
1010
{
1111
$this->callable = $callable;
1212
}

src/FileRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getAll()
4949

5050
public function clear()
5151
{
52-
$this->saveDb([]);
52+
$this->saveDb(array());
5353
}
5454

5555
private function getIdentity($object)
@@ -67,7 +67,7 @@ private function loadDb()
6767
if (null === $this->cache) {
6868
$this->cache = file_exists($this->filename)
6969
? unserialize(file_get_contents($this->filename))
70-
: [];
70+
: array();
7171
}
7272

7373
return $this->cache;

src/InMemoryRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
final class InMemoryRepository implements Repository
66
{
77
private $identifier;
8-
private $storage = [];
8+
private $storage = array();
99

1010
public function __construct(ObjectIdentifier $identifier)
1111
{
@@ -42,7 +42,7 @@ public function getAll()
4242

4343
public function clear()
4444
{
45-
$this->storage = [];
45+
$this->storage = array();
4646
}
4747

4848
private function getIdentity($object)

tests/FileRepositoryTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ protected function tearDown()
3838

3939
/** @test */ function shouldOverrideObjectsWithTheSameId()
4040
{
41-
$objectsToPersist = [
41+
$objectsToPersist = array(
4242
new PersistedObject($objectId = 42, 'everzet'),
4343
new PersistedObject($objectId, 'marcello')
44-
];
44+
);
4545
$repository = $this->createRepository();
4646

4747
$repository->save($objectsToPersist[0]);
@@ -53,7 +53,7 @@ protected function tearDown()
5353
/** @test @expectedException Exception */
5454
function shouldThrowAnExceptionIfUnexpectedObjectGiven()
5555
{
56-
$objectToPersist = (object)[];
56+
$objectToPersist = (object) array();
5757
$repository = $this->createRepository();
5858

5959
$repository->save($objectToPersist);
@@ -77,15 +77,15 @@ function shouldThrowAnExceptionIfUnexpectedObjectGiven()
7777

7878
$repository->remove($objectToPersist);
7979

80-
$this->assertEquals([], $repository->getAll());
80+
$this->assertEquals(array(), $repository->getAll());
8181
}
8282

8383
/** @test */ function shouldBeAbleToGetAllObjects()
8484
{
85-
$objectsToPersist = [
85+
$objectsToPersist = array(
8686
new PersistedObject(42, 'everzet'),
8787
new PersistedObject(24, 'marcello')
88-
];
88+
);
8989
$repository = $this->createRepository();
9090

9191
$repository->save($objectsToPersist[0]);
@@ -98,10 +98,10 @@ function shouldThrowAnExceptionIfUnexpectedObjectGiven()
9898

9999
/** @test */ function shouldPersistObjectsBetweenInstances()
100100
{
101-
$objectsToPersist = [
101+
$objectsToPersist = array(
102102
new PersistedObject(42, 'everzet'),
103103
new PersistedObject(24, 'marcello')
104-
];
104+
);
105105
$repository = $this->createRepository();
106106
$newRepository = $this->createRepository();
107107

@@ -113,18 +113,18 @@ function shouldThrowAnExceptionIfUnexpectedObjectGiven()
113113

114114
/** @test */ function shouldBeAbleToClearRepository()
115115
{
116-
$objectsToPersist = [
116+
$objectsToPersist = array(
117117
new PersistedObject(42, 'everzet'),
118118
new PersistedObject(24, 'marcello')
119-
];
119+
);
120120
$repository = $this->createRepository();
121121
$newRepository = $this->createRepository();
122122

123123
$repository->save($objectsToPersist[0]);
124124
$repository->save($objectsToPersist[1]);
125125
$repository->clear();
126126

127-
$this->assertEquals([], $repository->getAll());
127+
$this->assertEquals(array(), $repository->getAll());
128128
$this->assertEquals($newRepository->getAll(), $repository->getAll());
129129
}
130130

tests/InMemoryRepositoryTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ class InMemoryRepositoryTest extends PHPUnit_Framework_TestCase
2727

2828
/** @test */ function shouldOverrideObjectsWithTheSameId()
2929
{
30-
$objectsToPersist = [
30+
$objectsToPersist = array(
3131
new InMemoryObject($objectId = 42, 'everzet'),
3232
new InMemoryObject($objectId, 'marcello')
33-
];
33+
);
3434
$repository = $this->createRepository();
3535

3636
$repository->save($objectsToPersist[0]);
@@ -57,15 +57,15 @@ class InMemoryRepositoryTest extends PHPUnit_Framework_TestCase
5757

5858
$repository->remove($objectToPersist);
5959

60-
$this->assertEquals([], $repository->getAll());
60+
$this->assertEquals(array(), $repository->getAll());
6161
}
6262

6363
/** @test */ function shouldBeAbleToGetAllObjects()
6464
{
65-
$objectsToPersist = [
65+
$objectsToPersist = array(
6666
new InMemoryObject(42, 'everzet'),
6767
new InMemoryObject(24, 'marcello')
68-
];
68+
);
6969
$repository = $this->createRepository();
7070

7171
$repository->save($objectsToPersist[0]);
@@ -76,17 +76,17 @@ class InMemoryRepositoryTest extends PHPUnit_Framework_TestCase
7676

7777
/** @test */ function shouldBeAbleToClearRepository()
7878
{
79-
$objectsToPersist = [
79+
$objectsToPersist = array(
8080
new InMemoryObject(42, 'everzet'),
8181
new InMemoryObject(24, 'marcello')
82-
];
82+
);
8383
$repository = $this->createRepository();
8484

8585
$repository->save($objectsToPersist[0]);
8686
$repository->save($objectsToPersist[1]);
8787
$repository->clear();
8888

89-
$this->assertEquals([], $repository->getAll());
89+
$this->assertEquals(array(), $repository->getAll());
9090
}
9191

9292
private function createRepository()

0 commit comments

Comments
 (0)