Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions appendices/migration85/other-changes.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 6b48f364497107ae46f926bfc99a4e3d9d546316 Maintainer: mumumu Status: ready -->
<!-- EN-Revision: c7b445ec851969e669026cfa483b104ea2de5d95 Maintainer: mumumu Status: ready -->
<sect1 xml:id="migration85.other-changes">
<title>その他の変更</title>

Expand Down Expand Up @@ -440,7 +440,8 @@

<simpara>
致命的なエラーにバックトレースを含めるかどうかを制御するために、
fatal_error_backtraces INI ディレクティブが追加されました。
<link linkend="ini.fatal-error-backtraces">fatal_error_backtraces</link>
INI ディレクティブが追加されました。
<!-- RFC: https://wiki.php.net/rfc/error_backtraces_v2 -->
</simpara>

Expand Down
66 changes: 52 additions & 14 deletions language/enumerations.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1eb67bea30f61f7d9cdfd371146911a0ba07bbd2 Maintainer: mumumu Status: ready -->
<!-- EN-Revision: 8af3521cb43f54c652baaf8dbbcb786b79a5d04e Maintainer: mumumu Status: ready -->
<chapter xml:id="language.enumerations" xmlns="http://docbook.org/ns/docbook" annotations="interactive">
<title>列挙型(Enum)</title>
<sect1 xml:id="language.enumerations.overview">
Expand Down Expand Up @@ -46,6 +46,7 @@
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

