Skip to content

Commit 27d69bd

Browse files
committed
enumerations: Cleanup dangling line in description of backed cases
php/doc-en@2e5f291
1 parent 0575c44 commit 27d69bd

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

language/enumerations.xml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
3-
<!-- EN-Revision: 83e2056f071742c44d2b0bdbc8574d73697c7a08 Maintainer: mumumu Status: ready -->
3+
<!-- EN-Revision: 2e5f2910f3a2a95dcbdaf580ba57a0b60b072c2a Maintainer: mumumu Status: ready -->
44
<chapter xml:id="language.enumerations" xmlns="http://docbook.org/ns/docbook">
55
<title>列挙型(Enum)</title>
66
<sect1 xml:id="language.enumerations.overview">
@@ -230,10 +230,12 @@ enum Suit: string
230230
</para>
231231

232232
<para>
233-
スカラー値は、リテラルか、リテラルを表す式でなければいけません。
234-
定数や定数式はサポートしていません。
233+
スカラー値は、定数のスカラー式でなければいけません。
234+
PHP 8.2.0 より前のバージョンでは、
235+
スカラー値はリテラルか、リテラルを表す式でなければいけませんでした。
236+
これは、定数や定数式はサポートされていなかったことを意味します。
235237
つまり、<literal>1 + 1</literal> は許されますが、
236-
<literal>1 + SOME_CONST</literal> は許されません
238+
<literal>1 + SOME_CONST</literal> は許されていませんでした
237239
</para>
238240

239241
<para>
@@ -525,12 +527,12 @@ enum Size
525527
case Medium;
526528
case Large;
527529
528-
public static function fromLength(int $cm): static
530+
public static function fromLength(int $cm): self
529531
{
530532
return match(true) {
531-
$cm < 50 => static::Small,
532-
$cm < 100 => static::Medium,
533-
default => static::Large,
533+
$cm < 50 => self::Small,
534+
$cm < 100 => self::Medium,
535+
default => self::Large,
534536
};
535537
}
536538
}
@@ -586,7 +588,7 @@ enum Size
586588
注意すべきことは、列挙型で <literal>use</literal>
587589
されるトレイトには、プロパティが含まれていてはいけないという点です。
588590
<literal>use</literal> されるトレイトには、
589-
メソッドと static メソッドだけを含めることができます
591+
メソッドと static メソッドと、定数だけを含めることができます
590592
プロパティを持つトレイトの場合、致命的なエラーが発生します。
591593
</para>
592594

@@ -934,7 +936,7 @@ function quux(ErrorCode $errorCode)
934936
// 以下のようなコードを書くと、全ての case をカバーします
935937
match ($errorCode) {
936938
ErrorCode::SOMETHING_BROKE => true,
937-
}
939+
};
938940
}
939941
940942
?>
@@ -1042,10 +1044,10 @@ enum UserStatus: string
10421044
public function label(): string
10431045
{
10441046
return match($this) {
1045-
static::Pending => 'Pending',
1046-
static::Active => 'Active',
1047-
static::Suspended => 'Suspended',
1048-
static::CanceledByUser => 'Canceled by user',
1047+
self::Pending => 'Pending',
1048+
self::Active => 'Active',
1049+
self::Suspended => 'Suspended',
1050+
self::CanceledByUser => 'Canceled by user',
10491051
};
10501052
}
10511053
}

0 commit comments

Comments
 (0)