Skip to content

Commit d8079e0

Browse files
committed
Merge branch 'feature/3668-psr12-classinstantiation-fix-regression' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 4329399 + 8d52a60 commit d8079e0

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

src/Standards/PSR12/Sniffs/Classes/ClassInstantiationSniff.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function process(File $phpcsFile, $stackPtr)
4848
T_NS_SEPARATOR => T_NS_SEPARATOR,
4949
T_SELF => T_SELF,
5050
T_STATIC => T_STATIC,
51+
T_PARENT => T_PARENT,
5152
T_VARIABLE => T_VARIABLE,
5253
T_DOLLAR => T_DOLLAR,
5354
T_OBJECT_OPERATOR => T_OBJECT_OPERATOR,

src/Standards/PSR12/Tests/Classes/ClassInstantiationUnitTest.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ $class = new ${$obj?->classname};
4242
$anonWithAttribute = new #[SomeAttribute('summary')] class {
4343
public const SOME_STUFF = 'foo';
4444
};
45+
46+
$foo = new parent();
47+
$foo = new parent;

src/Standards/PSR12/Tests/Classes/ClassInstantiationUnitTest.inc.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,6 @@ $class = new ${$obj?->classname}();
4242
$anonWithAttribute = new #[SomeAttribute('summary')] class {
4343
public const SOME_STUFF = 'foo';
4444
};
45+
46+
$foo = new parent();
47+
$foo = new parent();

src/Standards/PSR12/Tests/Classes/ClassInstantiationUnitTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function getErrorList()
4343
34 => 1,
4444
37 => 1,
4545
38 => 1,
46+
47 => 1,
4647
];
4748

4849
}//end getErrorList()

0 commit comments

Comments
 (0)