enum Suit
{
case Hearts;
Expand All @@ -70,6 +71,7 @@ enum Suit
<programlisting role="php">
<![CDATA[
<?php

enum Suit
{
case Hearts;
Expand Down Expand Up @@ -121,6 +123,7 @@ pick_a_card('Spades');
<programlisting role="php">
<![CDATA[
<?php

enum Suit
{
case Hearts;
Expand Down Expand Up @@ -176,6 +179,7 @@ if ($a !== 'Spades') {
<programlisting role="php">
<![CDATA[
<?php

enum Suit
{
case Hearts;
Expand Down Expand Up @@ -222,6 +226,7 @@ print Suit::Spades->name;
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

enum Suit: string
{
case Hearts = 'H';
Expand Down Expand Up @@ -276,6 +281,7 @@ enum Suit: string
<programlisting role="php">
<![CDATA[
<?php

enum Suit: string
{
case Hearts = 'H';
Expand All @@ -300,6 +306,7 @@ print Suit::Clubs->value;
<programlisting role="php">
<![CDATA[
<?php

enum Suit: string
{
case Hearts = 'H';
Expand Down Expand Up @@ -357,6 +364,7 @@ $ref = &$suit->value;
<programlisting role="php">
<![CDATA[
<?php

enum Suit: string
{
case Hearts = 'H';
Expand Down Expand Up @@ -409,6 +417,7 @@ print $suit->value . "\n";
<programlisting role="php">
<![CDATA[
<?php

interface Colorful
{
public function color(): string;
Expand All @@ -424,7 +433,7 @@ enum Suit implements Colorful
// インターフェイスの規約を満たすための実装
public function color(): string
{
return match($this) {
return match ($this) {
Suit::Hearts, Suit::Diamonds => 'Red',
Suit::Clubs, Suit::Spades => 'Black',
};
Expand Down Expand Up @@ -465,6 +474,7 @@ print Suit::Diamonds->shape(); // "Rectangle" と表示
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

interface Colorful
{
public function color(): string;
Expand All @@ -480,7 +490,7 @@ enum Suit: string implements Colorful
// インターフェイスの規約を満たすための実装
public function color(): string
{
return match($this) {
return match ($this) {
Suit::Hearts, Suit::Diamonds => 'Red',
Suit::Clubs, Suit::Spades => 'Black',
};
Expand Down Expand Up @@ -518,6 +528,7 @@ enum Suit: string implements Colorful
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

interface Colorful
{
public function color(): string;
Expand All @@ -534,7 +545,7 @@ final class Suit implements UnitEnum, Colorful

public function color(): string
{
return match($this) {
return match ($this) {
Suit::Hearts, Suit::Diamonds => 'Red',
Suit::Clubs, Suit::Spades => 'Black',
};
Expand Down Expand Up @@ -575,6 +586,7 @@ final class Suit implements UnitEnum, Colorful
<programlisting role="php">
<![CDATA[
<?php

enum Size
{
case Small;
Expand All @@ -583,7 +595,7 @@ enum Size

public static function fromLength(int $cm): self
{
return match(true) {
return match (true) {
$cm < 50 => self::Small,
$cm < 100 => self::Medium,
default => self::Large,
Expand Down Expand Up @@ -622,6 +634,7 @@ var_dump(Size::fromLength(50));
<programlisting role="php">
<![CDATA[
<?php

enum Size
{
case Small;
Expand Down Expand Up @@ -654,14 +667,16 @@ var_dump(Size::Huge);
<programlisting role="php">
<![CDATA[
<?php

interface Colorful
{
public function color(): string;
}

trait Rectangle
{
public function shape(): string {
public function shape(): string
{
return "Rectangle";
}
}
Expand All @@ -677,7 +692,7 @@ enum Suit implements Colorful

public function color(): string
{
return match($this) {
return match ($this) {
Suit::Hearts, Suit::Diamonds => 'Red',
Suit::Clubs, Suit::Spades => 'Black',
};
Expand Down Expand Up @@ -718,6 +733,7 @@ var_dump($suit->shape());
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

// これは、完全に正しい列挙型の定義です
enum Direction implements ArrayAccess
{
Expand Down Expand Up @@ -833,6 +849,7 @@ $foo = new Foo();
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

$clovers = new Suit();
// Error: Cannot instantiate enum Suit

Expand All @@ -859,6 +876,7 @@ $horseshoes = (new ReflectionClass(Suit::class))->newInstanceWithoutConstructor(
<programlisting role="php">
<![CDATA[
<?php

enum Suit
{
case Hearts;
Expand Down Expand Up @@ -904,6 +922,7 @@ var_dump(SuitBacked::cases());
<programlisting role="php">
<![CDATA[
<?php

enum Suit: string
{
case Hearts = 'H';
Expand All @@ -926,6 +945,12 @@ print serialize(Suit::Hearts);
警告が発生し、&false; が返されます。
</para>

<simpara>
<function>unserialize</function> の
<literal>allowed_classes</literal> オプションは、
<link linkend="language.enumerations">列挙型(Enum)</link> には影響しません。
</simpara>

<para>
Pure Enum を JSON にシリアライズしようとすると、
Error がスローされます。
Expand All @@ -946,11 +971,14 @@ print serialize(Suit::Hearts);
<programlisting role="php">
<![CDATA[
<?php
enum Foo {

enum Foo
{
case Bar;
}

enum Baz: int {
enum Baz: int
{
case Beep = 5;
}

Expand Down Expand Up @@ -983,12 +1011,14 @@ Baz Enum:int {
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

class A {}
class B extends A {}

function foo(A $a) {}

function bar(B $b) {
function bar(B $b)
{
foo($b);
}
]]>
Expand All @@ -1007,7 +1037,9 @@ function bar(B $b) {
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php
enum ErrorCode {

enum ErrorCode
{
case SOMETHING_BROKE;
}

Expand All @@ -1034,13 +1066,16 @@ function quux(ErrorCode $errorCode)
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

// 列挙型が final でなかったと仮定した、思考実験のコード
// このコードは実際には動作しないので注意
enum MoreErrorCode extends ErrorCode {
enum MoreErrorCode extends ErrorCode
{
case PEBKAC;
}

function fot(MoreErrorCode $errorCode) {
function fot(MoreErrorCode $errorCode)
{
quux($errorCode);
}

Expand Down Expand Up @@ -1073,6 +1108,7 @@ fot(MoreErrorCode::PEBKAC);
<programlisting role="php" annotations="non-interactive">
<![CDATA[
<?php

enum SortOrder
{
case Asc;
Expand Down Expand Up @@ -1106,6 +1142,7 @@ function query($fields, $filter, SortOrder $order = SortOrder::Asc)
<programlisting role="php">
<![CDATA[
<?php

enum UserStatus: string
{
case Pending = 'P';
Expand All @@ -1115,7 +1152,7 @@ enum UserStatus: string

public function label(): string
{
return match($this) {
return match ($this) {
self::Pending => 'Pending',
self::Active => 'Active',
self::Suspended => 'Suspended',
Expand Down Expand Up @@ -1152,6 +1189,7 @@ var_dump($status->label());
<programlisting role="php">
<![CDATA[
<?php

enum UserStatus: string
{
case Pending = 'P';
Expand Down
4 changes: 3 additions & 1 deletion reference/datetime/dateinterval/createfromdatestring.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 9eb962113cadccc164d196003062ff5d893de3a5 Maintainer: takagi Status: ready -->
<!-- EN-Revision: 82f00c8d4d4f09fa5a363bc0c6f48e0c80eea72d Maintainer: takagi Status: ready -->
<!-- Credits: mumumu -->

<refentry xml:id="dateinterval.createfromdatestring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
Expand Down Expand Up @@ -90,6 +90,8 @@
仮の戻り値の型が、<type>DateInterval</type> になりました。
これより前のバージョンでは、<type class="union"><type>DateInterval</type><type>false</type></type> でした。
</entry>
</row>
<row>
<entry>8.3.0</entry>
<entry>
無効な文字列が渡された場合、
Expand Down
28 changes: 27 additions & 1 deletion reference/errorfunc/ini.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e5ff446c832aded712d45c885609ffdd277e6a49 Maintainer: hirokawa Status: ready -->
<!-- EN-Revision: c7b445ec851969e669026cfa483b104ea2de5d95 Maintainer: hirokawa Status: ready -->
<!-- CREDITS: takagi,mumumu -->
<section xml:id="errorfunc.configuration" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.runtime;
Expand All @@ -24,6 +24,14 @@
<entry><constant>INI_ALL</constant></entry>
<entry></entry>
</row>
<row>
<entry><link linkend="ini.fatal-error-backtraces">fatal_error_backtraces</link></entry>
<entry>"1"</entry>
<entry><constant>INI_ALL</constant></entry>
<entry>
PHP 8.5.0 以降で有効です。
</entry>
</row>
<row>
<entry><link linkend="ini.display-errors">display_errors</link></entry>
<entry>"1"</entry>
Expand Down Expand Up @@ -201,6 +209,24 @@
</note>
</listitem>
</varlistentry>

<varlistentry xml:id="ini.fatal-error-backtraces">
<term>
<parameter>fatal_error_backtraces</parameter>
<type>bool</type>
</term>
<listitem>
<simpara>
致命的なエラーにバックトレースを含めるかどうかを制御します。
致命的なエラーとは、<constant>E_ERROR</constant>、
<constant>E_CORE_ERROR</constant>、<constant>E_COMPILE_ERROR</constant>、
<constant>E_USER_ERROR</constant>、
<constant>E_RECOVERABLE_ERROR</constant>、および
<constant>E_PARSE</constant> のことです。
</simpara>
</listitem>
</varlistentry>

<varlistentry xml:id="ini.display-errors">
<term>
<parameter>display_errors</parameter>
Expand Down
Loading
Loading