php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30250 final keyword for class variables?
Submitted: 2004-09-27 04:00 UTC Modified: 2004-09-27 16:38 UTC
From: nut at phpnut dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.0.1 OS: Linux
Private report: No CVE-ID: None
 [2004-09-27 04:00 UTC] nut at phpnut dot com
Description:
------------
Tried using the final keyword on a class variable per the docs

Final Keyword

PHP 5 introduces the final keyword, which prevents child classes from overriding a method or variable by prefixing the definition with final. 

On windows system running 5.0.2 also on Linux running 5.0.1

<?php

class Foo
{
    final $FooVersion;
}
?>

Returns:

Cannot declare property Foo::$FooVersion final, the final modifier is allowed only for methods


Is this a bug or are the docs wrong?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-27 09:09 UTC] derick@php.net
docs are wrong.
 [2004-09-27 16:38 UTC] nlopess@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of nlopess
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=dd1f66e96ccfb8aa89ba8fee4378f2c62468c1ea
Log: fix #30250: final is just for methods
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Fri Jan 02 03:00:01 2026 UTC