Skip to content
Merged
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
Expand Up @@ -137,7 +137,7 @@ public final String asString(PrintAs as, BaseFunctionElement element, TypeNameRe
if (methdodInvocation.startsWith(" ")) {
methdodInvocation = methdodInvocation.substring(1);
}
if (returns2.size() > 0) {
if (!returns2.isEmpty() && !element.getName().equals(MethodElement.CONSTRUCTOR_NAME)) {
template.append(String.format("{%nreturn parent::%s;%n}", methdodInvocation)); //NOI18N
} else {
template.append(String.format("{%nparent::%s;%n}", methdodInvocation)); //NOI18N
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

class Foo {
/**
* @param string $test
* @return String demo
*/
public function __construct(string $test) {}
}

class Bar extends Foo {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public function __construct(string $test){
parent::__construct($test);
}
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ public void testInstanceOverrideMethodWithGuessingFloatType_02() throws Exceptio
selectProperties(cgsInfo.getPossibleMethods(), "myFoo"), new SinglePropertyMethodCreator.InheritedMethodCreator(cgsInfo)));
}

public void testInstanceOverrideConstructor_01() throws Exception {
CGSInfo cgsInfo = getCgsInfo("class Bar extends Foo {^", PhpVersion.PHP_83);
checkResult(new SelectedPropertyMethodsCreator().create(
selectProperties(cgsInfo.getPossibleMethods(), "__construct"), new SinglePropertyMethodCreator.InheritedMethodCreator(cgsInfo)));
}

public void testGetterWithType_01() throws Exception {
CGSInfo cgsInfo = getCgsInfo("class Foo {^", PhpVersion.PHP_70);
cgsInfo.setPublicModifier(false);
Expand Down
Loading