|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-26 10:10 UTC] jani@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 00:00:02 2025 UTC |
Description: ------------ When somebody creates final private constructor then the class that extends this class cannot have constructor at all, even though private methods shouldn't be visible outside of the class. So final private constructor shouldn't allow calling parent::__construct(), but creating constructor should be allowed. The same happens if class has final private method, then no subclass can use method with the same name (I know that there is no point creating private final, but it seems a problem when there'll be final instance variables in the future, plus it is a problem with constructors). As I understand, parent's constructor is not called automatically, (parent::__construct() needs to be called) because if parent's constructor is private but not final then the code works. Reproduce code: --------------- class Test { final private function __construct() {} } class SubTest extends Test { // private methods shouldn't be visible // and I am not calling parent::__construct(); public function __construct() {} }