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

SplDoublyLinkedList::__construct() does not exist #640

Closed
porthd opened this issue May 29, 2021 · 1 comment · Fixed by #641
Closed

SplDoublyLinkedList::__construct() does not exist #640

porthd opened this issue May 29, 2021 · 1 comment · Fixed by #641
Labels
bug Documentation contains incorrect information good first issue Good for newcomers

Comments

@porthd
Copy link

porthd commented May 29, 2021

From manual page: https://php.net/class.spldoublylinkedlist


The documentation describe a constructor.
https://www.php.net/manual/de/spldoublylinkedlist.construct.php
https://www.php.net/manual/en/spldoublylinkedlist.construct.php

I think, there is no constructor. (or misunderstand I something?)

I tried to extend 'SplDoublyLinkedList' in an own class and got the unexpected fatal error (see comment in code)

<?php
        
        class Liste extends SplDoublyLinkedList 
        {
            public function __construct() {
                parent::__construct(); //<b>Fatal error</b>:  Uncaught Error: Cannot call constructor in [...][...]:6
                $this->push('klaus');
                
            }
            
            public function liste() {
                $this->push('herbert');
            }
        }

$hallo = new Liste();
$hallo->push('padina');
$hallo->push('doof');
$hallo->liste();
foreach($hallo as $key=>$item) {
    echo($key.' => '.$item."\n");
@nikic nikic changed the title _--Construct-method not public SplDoublyLinkedList::__construct() does not exist May 29, 2021
@nikic nikic added the bug Documentation contains incorrect information label May 29, 2021
@cmb69
Copy link
Member

cmb69 commented May 29, 2021

Right, SplDoublyLinkedList has no contructor. The page should be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Documentation contains incorrect information good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants