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

It's possible to split up accessors #10

Closed
nikic opened this issue Dec 29, 2012 · 2 comments
Closed

It's possible to split up accessors #10

nikic opened this issue Dec 29, 2012 · 2 comments
Labels

Comments

@nikic
Copy link
Collaborator

nikic commented Dec 29, 2012

The following code works:

<?php

class A {
    protected $bar;
    public $foo { get { return $this->bar; } }
    public $foo { set { $this->bar = $value; } }
}

$a = new A;
$a->foo = 'test';
var_dump($a->foo);

I'm not sure whether this is a bug or a feature.

@cpriest
Copy link
Owner

cpriest commented Dec 29, 2012

Interesting, it wasn't intended to be allowed but the code allows for it simply because its flexible. We can specifically deny it if that's what's desired. Doesn't matter to me either way. A subsequent public $foo { get { ... } } would likely over-write the original which may be a good enough reason to deny the possibility of separated accessors.

@cpriest
Copy link
Owner

cpriest commented Jan 2, 2013

This is no longer an issue, fixed by b04e5b0

@cpriest cpriest closed this as completed Jan 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants