-
Notifications
You must be signed in to change notification settings - Fork 160
AC-2222: [UCT Autofixing] PHPCompatibility.ForbiddenFinalPrivateMethods #373
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
Merged
magento-devops-reposync-svc
merged 3 commits into
magento:develop
from
svera:AC-2222_Autofix-forbidden-final-private-methods
Feb 11, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 9 additions & 29 deletions
38
Magento2/Tests/PHPCompatibility/ForbiddenFinalPrivateMethodsUnitTest.inc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* OK cross version. | ||
*/ | ||
class CrossVersionValid | ||
final class CrossVersionInValid | ||
{ | ||
private final function __construct() {} | ||
final public function publicFinal() {} | ||
final protected static function protectedFinal() {} | ||
private function privateNonOverloadable() {} | ||
} | ||
|
||
trait CrossVersionValidTrait | ||
{ | ||
final private function __CONSTRUCT() {} | ||
final public static function publicFinal() {} | ||
final protected function protectedFinal() {} | ||
private function privateStillOverloadable() {} // Open question in RFC PR https://github.com/php/php-src/pull/5401 | ||
} | ||
|
||
$anon = new class() { | ||
final private function __Construct() {} | ||
final public static function publicFinal(); | ||
final protected function protectedFinal(); | ||
private function privateNonOverloadable() {} | ||
}; | ||
|
||
/* | ||
* PHP 8.0: private methods cannot be final as they are never overridden by other classes. | ||
*/ | ||
class CrossVersionInValid | ||
{ | ||
final private function privateFinal(); | ||
static private final function privateStaticFinal(); | ||
static protected final function protectedStaticFinal(); | ||
final protected function protectedFinal(); | ||
} | ||
|
||
$anon = new class() { | ||
private final function __construct() {} | ||
final private function privateFinal(); | ||
static final private function privateStaticFinal(); | ||
final protected function protectedFinal(); | ||
static final protected function protectedStaticFinal(); | ||
}; | ||
|
||
trait CrossVersionInValidTrait | ||
{ | ||
private final function __construct() {} | ||
final private function privateFinal(); | ||
final protected function protectedFinal(); | ||
static private final function privateStaticFinal(); | ||
static protected final function protectedStaticFinal(); | ||
} |
27 changes: 27 additions & 0 deletions
27
Magento2/Tests/PHPCompatibility/ForbiddenFinalPrivateMethodsUnitTest.inc.fixed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
final class CrossVersionInValid | ||
{ | ||
private final function __construct() {} | ||
private function privateFinal(); | ||
static private function privateStaticFinal(); | ||
static protected final function protectedStaticFinal(); | ||
final protected function protectedFinal(); | ||
} | ||
|
||
$anon = new class() { | ||
private final function __construct() {} | ||
private function privateFinal(); | ||
static private function privateStaticFinal(); | ||
final protected function protectedFinal(); | ||
static final protected function protectedStaticFinal(); | ||
}; | ||
|
||
trait CrossVersionInValidTrait | ||
{ | ||
private final function __construct() {} | ||
private function privateFinal(); | ||
final protected function protectedFinal(); | ||
static private function privateStaticFinal(); | ||
static protected final function protectedStaticFinal(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.