Skip to content

Commit

Permalink
[Php70] Fix Php4 contructor not replaced with __construct() on php 7.…
Browse files Browse the repository at this point in the history
…4 environment (#5189)
  • Loading branch information
samsonasik committed Oct 19, 2023
1 parent 4795d00 commit 5ac3cb3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

class SkipOnlyOtherMethod
{
public function run()
{
}
}
2 changes: 1 addition & 1 deletion rules/Php70/Rector/ClassMethod/Php4ConstructorRector.php
Expand Up @@ -107,7 +107,7 @@ public function refactorWithScope(Node $node, Scope $scope): Class_|int|null
$this->processClassMethodStatementsForParentConstructorCalls($psr4ConstructorMethod, $scope);

// does it already have a __construct method?
if (! $classReflection->hasConstructor()) {
if (! $classReflection->hasNativeMethod(MethodName::CONSTRUCT)) {
$psr4ConstructorMethod->name = new Identifier(MethodName::CONSTRUCT);
}

Expand Down

0 comments on commit 5ac3cb3

Please sign in to comment.