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

FinalStaticAccessFixer - Introduction #4000

Open
wants to merge 9 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@ntzm
Contributor

ntzm commented Sep 23, 2018

Partially handles #3999.

Any other integration tests needed?

@ntzm ntzm force-pushed the ntzm:final-static-to-self branch 2 times, most recently from e8afd27 to 157f2be Sep 23, 2018

@ntzm ntzm force-pushed the ntzm:final-static-to-self branch from 157f2be to da771d5 Sep 23, 2018

@SpacePossum

This comment has been minimized.

Member

SpacePossum commented Oct 16, 2018

Please add the following tests.

to public function provideFixCases() (think will pass)

            'in multiple methods and classes' => [
                '<?php
                    final class X {
                        public function b() { echo self::class; }
                        public function c() { echo self::class; }
                    }
                    final class Y {
                        public static $var = 2;
                        public function b() { echo self::class; }
                        public function c() { static $a = 0; echo self::class.$a; }
                    }
                    class Foo {
                        public function b() { echo static::class; }
                        public function c() { echo static::class; }
                    }
                    final class Z {
                        public function b() { echo self::class; }
                        public function c() { return static function(){}; }
                    }
                ',
                '<?php
                    final class X {
                        public function b() { echo static::class; }
                        public function c() { echo static::class; }
                    }
                    final class Y {
                        public static $var = 2;
                        public function b() { echo static::class; }
                        public function c() { static $a = 0; echo static::class.$a; }
                    }
                    class Foo {
                        public function b() { echo static::class; }
                        public function c() { echo static::class; }
                    }
                    final class Z {
                        public function b() { echo static::class; }
                        public function c() { return static function(){}; }
                    }
                ',
            ],

to public function provideFix70Cases() (think will fail)

'property and nested anonymous class' => [
                '<?php final class A { public $b = self::class; public function foo(){ return new class { public $b = static::class; }; }}',
                '<?php final class A { public $b = static::class; public function foo(){ return new class { public $b = static::class; }; }}',
            ],
@SpacePossum

see comment with requested tests cares

@SpacePossum SpacePossum added the feature label Oct 16, 2018

@SpacePossum SpacePossum added this to the 2.14.0 milestone Oct 16, 2018

@ntzm ntzm changed the base branch from 2.12 to master Oct 18, 2018

@ntzm

This comment has been minimized.

Contributor

ntzm commented Oct 18, 2018

Thanks for your review @SpacePossum, good spot! Nested anonymous classes should be ignored now.

ntzm and others added some commits Oct 19, 2018

@SpacePossum SpacePossum changed the title from Implement FinalStaticAccessFixer to FinalStaticAccessFixer - Introduction Dec 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment