Skip to content

Commit b7e6361

Browse files
vokunikic
authored andcommitted
updates via "rectorphp/rector" (nikic#573)
- "global" -> remove unused "use" statements - "phpunit" -> fix "@Covers" comments - "phpunit" -> replace "->will($this->returnValue()" with "->willReturn()" - "UseTest.php" -> add missing namespace - "composer.json" -> use "autoload-dev" - remove -> "require_once" usage in the tests (use autoload-dev via composer.json) -> most of the changes are done automatically by "https://github.com/rectorphp/rector"
1 parent 594bcae commit b7e6361

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+75
-148
lines changed

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
"PhpParser\\": "lib/PhpParser"
3030
}
3131
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"PhpParser\\": "test/PhpParser/"
35+
}
36+
},
3237
"bin": [
3338
"bin/php-parse"
3439
]

lib/PhpParser/BuilderFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PhpParser\Node\Identifier;
99
use PhpParser\Node\Name;
1010
use PhpParser\Node\Scalar\String_;
11-
use PhpParser\Node\Stmt;
1211
use PhpParser\Node\Stmt\Use_;
1312

1413
class BuilderFactory
@@ -77,7 +76,7 @@ public function useTrait(...$traits) : Builder\TraitUse {
7776
* @return Builder\TraitUseAdaptation The create trait use adaptation builder
7877
*/
7978
public function traitUseAdaptation($trait, $method = null) : Builder\TraitUseAdaptation {
80-
if (is_null($method)) {
79+
if ($method === null) {
8180
$method = $trait;
8281
$trait = null;
8382
}

lib/PhpParser/NodeAbstract.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace PhpParser;
44

5-
use PhpParser\Node;
6-
75
abstract class NodeAbstract implements Node, \JsonSerializable
86
{
97
protected $attributes;
@@ -159,11 +157,11 @@ public function hasAttribute(string $key) : bool {
159157
}
160158

161159
public function getAttribute(string $key, $default = null) {
162-
if (!array_key_exists($key, $this->attributes)) {
163-
return $default;
164-
} else {
160+
if (array_key_exists($key, $this->attributes)) {
165161
return $this->attributes[$key];
166162
}
163+
164+
return $default;
167165
}
168166

169167
public function getAttributes() : array {

lib/PhpParser/NodeVisitor/NameResolver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace PhpParser\NodeVisitor;
44

5-
use PhpParser\Error;
65
use PhpParser\ErrorHandler;
76
use PhpParser\NameContext;
87
use PhpParser\Node;

lib/PhpParser/PrettyPrinterAbstract.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use PhpParser\Node\Expr\AssignOp;
1010
use PhpParser\Node\Expr\BinaryOp;
1111
use PhpParser\Node\Expr\Cast;
12-
use PhpParser\Node\Name;
1312
use PhpParser\Node\Scalar;
1413
use PhpParser\Node\Stmt;
1514

test/PhpParser/Builder/ClassTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
use PhpParser\Node;
77
use PhpParser\Node\Name;
88
use PhpParser\Node\Stmt;
9-
use PHPUnit\Framework\TestCase;
109

11-
class ClassTest extends TestCase
10+
class ClassTest extends \PHPUnit\Framework\TestCase
1211
{
1312
protected function createClassBuilder($class) {
1413
return new Class_($class);

test/PhpParser/Builder/FunctionTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
use PhpParser\Node\Expr\Variable;
99
use PhpParser\Node\Scalar\String_;
1010
use PhpParser\Node\Stmt;
11-
use PHPUnit\Framework\TestCase;
1211

13-
class FunctionTest extends TestCase
12+
class FunctionTest extends \PHPUnit\Framework\TestCase
1413
{
1514
public function createFunctionBuilder($name) {
1615
return new Function_($name);

test/PhpParser/Builder/InterfaceTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
use PhpParser\Node;
77
use PhpParser\Node\Scalar\DNumber;
88
use PhpParser\Node\Stmt;
9-
use PHPUnit\Framework\TestCase;
109

11-
class InterfaceTest extends TestCase
10+
class InterfaceTest extends \PHPUnit\Framework\TestCase
1211
{
1312
/** @var Interface_ */
1413
protected $builder;

test/PhpParser/Builder/MethodTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
use PhpParser\Node\Expr\Variable;
99
use PhpParser\Node\Scalar\String_;
1010
use PhpParser\Node\Stmt;
11-
use PHPUnit\Framework\TestCase;
1211

13-
class MethodTest extends TestCase
12+
class MethodTest extends \PHPUnit\Framework\TestCase
1413
{
1514
public function createMethodBuilder($name) {
1615
return new Method($name);

test/PhpParser/Builder/NamespaceTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
use PhpParser\Comment\Doc;
66
use PhpParser\Node;
77
use PhpParser\Node\Stmt;
8-
use PHPUnit\Framework\TestCase;
98

10-
class NamespaceTest extends TestCase
9+
class NamespaceTest extends \PHPUnit\Framework\TestCase
1110
{
1211
protected function createNamespaceBuilder($fqn) {
1312
return new Namespace_($fqn);

0 commit comments

Comments
 (0)