1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00

82 Commits

Author SHA1 Message Date
Jamie Calder
fc068b4857 Update default value to 'Parent Class' in XML (#4902)
The output being displayed was incorrect.
2025-10-12 22:43:55 +01:00
Derick Rethans
c1f37a6c27 Mark oop5 and xml* categories as 'interactive' (with exceptions) and use 'examples/' dir for XML example files so they (will) work with WASM 2025-03-06 14:35:36 +00:00
Derick Rethans
d6f54016d6 Fixed examples, and made some self-contained 2025-03-06 14:33:15 +00:00
Gina Peter Banyard
2f85d57a0b PHP 8.4: Single underscore as class name is deprecated (#4099) 2024-11-20 13:31:24 +00:00
Tim Bond
1d92bcca75 Add documentation for new MyClass()->method() without parentheses (GH-3978)
https://wiki.php.net/rfc/new_without_parentheses

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2024-10-31 21:57:31 +01:00
Gina Peter Banyard
f94d903985 Fix markup issues in language section 2024-04-22 13:37:54 +01:00
Mikhail Alferov
102a046f53 basic.xml: Expand description about different ways of instantiating classes (#3278)
It's hard to look for exactly which different ways of instantiation are discussed in the documentation

P. S. I probably specified through/by and a/the incorrectly, correct if necessary, please
2024-04-16 10:57:56 +01:00
Mikhail Alferov
d041509186 Update basic.xml (#3277)
```<?php

// Wrong example

class Foo {}

new
	// This is a string containing the name of a class
	'Foo'
; // Parse error: syntax error, unexpected single-quoted string "Foo"

?>```

```<?php

// Correct example

class Foo {}

$foo = 'Foo';

new
	// This is a variable (!) containing a string with the name of class
	$foo
; // OK

?>```
2024-03-19 17:13:31 +00:00
Christian Burk
bf51a3198f [skip-revcheck] Remove unnecessary and, thus, confusing comma (#3048)
A comma is neither necessary nor conventional in a "neither/nor" construction and is confusing because it is in, though doesn't complete, the dependent clause.
2023-12-29 15:36:56 +00:00
Anna Filina
bdc21104ac Remove replaceable class from magic constant (#2112)
* remove replaceable class from magic constant

* chanage ::class specified as constant to keyword, on php oop basic page

* Remove reference to keyword

Pick the suggestion favoured by the reviewer (https://github.com/php/doc-en/pull/728#discussion_r663359658)

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

* Reverting removal of <replaceable>

Addressing review comment: https://github.com/php/doc-en/pull/728#discussion_r663349544

---------

Co-authored-by: Amritpal Nagra <amritpalnagrame@gmail.com>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2023-05-09 19:35:48 -05:00
HypeMC
99744a3bfa Constructor visibility can be restricted (#2258) 2023-02-21 14:56:42 +00:00
Tim Düsterhus
6e69d9342e Use FQCN for native attributes (#2137)
* Use FQCN for native attributes

For attributes, it's non-obvious that they need to be imported with `use` or
referenced with their FQCN, because applying a non-existent attribute is not an
error.

Make the examples copy-and-paste safe by adding the leading backslash, as
already done for `#[\SensitiveParameterValue]`.
2023-01-04 16:20:00 +00:00
George Peter Banyard
512670405c Document readonly classes (#1996)
Co-authored-by: Yoshinari Takaoka <mumumu@mumumu.org>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>
2022-11-12 12:58:50 +00:00
Dan
c36ce0b514 [8.0] Document remaining core changes
* document changes to `new` in php 8.0

* document php 8.0 changes for `instanceof`

* document php 8.0 change to `define`

Co-authored-by: Peter Cowburn <petercowburn@gmail.com>

Closes GH-1155.
2021-12-14 18:34:40 +01:00
Yoshinari Takaoka
5d1673b7a0 [PHP 8.1] Document final class constants. (#1041)
* Document final class constant.

* use singular form.

* Update language/oop5/constants.xml

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>

* Update language/oop5/constants.xml

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>

Co-authored-by: Máté Kocsis <kocsismate@woohoolabs.com>
2021-11-29 15:06:49 -06:00
George Peter Banyard
9ee9eccf45 Refactor OO section part 2
Some misses from the first time

Signed-off-by: Larry Garfield <larry@garfieldtech.com>

Closes GH-329
2021-03-04 17:06:22 -06:00
Tyson Andre
02f3bf5717 $this is not a **reference** to the called object.
It's the value of the called object.

Additionally, in php 7.1, it was no longer possible to reassign $this
indirectly through a reference.

Even in php 7.0, I'd think it would initially be more like a value
(that references can be created from) than
a reference, but I may be misunderstanding what this means or what $this
did in php 5 or older.

Closes GH-380.
2021-01-24 15:56:27 +01:00
George Peter Banyard
4317fec755 Update method signature section for PHP 7/8
Closes GH-321
2021-01-16 09:45:36 +00:00
George Peter Banyard
a9edd62d08 Refactor OO section
This mostly consists of removing PHP 5 mentions and rewritting the docs accordingly.

Reviewed by Christoph M. Becker <cmbecker69@gmx.de> and Anna Filina <afilina@gmail.com>

Co-authored-by: Anna Filina <afilina@gmail.com>

Closes GH-277
2021-01-13 04:00:03 +00:00
Christoph Michael Becker
4528db2d91 Fix #80497: Incorrect example #11 for ::class on OOP The Basics page
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351963 c90b9560-bf6c-de11-be94-00142212c4b1
2020-12-09 10:49:23 +00:00
Christoph Michael Becker
025f2d34cc Document nullsafe operator
Closes GH-244.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351735 c90b9560-bf6c-de11-be94-00142212c4b1
2020-11-28 23:09:30 +00:00
Christoph Michael Becker
370bb99d28 Document the ::class constant on objects
Also, improve ::class description based on comments.

Closes GH-239.


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@351711 c90b9560-bf6c-de11-be94-00142212c4b1
2020-11-27 23:40:12 +00:00
Christoph Michael Becker
ee713929a5 Fix #70702: Documentation missing to explain unexpected optimisation behaviour
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@350429 c90b9560-bf6c-de11-be94-00142212c4b1
2020-08-31 11:18:06 +00:00
George Peter Banyard
6187696fb4 Updated REGEX of valid symbols in various instances
Fixes Doc Bug #75814

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347269 c90b9560-bf6c-de11-be94-00142212c4b1
2019-04-17 15:17:19 +00:00
Pasindu De Silva
cb1c93099e Parentheses and argument list optional with new operator
https://bugs.php.net/bug.php?id=77426

Submitted by girgias

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@346784 c90b9560-bf6c-de11-be94-00142212c4b1
2019-02-10 23:58:40 +00:00
Christoph Michael Becker
0fe00e3574 Minor doc improvements
Patches provided by anonymous users.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@344469 c90b9560-bf6c-de11-be94-00142212c4b1
2018-03-09 12:44:59 +00:00
Pieter Hordijk
5e40a5a43d Added missing PHP open tags to examples
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@343230 c90b9560-bf6c-de11-be94-00142212c4b1
2017-10-11 13:20:05 +00:00
Christoph Michael Becker
b90505533d Fix typos
Patches provided by anon users.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341799 c90b9560-bf6c-de11-be94-00142212c4b1
2017-01-28 18:33:56 +00:00
Christoph Michael Becker
2de9c1a37b Fix ##73287: Clone chaining feature
We also document that this is possible for `new` as of PHP 5.4.0.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@340428 c90b9560-bf6c-de11-be94-00142212c4b1
2016-10-11 13:01:01 +00:00
Christoph Michael Becker
4392990fb6 Fix #72462: documentation about static calls from secondary object is outdated
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339436 c90b9560-bf6c-de11-be94-00142212c4b1
2016-06-21 14:38:50 +00:00
Christoph Michael Becker
06df50f0b1 Fix #72331: most simple way to call anonymous function assigned to object property missing
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@339308 c90b9560-bf6c-de11-be94-00142212c4b1
2016-06-07 13:25:21 +00:00
Christoph Michael Becker
45fc246e9f ::class is a compile time transformation
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@338498 c90b9560-bf6c-de11-be94-00142212c4b1
2016-01-15 13:31:35 +00:00
Christoph Michael Becker
727d059758 clarified behavior of property access vs. method call (fixes #49515)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337758 c90b9560-bf6c-de11-be94-00142212c4b1
2015-09-06 15:06:02 +00:00
Pasindu De Silva
a44a1e0b79 Minor typo, grammar and example Fixes (By Christoph Becker cmb@php.net)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@336715 c90b9560-bf6c-de11-be94-00142212c4b1
2015-05-04 19:48:31 +00:00
Peter Cowburn
4b2619b58a grammar
Based on a patch by Nathaniel Cailo

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@333213 c90b9560-bf6c-de11-be94-00142212c4b1
2014-03-29 21:56:25 +00:00
Chris Wright
fc85461184 Updated class name regex to include start/end anchors.
-- 
Provided by anonymous 35003 (robin@kingsquare.nl)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332018 c90b9560-bf6c-de11-be94-00142212c4b1
2013-10-30 18:22:34 +00:00
Adam Harvey
c2f8c648c8 Promote ::class documentation to its own subsection for direct linking.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330569 c90b9560-bf6c-de11-be94-00142212c4b1
2013-06-20 22:08:17 +00:00
Jakub Vrana
0bae036804 ClassName::class
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330216 c90b9560-bf6c-de11-be94-00142212c4b1
2013-05-14 20:44:08 +00:00
Yannick Torres
3a8dc25d68 Typo found by online editor user
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328095 c90b9560-bf6c-de11-be94-00142212c4b1
2012-10-22 11:49:37 +00:00
Hannes Magnusson
5340b7c601 Link to a trickery example, fixes bug#60499
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321294 c90b9560-bf6c-de11-be94-00142212c4b1
2011-12-21 15:05:24 +00:00
Mark Wiesemann
79ba70edc6 removed leftover word ("when")
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@306693 c90b9560-bf6c-de11-be94-00142212c4b1
2010-12-26 17:25:13 +00:00
Daniel Egeberg
6e133c0d53 Fixed PHP bug #52494 (description of keyword "new")
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@302259 c90b9560-bf6c-de11-be94-00142212c4b1
2010-08-15 07:39:53 +00:00
Daniel Egeberg
de537ccab1 Better example for #52499
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@302257 c90b9560-bf6c-de11-be94-00142212c4b1
2010-08-15 07:34:23 +00:00
Daniel Egeberg
966294f125 Fixed PHP bug #52499 (new keyword not fully documented)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@302256 c90b9560-bf6c-de11-be94-00142212c4b1
2010-08-15 07:29:10 +00:00
Peter Cowburn
8cd6280cc6 minor grammar improvements
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297948 c90b9560-bf6c-de11-be94-00142212c4b1
2010-04-13 08:54:43 +00:00
Daniel P. Brown
17e93774d1 Not *every* class definition matches this pattern, only basic classes.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297937 c90b9560-bf6c-de11-be94-00142212c4b1
2010-04-12 23:06:29 +00:00
Daniel Egeberg
96c9d88bad Converted to utf-8
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297028 c90b9560-bf6c-de11-be94-00142212c4b1
2010-03-28 22:10:10 +00:00
Daniel Egeberg
a3371d8b3e Fixed PHP bug #50870 (Constructor parameters do not have to match those of superclass constructor)
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@295468 c90b9560-bf6c-de11-be94-00142212c4b1
2010-02-24 12:44:37 +00:00
Antony Dovgal
71a9cd7583 define $instance and make the example more clear
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@294876 c90b9560-bf6c-de11-be94-00142212c4b1
2010-02-11 09:25:27 +00:00
Mark Wiesemann
b851244780 added missing period
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@289308 c90b9560-bf6c-de11-be94-00142212c4b1
2009-10-07 21:37:38 +00:00