Crell / enum-comparison

A comparison of enumerations and similar features in different languages
80 stars 7 forks source link

Protected is not identical to private #30

Closed iluuu1994 closed 3 years ago

iluuu1994 commented 3 years ago

Public, private, and protected methods. (Protected methods are effectively identical to private as inheritance is not allowed.)

This is true only for enum cases but not the enums themselves.

enum Foo {
    case Bar {
        public function baz() {
            $this->qux(); // Error
        }
    }

    private function qux() {}
}
Crell commented 3 years ago

Makes sense. I updated the RFC accordingly.

iluuu1994 commented 3 years ago

Thanks :+1: