php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66220 Class name case-sensitivity
Submitted: 2013-12-02 18:38 UTC Modified: 2013-12-03 08:10 UTC
From: info at websivu dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2013-12-02 18:38 UTC] info at websivu dot com
Description:
------------
---
From manual page: http://www.php.net/language.oop5.visibility
---

For typing convention/consistency, class instantiation in the example #2 should be written with a capital letter.

Is now: $myFoo = new foo();
Should be: $myFoo = new Foo();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-03 00:23 UTC] bjori@php.net
-Status: Open +Status: Not a bug
 [2013-12-03 00:23 UTC] bjori@php.net
Why?
Class names are not case sensitive.
 [2013-12-03 08:10 UTC] info at websivu dot com
You are right.

Neither constants should be written using uppercase, but "By convention, constant identifiers are always uppercase". Source: http://php.net/manual/en/language.constants.php

That's just a good practice and a styling issue, to use a capital letter in classes. Some kind of consistency in PHP manual's coding should be used.

If the example is written explicitly to demonstrate that a class is not case sensitive, a comment should be added to that line.

In my opinion, the manual should promote good coding habits or use some kind of standard: PSR-2 for example.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Apr 15 10:01:23 2021 UTC