php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74048 Should explain how Collator::create() compares to new Collator()
Submitted: 2017-02-05 18:30 UTC Modified: 2021-11-11 11:17 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: teo8976 at gmail dot com Assigned:
Status: Verified Package: I18N and L10N related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: teo8976 at gmail dot com
New email:
PHP Version: OS:

 

 [2017-02-05 18:30 UTC] teo8976 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/collator.create
---

Collator has a constructor and a static create() method.
No clue is given in the documentaion about why one should use "Collator::create()" rather than the constructor  "new Collator()". If thery are completely equivalent then it must be stated explicitly.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-06 14:29 UTC] cmb@php.net
-Status: Open +Status: Verified -Package: Documentation problem +Package: intl
 [2021-03-04 13:01 UTC] cmb@php.net
Without having a closer look, the difference is that the function
and static method return NULL on failure, while the constructor
returns an "empty" object in that case (cf. the return value
sections).  The latter would be pretty uncommon, since
constructors usually throw on failure, but changing this would be
a BC break (if the docs are correct in this regard).

Anyhow, it might be beneficial to actually merge the different
pages.
 [2021-11-11 11:17 UTC] nikic@php.net
-Package: intl +Package: I18N and L10N related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 16:01:28 2024 UTC