Skip to content

Commit e56b169

Browse files
Merge pull request #49 from GrahamCampbell/patch-1
Added PHP 7 Support
2 parents adcc953 + 7f3c440 commit e56b169

14 files changed

+46
-23
lines changed

.travis.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
language: php
22

3-
php:
4-
- 5.4
5-
- 5.5
6-
- 5.6
7-
- hhvm
3+
matrix:
4+
include:
5+
- php: 5.4
6+
dist: trusty
7+
- php: 5.5
8+
dist: trusty
9+
- php: 5.6
10+
dist: trusty
11+
- php: 7.0
12+
dist: trusty
13+
- php: 7.1
14+
dist: bionic
15+
- php: 7.2
16+
dist: bionic
17+
- php: 7.3
18+
dist: bionic
19+
- php: 7.4
20+
dist: bionic
21+
- php: hhvm-3.18
22+
dist: trusty
823

9-
before_script:
10-
- composer install
24+
install: travis_retry composer install
1125

1226
script: make test
1327

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818

1919
"require-dev": {
20-
"phpunit/phpunit": "~4.0"
20+
"phpunit/phpunit": "^4.8.36|^7.5.15"
2121
},
2222

2323
"autoload": {
@@ -31,7 +31,7 @@
3131

3232
"extra": {
3333
"branch-alias": {
34-
"dev-master": "2.0-dev"
34+
"dev-master": "2.5-dev"
3535
}
3636
}
3737
}

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
colors="true">
44

55
<testsuites>
6-
<testsuite>
6+
<testsuite name="Unit Tests">
77
<directory>tests</directory>
88
</testsuite>
99
</testsuites>

src/TreeCompiler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function visit(array $ast, $fnName, $expr)
2323
$this->source = $this->indentation = '';
2424
$this->write("<?php\n")
2525
->write('use JmesPath\\TreeInterpreter as Ti;')
26-
->write('use JmesPath\\FnDispatcher as Fn;')
26+
->write('use JmesPath\\FnDispatcher as Fd;')
2727
->write('use JmesPath\\Utils;')
2828
->write('')
2929
->write('function %s(Ti $interpreter, $value) {', $fnName)
@@ -257,7 +257,7 @@ private function visit_function(array $node)
257257
}
258258

259259
return $this->write(
260-
'$value = Fn::getInstance()->__invoke("%s", %s);',
260+
'$value = Fd::getInstance()->__invoke("%s", %s);',
261261
$node['value'], $args
262262
);
263263
}

src/Utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,6 @@ private static function sliceIndices($subject, $start, $stop, $step)
224224
}
225225
}
226226

227-
return $type == 'string' ? implode($result, '') : $result;
227+
return $type == 'string' ? implode('', $result) : $result;
228228
}
229229
}

tests/ComplianceTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
use JmesPath\AstRuntime;
55
use JmesPath\CompilerRuntime;
66
use JmesPath\SyntaxErrorException;
7+
use PHPUnit\Framework\TestCase;
78

8-
class ComplianceTest extends \PHPUnit_Framework_TestCase
9+
class ComplianceTest extends TestCase
910
{
1011
private static $path;
1112

tests/EnvTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
use JmesPath\Env;
55
use JmesPath\CompilerRuntime;
6+
use PHPUnit\Framework\TestCase;
67

7-
class EnvTest extends \PHPUnit_Framework_TestCase
8+
class EnvTest extends TestCase
89
{
910
public function testSearchesInput()
1011
{

tests/FnDispatcherTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?php
22
namespace JmesPath\Tests;
33

4-
use JmesPath\FnDispatcher;
4+
use JmesPath\fnDispatcher;
5+
use PHPUnit\Framework\TestCase;
56

6-
class FnDispatcherTest extends \PHPUnit_Framework_TestCase
7+
class fnDispatcherTest extends TestCase
78
{
89
public function testConvertsToString()
910
{

tests/LexerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
use JmesPath\Lexer;
55
use JmesPath\SyntaxErrorException;
6+
use PHPUnit\Framework\TestCase;
67

78
/**
89
* @covers JmesPath\Lexer
910
*/
10-
class LexerTest extends \PHPUnit_Framework_TestCase
11+
class LexerTest extends TestCase
1112
{
1213
public function inputProvider()
1314
{

tests/ParserTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
use JmesPath\Lexer;
55
use JmesPath\Parser;
6+
use PHPUnit\Framework\TestCase;
67

78
/**
89
* @covers JmesPath\Parser
910
*/
10-
class ParserTest extends \PHPUnit_Framework_TestCase
11+
class ParserTest extends TestCase
1112
{
1213
/**
1314
* @expectedException \JmesPath\SyntaxErrorException

0 commit comments

Comments
 (0)