Skip to content

[Sync EN] Major rewrite of the callable type chapter#250

Open
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:sync-en/types-callable
Open

[Sync EN] Major rewrite of the callable type chapter#250
lacatoire wants to merge 1 commit into
php:masterfrom
lacatoire:sync-en/types-callable

Conversation

@lacatoire
Copy link
Copy Markdown
Member

Bringt language/types/callable.xml auf den Stand von upstream doc-en (312c0c7b39). Die englische Seite wurde grundlegend umgeschrieben.

Änderungen:

  • Titel Callbacks / CallablesCallables.
  • Neuer Einleitungsabsatz mit einem kurzen <informalexample>, das callable als Parametertyp zeigt.
  • Sektionstitel ÜbergabeErstellung von Callables, Inhalte um die Erstellungsarten herum reorganisiert.
  • Neue <itemizedlist> mit den vier Erstellungsarten (Closure-Objekt, String mit Funktions- oder Methodennamen, Array mit Klasse+Methode, Objekt mit __invoke).
  • Neuer Abschnitt zur Erstellung von Closure-Objekten (anonyme Funktion, Pfeilfunktion, First-Class-Callable-Syntax, Closure::fromCallable) mit einem lauffähigen Beispiel.
  • Neue Anmerkung zur Bindung an den Gültigkeitsbereich (Closure ist an den Erstellungs-Scope gebunden; String/Array-Callables werden im Aufruf-Scope aufgelöst).
  • Neuer Absatz und Hinweis zu kontextabhängigen Callables (parent::method, ["static", "method"]) und deren Verwerfung seit PHP 8.2.0.
  • Das bestehende call_user_func-Beispiel wurde um den neuen Typ 5 (MyClass::class) erweitert; nachfolgende Typen neu nummeriert; Ausgabe nun über einen <screen>-Block.
  • Das eigenständige Closure-Beispiel wurde entfernt (Inhalt im neuen Closure-Beispiel weiter oben aufgegangen).
  • Das obsolete <!-- $Revision$ -->-SVN-Marker entfernt.

Die "Sie"-Form wurde durchgehend beibehalten, bestehender Maintainer: (simp) bleibt.

Brings language/types/callable.xml up to date with the upstream
rewrite (EN-Revision 312c0c7b39d0722c419f6784cbda24823220dfb3):

- Title "Callbacks / Callables" → "Callables".
- New intro paragraph with a short informalexample showing
  callable as a parameter type.
- Section "Übergabe" renamed to "Erstellung von Callables" and
  reorganized around how callables are created.
- New itemizedlist enumerating the four ways to create a callable
  (Closure object, string, array with class+method, object
  implementing __invoke).
- New explanation of how Closure objects can be built (anonymous
  function, arrow function, first-class callable syntax,
  Closure::fromCallable) with a runnable example showing all four.
- New note about scope binding (Closure is bound to creation scope,
  callables as string/array are resolved in the call scope).
- New paragraph and note about context-dependent callables
  (parent::method, ["static", "method"]) deprecated since PHP 8.2.0.
- Existing call_user_func example expanded with a new Type 5 case
  using MyClass::class and renumbered subsequent types; output is
  now shown via a <screen> block.
- Standalone Closure example removed (content merged into the new
  Closure example earlier in the section).
- Dropped the obsolete <!-- $Revision$ --> SVN marker.

Sie-Form beibehalten, bestehender Maintainer (simp) bleibt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant