Skip to content

Commit

Permalink
Fixes for PHP 7
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 28, 2019
1 parent 32d5678 commit ed55b43
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},

"require-dev": {
"phpunit/phpunit": "~4.0"
"phpunit/phpunit": "^4.8.36|^7.5.15"
},

"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
colors="true">

<testsuites>
<testsuite>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
Expand Down
4 changes: 2 additions & 2 deletions src/TreeCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function visit(array $ast, $fnName, $expr)
$this->source = $this->indentation = '';
$this->write("<?php\n")
->write('use JmesPath\\TreeInterpreter as Ti;')
->write('use JmesPath\\FnDispatcher as Fn;')
->write('use JmesPath\\FnDispatcher as Fd;')
->write('use JmesPath\\Utils;')
->write('')
->write('function %s(Ti $interpreter, $value) {', $fnName)
Expand Down Expand Up @@ -257,7 +257,7 @@ private function visit_function(array $node)
}

return $this->write(
'$value = Fn::getInstance()->__invoke("%s", %s);',
'$value = Fd::getInstance()->__invoke("%s", %s);',
$node['value'], $args
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,6 @@ private static function sliceIndices($subject, $start, $stop, $step)
}
}

return $type == 'string' ? implode($result, '') : $result;
return $type == 'string' ? implode('', $result) : $result;
}
}
3 changes: 2 additions & 1 deletion tests/ComplianceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
use JmesPath\AstRuntime;
use JmesPath\CompilerRuntime;
use JmesPath\SyntaxErrorException;
use PHPUnit\Framework\TestCase;

class ComplianceTest extends \PHPUnit_Framework_TestCase
class ComplianceTest extends TestCase
{
private static $path;

Expand Down
3 changes: 2 additions & 1 deletion tests/EnvTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

use JmesPath\Env;
use JmesPath\CompilerRuntime;
use PHPUnit\Framework\TestCase;

class EnvTest extends \PHPUnit_Framework_TestCase
class EnvTest extends TestCase
{
public function testSearchesInput()
{
Expand Down
5 changes: 3 additions & 2 deletions tests/FnDispatcherTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
namespace JmesPath\Tests;

use JmesPath\FnDispatcher;
use JmesPath\fnDispatcher;
use PHPUnit\Framework\TestCase;

class FnDispatcherTest extends \PHPUnit_Framework_TestCase
class fnDispatcherTest extends TestCase
{
public function testConvertsToString()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/LexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

use JmesPath\Lexer;
use JmesPath\SyntaxErrorException;
use PHPUnit\Framework\TestCase;

/**
* @covers JmesPath\Lexer
*/
class LexerTest extends \PHPUnit_Framework_TestCase
class LexerTest extends TestCase
{
public function inputProvider()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

use JmesPath\Lexer;
use JmesPath\Parser;
use PHPUnit\Framework\TestCase;

/**
* @covers JmesPath\Parser
*/
class ParserTest extends \PHPUnit_Framework_TestCase
class ParserTest extends TestCase
{
/**
* @expectedException \JmesPath\SyntaxErrorException
Expand Down
3 changes: 2 additions & 1 deletion tests/SyntaxErrorExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
namespace JmesPath\Tests;

use JmesPath\SyntaxErrorException;
use PHPUnit\Framework\TestCase;

/**
* @covers JmesPath\SyntaxErrorException
*/
class SyntaxErrorExceptionTest extends \PHPUnit_Framework_TestCase
class SyntaxErrorExceptionTest extends TestCase
{
public function testCreatesWithNoArray()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/TreeCompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
namespace JmesPath\Tests\Tree;

use JmesPath\TreeCompiler;
use PHPUnit\Framework\TestCase;

/**
* @covers JmesPath\Tree\TreeCompiler
*/
class TreeCompilerTest extends \PHPUnit_Framework_TestCase
class TreeCompilerTest extends TestCase
{
public function testCreatesSourceCode()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/TreeInterpreterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

use JmesPath\AstRuntime;
use JmesPath\TreeInterpreter;
use PHPUnit\Framework\TestCase;

/**
* @covers JmesPath\Tree\TreeInterpreter
*/
class TreeInterpreterTest extends \PHPUnit_Framework_TestCase
class TreeInterpreterTest extends TestCase
{
public function testReturnsNullWhenMergingNonArray()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/UtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
namespace JmesPath\Tests;

use JmesPath\Utils;
use PHPUnit\Framework\TestCase;

class UtilsTest extends \PHPUnit_Framework_TestCase
class UtilsTest extends TestCase
{
public function typeProvider()
{
Expand Down

0 comments on commit ed55b43

Please sign in to comment.