Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

class ValidatedBase
{
private bool $validated = false;

protected function __construct()
{
$this->validate();
$this->validated = true;
}

private function validate(): void
{
}
}

final class SkipsParentConstructor extends ValidatedBase
{
public function __construct()
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ public function getNodeTypes(): array
*/
public function refactor(Node $node): ?Node
{
// A child class may bypass the constructor and depend on the declared property default
if (! $node->isFinal()) {
return null;
}

$hasChanged = false;

$constructClassMethod = $node->getMethod(MethodName::CONSTRUCT);
Expand Down
Loading