Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Idea] Child method compatible with parent (missing typehint or argument) #1371

Closed
JanMikes opened this issue May 1, 2019 · 1 comment
Closed

Comments

@JanMikes
Copy link
Contributor

JanMikes commented May 1, 2019

Situation 1:

abstract class Parent {
    public function a(string $a) { }
}

final class Child extends Parent {
-    public function a($a) { }
+    public function a(string $a) { }
}

Related to PHP 7.1 only: https://3v4l.org/Ev0XJ

Situation 2

abstract class Parent {
-    public function a($a) { }
+    public function a($a, $b = null) { }
}

final class Child extends Parent {
    public function a($a) { }
    public function a($a, $b = null) { }
}

(i am not sure if situation 2 would work without optional parameter - default value)

Related to PHP 7.1+ - see https://3v4l.org/8K3sp

@JanMikes JanMikes changed the title [Idea] Child method compatible with parent (missing typehint or [Idea] Child method compatible with parent (missing typehint or argument) May 1, 2019
@TomasVotruba
Copy link
Member

Covered by TypeDeclaration set. It needs to be used before the update of code-breaking change, as Rector cannot process invalid code

TomasVotruba added a commit that referenced this issue Dec 3, 2021
rectorphp/rector-src@493d4e6 [DowngradePhp81] Fix DowngradeArraySpreadStringKeyRector (#1371)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants