8000 Add others allowed types for class creation (#159) · djoos/Symfony-coding-standard@9b044c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b044c5

Browse files
mmolldjoos
authored andcommitted
Add others allowed types for class creation (#159)
Double colon, object separator, etc... closes GH-108
1 parent a526278 commit 9b044c5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

Symfony/Sniffs/Objects/ObjectInstantiationSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public function process(File $phpcsFile, $stackPtr)
7272
T_VARIABLE,
7373
T_STATIC,
7474
T_SELF,
75+
T_DOUBLE_COLON,
76+
T_OBJECT_OPERATOR,
77+
T_OPEN_SQUARE_BRACKET,
78+
T_CLOSE_SQUARE_BRACKET,
7579
);
7680

7781
$object = $stackPtr;

Symfony/Tests/Objects/ObjectInstantiationUnitTest.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ new $foo;
88
new Foo ();
99
new static;
1010
new self;
11+
new Foo::bar;
12+
new Foo::bar[true];
13+
new $foo->bar;
14+
new $foo->bar[true];
1115

1216
// good
1317
new Foo();
@@ -29,3 +33,5 @@ new static($this->foo);
2933
new self();
3034
new self(true);
3135
new self($this->foo);
36+
new Foo::bar();
37+
new $foo->bar();

Symfony/Tests/Objects/ObjectInstantiationUnitTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public function getErrorList()
5050
8 => 1,
5151
9 => 1,
5252
10 => 1,
53+
11 => 1,
54+
12 => 1,
55+
13 => 1,
56+
14 => 1,
5357
);
5458
}
5559

0 commit comments

Comments
 (0)
0