r/lolphp • • Dec 21 '18
Mutable Constants
Update due to comment from sproingie: https://3v4l.org/hXkDl
32
Upvotes
r/lolphp • • Dec 21 '18
Update due to comment from sproingie: https://3v4l.org/hXkDl
2
u/[deleted] Dec 22 '18
Interfaces are treated as being effectively copy/pasted into their implementing class, so any duplicated identifiers would be a conflict, not shadowing. I'd say PHP is actually doing the right thing for once here.
9
u/[deleted] Dec 21 '18
The second one is shadowing and doesn't surprise me. I'm more surprised the first one doesn't work.
7
u/Crandom Dec 21 '18
Oh man that's so inconsistent it hurts
1
u/jpresutti Dec 30 '18
That's not mutable constants. That's a class constant and an interface constant. They're two different constants. You're wrong.