Skip to content

Commit 4791648

Browse files
committed
Mark node visitor classes as final
1 parent 0954adf commit 4791648

8 files changed

+20
-8
lines changed

src/NodeVisitor/ClassFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PhpParser\Node\Stmt\Namespace_;
1616
use PhpParser\NodeVisitorAbstract;
1717

18-
class ClassFile extends NodeVisitorAbstract
18+
final class ClassFile extends NodeVisitorAbstract
1919
{
2020
/**
2121
* @var bool

src/NodeVisitor/ClassImplements.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PhpParser\Node\Stmt\Namespace_;
1616
use PhpParser\NodeVisitorAbstract;
1717

18-
class ClassImplements extends NodeVisitorAbstract
18+
final class ClassImplements extends NodeVisitorAbstract
1919
{
2020
/**
2121
* @var string[]

src/NodeVisitor/ClassMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use PhpParser\Node\Stmt\Namespace_;
1818
use PhpParser\NodeVisitorAbstract;
1919

20-
class ClassMethod extends NodeVisitorAbstract
20+
final class ClassMethod extends NodeVisitorAbstract
2121
{
2222
/**
2323
* @var MethodGenerator

src/NodeVisitor/ClassNamespace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use PhpParser\Node\Stmt;
1515
use PhpParser\NodeVisitorAbstract;
1616

17-
class ClassNamespace extends NodeVisitorAbstract
17+
final class ClassNamespace extends NodeVisitorAbstract
1818
{
1919
/**
2020
* @var string

src/NodeVisitor/ClassUseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PhpParser\Node\Stmt\Namespace_;
1616
use PhpParser\NodeVisitorAbstract;
1717

18-
class ClassUseTrait extends NodeVisitorAbstract
18+
final class ClassUseTrait extends NodeVisitorAbstract
1919
{
2020
/**
2121
* @var string[]

src/NodeVisitor/NamespaceUse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use PhpParser\Node\Stmt\Namespace_;
1616
use PhpParser\NodeVisitorAbstract;
1717

18-
class NamespaceUse extends NodeVisitorAbstract
18+
final class NamespaceUse extends NodeVisitorAbstract
1919
{
2020
/**
2121
* @var array

src/NodeVisitor/Property.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use PhpParser\Node\Stmt\Namespace_;
1818
use PhpParser\NodeVisitorAbstract;
1919

20-
class Property extends NodeVisitorAbstract
20+
final class Property extends NodeVisitorAbstract
2121
{
2222
/**
2323
* @var PropertyGenerator
@@ -29,6 +29,18 @@ public function __construct(PropertyGenerator $propertyGenerator)
2929
$this->propertyGenerator = $propertyGenerator;
3030
}
3131

32+
public static function forClassProperty(
33+
string $name = null,
34+
string $type = null,
35+
$defaultValue = null,
36+
bool $typed = false,
37+
int $flags = PropertyGenerator::FLAG_PRIVATE
38+
): self {
39+
return new self(
40+
new PropertyGenerator($name, $type, $defaultValue, $typed, $flags)
41+
);
42+
}
43+
3244
public function afterTraverse(array $nodes): ?array
3345
{
3446
$newNodes = [];

src/NodeVisitor/StrictType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use PhpParser\Node\Stmt;
1515
use PhpParser\NodeVisitorAbstract;
1616

17-
class StrictType extends NodeVisitorAbstract
17+
final class StrictType extends NodeVisitorAbstract
1818
{
1919
public function afterTraverse(array $nodes)
2020
{

0 commit comments

Comments
 (0)