Skip to content

Commit c700f4a

Browse files
author
Andy Vaughn
committed
add namespace compatibility layer
1 parent 6d799b7 commit c700f4a

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

compatibility/MutableXArray.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types=1);
2+
/**
3+
* XArray
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
namespace MindTouch\XArray;
18+
19+
class MutableXArray extends \modethirteen\XArray\MutableXArray {
20+
}

compatibility/XArray.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types=1);
2+
/**
3+
* XArray
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
namespace MindTouch\XArray;
18+
19+
class XArray extends \modethirteen\XArray\XArray {
20+
}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
},
2424
"autoload": {
2525
"psr-4": {
26-
"modethirteen\\XArray\\": ["src/"]
26+
"modethirteen\\XArray\\": ["src/"],
27+
"MindTouch\\XArray\\": ["compatibility/"]
2728
}
2829
},
2930
"autoload-dev": {

tests/MutableXArray/__ctor_Test.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,19 @@ public function Constructor_holds_reference_to_source_array() {
3636
// assert
3737
$this->assertSame($source, $x->toArray());
3838
}
39+
40+
/**
41+
* @test
42+
*/
43+
public function Can_construct_compatibility_class() {
44+
45+
// arrange
46+
$source = ['foo' => 'bar'];
47+
48+
// act
49+
$x = new \MindTouch\XArray\MutableXArray($source);
50+
51+
// assert
52+
$this->assertTrue(is_subclass_of($x, MutableXArray::class));
53+
}
3954
}

tests/XArray/__ctor_Test.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,16 @@ public function Constructor_does_not_hold_reference_to_source_array() {
3636
// assert
3737
$this->assertNotSame($source, $x->toArray());
3838
}
39+
40+
/**
41+
* @test
42+
*/
43+
public function Can_construct_compatibility_class() {
44+
45+
// act
46+
$x = new \MindTouch\XArray\XArray();
47+
48+
// assert
49+
$this->assertTrue(is_subclass_of($x, XArray::class));
50+
}
3951
}

0 commit comments

Comments
 (0)