Skip to content

Commit 883cbd9

Browse files
committed
Merge pull request #8 from mkusher/scrutinizer-patch-1
Scrutinizer Auto-Fixes
2 parents 44e939b + 2ac822b commit 883cbd9

59 files changed

Lines changed: 517 additions & 499 deletions

Some content is hidden

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

peridot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
use Evenement\EventEmitterInterface;
33
use Peridot\Plugin\Prophecy\ProphecyPlugin;
44

5-
return function (EventEmitterInterface $emitter) {
5+
return function(EventEmitterInterface $emitter) {
66
new ProphecyPlugin($emitter);
77
};

specs/application/http/router.spec.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
use Command\ErrorCommand;
66
use Application\HTTP\Router;
77

8-
describe('Router', function () {
9-
beforeEach(function () {
8+
describe('Router', function() {
9+
beforeEach(function() {
1010
$this->router = new Router;
1111
});
12-
describe('->getCommand()', function () {
13-
it('should return GenerateCommand when generate name is passed', function () {
12+
describe('->getCommand()', function() {
13+
it('should return GenerateCommand when generate name is passed', function() {
1414
expect($this->router->getCommand('generate'))
1515
->to->be->an->instanceof(GenerateCommand::class);
1616
});
17-
it('should return CompleteCommand when complete name is passed', function () {
17+
it('should return CompleteCommand when complete name is passed', function() {
1818
expect($this->router->getCommand('complete'))
1919
->to->be->an->instanceof(CompleteCommand::class);
2020
});
21-
it('should return ErrorCommand when unknown name is passed', function () {
21+
it('should return ErrorCommand when unknown name is passed', function() {
2222
expect($this->router->getCommand('someUknownName'))
2323
->to->be->an->instanceof(ErrorCommand::class);
2424
});

specs/completer/resolver/ContextResolver.spec.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
use Monolog\Handler\NullHandler;
1212
use Symfony\Component\EventDispatcher\EventDispatcher;
1313

14-
describe('ContextResolver', function(){
15-
beforeEach(function(){
14+
describe('ContextResolver', function() {
15+
beforeEach(function() {
1616
$logger = new Logger('spec');
1717
$logger->pushHandler(new NullHandler);
1818
$this->index = new Index;
@@ -21,84 +21,84 @@
2121
$this->resolver = new ContextResolver($this->parser, $this->typeResolver, $logger);
2222
$this->dummyLine = '$obj->getMethod()->';
2323
});
24-
describe('->getContext()', function(){
25-
it('throws exception on empty line', function(){
24+
describe('->getContext()', function() {
25+
it('throws exception on empty line', function() {
2626
expect([$this->resolver, 'getContext'])
2727
->with('', $this->index)->to->throw('Exception');
2828
});
29-
it('returns Context instance', function(){
29+
it('returns Context instance', function() {
3030
$result = $this->resolver->getContext($this->dummyLine);
3131
expect($result)->to->be->an->instanceof(Context::class);
3232
});
33-
describe('Namespace', function(){
34-
it('has type namespace after namespace symbol', function(){
33+
describe('Namespace', function() {
34+
it('has type namespace after namespace symbol', function() {
3535
$context = $this->resolver->getContext('namespace ');
3636
expect($context->isNamespace())->to->be->true;
3737
});
38-
it('has type namespace after namespace symbol with TString', function(){
38+
it('has type namespace after namespace symbol with TString', function() {
3939
$context = $this->resolver->getContext('namespace SomeName');
4040
expect($context->isNamespace())->to->be->true;
4141
});
42-
it('has type namespace after namespace symbol with TString and separator', function(){
42+
it('has type namespace after namespace symbol with TString and separator', function() {
4343
$context = $this->resolver->getContext('namespace SomeName\AndOther\Name');
4444
expect($context->isNamespace())->to->be->true;
4545
});
46-
it('hasn\'t type namespace after ;', function(){
46+
it('hasn\'t type namespace after ;', function() {
4747
$context = $this->resolver->getContext('namespace SomeName\AndOther\Name;');
4848
expect($context->isNamespace())->to->be->false;
4949
});
5050
});
51-
describe('Use', function(){
52-
it('has type use after use symbol', function(){
51+
describe('Use', function() {
52+
it('has type use after use symbol', function() {
5353
$context = $this->resolver->getContext('use ');
5454
expect($context->isUse())->to->be->true;
5555
});
56-
it('has type use after use symbol with TString', function(){
56+
it('has type use after use symbol with TString', function() {
5757
$context = $this->resolver->getContext('use SomeName');
5858
expect($context->isUse())->to->be->true;
5959
});
60-
it('has type use after use symbol with TString and separator', function(){
60+
it('has type use after use symbol with TString and separator', function() {
6161
$context = $this->resolver->getContext('use SomeName\AndOther\Name');
6262
expect($context->isUse())->to->be->true;
6363
});
64-
it('hasn\'t type use after ;', function(){
64+
it('hasn\'t type use after ;', function() {
6565
$context = $this->resolver->getContext('use SomeName\AndOther\Name;');
6666
expect($context->isUse())->to->be->false;
6767
});
6868
});
69-
describe('Object', function(){
70-
it('has type object after object operator', function(){
69+
describe('Object', function() {
70+
it('has type object after object operator', function() {
7171
$context = $this->resolver->getContext('$var->');
7272
expect($context->isObject())->to->be->true;
7373
});
74-
it('has type object after object operator and $this', function(){
74+
it('has type object after object operator and $this', function() {
7575
$context = $this->resolver->getContext('$this->');
7676
expect($context->isObject())->to->be->true;
7777
});
78-
it('has type object after object operator with complex prefix', function(){
78+
it('has type object after object operator with complex prefix', function() {
7979
$context = $this->resolver->getContext('$var->getMethod()->param->');
8080
expect($context->isObject())->to->be->true;
8181
});
82-
it('has type object after object operator with TString', function(){
82+
it('has type object after object operator with TString', function() {
8383
$context = $this->resolver->getContext('$var->param');
8484
expect($context->isObject())->to->be->true;
8585
});
86-
it('hasn\'t type object after object operator with TString and separator', function(){
86+
it('hasn\'t type object after object operator with TString and separator', function() {
8787
$context = $this->resolver->getContext('$var->param;');
8888
expect($context->isObject())->to->be->false;
8989
});
90-
it('hasn\'t type object after object operator with (', function(){
90+
it('hasn\'t type object after object operator with (', function() {
9191
$context = $this->resolver->getContext('$var->param(');
9292
expect($context->isObject())->to->be->false;
9393
});
94-
it('hasn\'t type object after object operator with TString and space', function(){
94+
it('hasn\'t type object after object operator with TString and space', function() {
9595
/** @var Context $context */
9696
$context = $this->resolver->getContext('$var->param ');
9797
expect($context->isObject())->to->be->false;
9898
});
9999
});
100-
describe("Method call", function () {
101-
it('has type method call after (', function () {
100+
describe("Method call", function() {
101+
it('has type method call after (', function() {
102102
$context = $this->resolver->getContext('$var->method(');
103103
expect($context->isMethodCall())->to->be->true;
104104
});

specs/completer/resolver/NodeTypeResolver.spec.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Monolog\Handler\NullHandler;
1717
use Symfony\Component\EventDispatcher\EventDispatcher;
1818

19-
function createClass($classFQN, $fqcn){
19+
function createClass($classFQN, $fqcn) {
2020
$class = new ClassData($classFQN, 'dummy/path/class.php');
2121
$method = new MethodData('method2');
2222
$method->setType(ClassData::MODIFIER_PUBLIC);
@@ -28,8 +28,8 @@ function createClass($classFQN, $fqcn){
2828
return $class;
2929
}
3030

31-
describe('NodeTypeResolver', function(){
32-
beforeEach(function(){
31+
describe('NodeTypeResolver', function() {
32+
beforeEach(function() {
3333
$logger = new Logger('spec');
3434
$logger->pushHandler(new NullHandler);
3535
$this->resolver = new NodeTypeResolver($logger, new UseParser, new EventDispatcher);
@@ -46,49 +46,49 @@ function createClass($classFQN, $fqcn){
4646
$this->index->addClass($class);
4747
$this->index->addClass($class2);
4848
});
49-
describe('->getType()', function(){
50-
it('returns variable type from scope', function(){
49+
describe('->getType()', function() {
50+
it('returns variable type from scope', function() {
5151
$node = new NodeVar;
5252
$node->name = $this->var->getName();
5353
expect($this->resolver->getLastChainNodeType($node, $this->index, $this->scope))
5454
->to->equal($this->var->getType());
5555
});
56-
describe('Properties', function(){
57-
beforeEach(function(){
56+
describe('Properties', function() {
57+
beforeEach(function() {
5858
$this->node = new PropertyFetch;
5959
$this->node->var = new NodeVar;
6060
$this->node->var->name = $this->var->getName();
6161
});
62-
it('returns null for unknown property', function(){
62+
it('returns null for unknown property', function() {
6363
$this->node->name = 'param';
6464
expect($this->resolver->getLastChainNodeType($this->node, $this->index, $this->scope))
6565
->to->be->null;
6666
});
67-
it('returns type for known property', function(){
67+
it('returns type for known property', function() {
6868
$this->node->name = 'param2';
6969
expect($this->resolver->getLastChainNodeType($this->node, $this->index, $this->scope))
7070
->to->equal($this->anotherFQCN);
7171
});
7272
});
73-
describe('Method', function(){
74-
beforeEach(function(){
73+
describe('Method', function() {
74+
beforeEach(function() {
7575
$this->node = new MethodCall;
7676
$this->node->var = new NodeVar;
7777
$this->node->var->name = $this->var->getName();
7878
});
79-
it('returns null for unknown method', function(){
79+
it('returns null for unknown method', function() {
8080
$this->node->name = 'method';
8181
expect($this->resolver->getLastChainNodeType($this->node, $this->index, $this->scope))
8282
->to->be->null;
8383
});
84-
it('returns type for known method', function(){
84+
it('returns type for known method', function() {
8585
$this->node->name = 'method2';
8686
expect($this->resolver->getLastChainNodeType($this->node, $this->index, $this->scope))
8787
->to->equal($this->anotherFQCN);
8888
});
8989
});
90-
describe('Complex', function(){
91-
beforeEach(function(){
90+
describe('Complex', function() {
91+
beforeEach(function() {
9292
$this->node = new MethodCall;
9393
$this->node->name = 'method2';
9494
$this->node->var = new PropertyFetch;
@@ -98,7 +98,7 @@ function createClass($classFQN, $fqcn){
9898
$this->node->var->var->var = new NodeVar;
9999
$this->node->var->var->var->name = $this->var->getName();
100100
});
101-
it('returns type for known property in complex chain', function(){
101+
it('returns type for known property in complex chain', function() {
102102
$node = new PropertyFetch;
103103
$node->var = $this->node;
104104
$node->name = 'param2';

specs/entity/FQCN.spec.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
use Entity\FQCN;
44
use Entity\FQN;
55

6-
describe('FQCN', function(){
7-
describe('__construct()', function(){
8-
it('creates parts from string with class', function(){
6+
describe('FQCN', function() {
7+
describe('__construct()', function() {
8+
it('creates parts from string with class', function() {
99
$fqn = new FQCN('SomeClassName', 'Some\\Long\\Parts\\To\\Name');
1010
expect($fqn->getParts())->to->equal([
1111
'Some',
@@ -16,19 +16,19 @@
1616
'SomeClassName'
1717
]);
1818
});
19-
it('creates parts from array', function(){
19+
it('creates parts from array', function() {
2020
$parts = ['Some', 'Long', 'Parts'];
2121
$fqn = new FQCN('ClassName', $parts);
2222
$parts[] = 'ClassName';
2323
expect($fqn->getParts())->to->equal($parts);
2424
});
25-
it('FQCN with class name only', function(){
25+
it('FQCN with class name only', function() {
2626
$fqn = new FQN('ClassName');
2727
expect($fqn->getParts())->to->equal(['ClassName']);
2828
});
2929
});
30-
describe('->join()', function(){
31-
it('joins another FQCN', function(){
30+
describe('->join()', function() {
31+
it('joins another FQCN', function() {
3232
$fqn = new FQCN('ClassName', 'Some\\Long\\Path');
3333
$join = new FQCN('AnotherName', 'Another\\Long\\Name');
3434
expect($fqn->join($join)->getParts())->to->equal([
@@ -42,7 +42,7 @@
4242
'AnotherName'
4343
]);
4444
});
45-
it('joins FQN', function(){
45+
it('joins FQN', function() {
4646
$fqn = new FQCN('ClassName', 'Some\\Long\\Path\\Another');
4747
$join = new FQN('Another\\Long\\Name');
4848
expect($fqn->join($join)->getParts())->to->equal([
@@ -57,8 +57,8 @@
5757
]);
5858
});
5959
});
60-
describe('->toString()', function(){
61-
it('returns valid string', function(){
60+
describe('->toString()', function() {
61+
it('returns valid string', function() {
6262
$str = 'Some\\Long\\Path\\To\\Name';
6363
$fqn = new FQCN('ClassName', $str);
6464
expect($fqn->toString())->to->equal($str . '\\ClassName');

specs/entity/FQN.spec.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
use Entity\FQN;
44

5-
describe('FQN', function(){
6-
describe('__construct()', function(){
7-
it('creates parts from string', function(){
5+
describe('FQN', function() {
6+
describe('__construct()', function() {
7+
it('creates parts from string', function() {
88
$fqn = new FQN('Some\\Long\\Parts\\To\\Name');
99
expect($fqn->getParts())->to->equal([
1010
'Some',
@@ -14,18 +14,18 @@
1414
'Name'
1515
]);
1616
});
17-
it('creates parts from array', function(){
17+
it('creates parts from array', function() {
1818
$parts = ['Some', 'Long', 'Parts'];
1919
$fqn = new FQN($parts);
2020
expect($fqn->getParts())->to->equal($parts);
2121
});
22-
it('creates empty parts on empty call', function(){
22+
it('creates empty parts on empty call', function() {
2323
$fqn = new FQN;
2424
expect($fqn->getParts())->to->equal([]);
2525
});
2626
});
27-
describe('->join()', function(){
28-
it('joins another FQN', function(){
27+
describe('->join()', function() {
28+
it('joins another FQN', function() {
2929
$fqn = new FQN('Some\\Long\\Path');
3030
$join = new FQN('Another\\Long\\Name');
3131
expect($fqn->join($join)->getParts())->to->equal([
@@ -37,7 +37,7 @@
3737
'Name'
3838
]);
3939
});
40-
it('joins child FQN', function(){
40+
it('joins child FQN', function() {
4141
$fqn = new FQN('Some\\Long\\Path\\Another');
4242
$join = new FQN('Another\\Long\\Name');
4343
expect($fqn->join($join)->getParts())->to->equal([
@@ -50,8 +50,8 @@
5050
]);
5151
});
5252
});
53-
describe('->toString()', function(){
54-
it('returns valid string', function(){
53+
describe('->toString()', function() {
54+
it('returns valid string', function() {
5555
$str = 'Some\\Long\\Path\\To\\Name';
5656
$fqn = new FQN($str);
5757
expect($fqn->toString())->to->equal($str);

specs/generator/filesfinder.spec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Entity\Index;
77
use Prophecy\Argument;
88

9-
describe('FilesFinder', function () {
10-
beforeEach(function () {
9+
describe('FilesFinder', function() {
10+
beforeEach(function() {
1111
$this->mock = $this->getProphet()->prophesize(PathResolver::class);
1212
$this->mock->getDirFilesRecursive(Argument::any())->willReturn([
1313
'/test/TestClass.php',
@@ -16,14 +16,14 @@
1616
'/composer.json',
1717
'/peridot.php'
1818
]);
19-
$this->mock->relative(Argument::any(), Argument::any())->will(function ($args) {
19+
$this->mock->relative(Argument::any(), Argument::any())->will(function($args) {
2020
return $args[1];
2121
});
2222
$this->files = new FilesFinder($this->mock->reveal());
2323
$this->project = new Project(new Index, "/project");
2424
});
25-
describe('->getProjectFiles()', function () {
26-
it('returns all php files from project', function () {
25+
describe('->getProjectFiles()', function() {
26+
it('returns all php files from project', function() {
2727
expect($this->files->getProjectFiles($this->project))->to->be->equal([
2828
'/test/TestClass.php',
2929
'/some/AnotherFile.php',

0 commit comments

Comments
 (0)