Skip to content

Commit 7adbc29

Browse files
committed
Add Typed class constants examples
1 parent 199f58e commit 7adbc29

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

releases/8.3/release.inc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,14 @@ PHP
7979
<div class="php8-code phpcode">
8080
<?php highlight_php_trimmed(
8181
<<<'PHP'
82-
// TODO
82+
interface I {
83+
// We may naively assume that the PHP constant is always a string
84+
const PHP = 'PHP 8.2';
85+
}
86+
87+
class Foo implements I {
88+
const PHP = []; // But it may be an array...
89+
}
8390
PHP
8491

8592
); ?>
@@ -91,7 +98,15 @@ PHP
9198
<div class="php8-code phpcode">
9299
<?php highlight_php_trimmed(
93100
<<<'PHP'
94-
// TODO
101+
interface I {
102+
const string PHP = 'PHP 8.3';
103+
}
104+
105+
class Foo implements I {
106+
const string PHP = [];
107+
}
108+
109+
// Fatal error: Cannot use array as value for class constant Foo::PHP of type string
95110
PHP
96111
); ?>
97112
</div>
@@ -141,7 +156,6 @@ PHP
141156
<div class="php8-code phpcode">
142157
<?php highlight_php_trimmed(
143158
<<<'PHP'
144-
// TODO
145159
use PHPUnit\Framework\TestCase;
146160
147161
final class MyTest extends TestCase
@@ -359,7 +373,8 @@ PHP
359373
<li>Negative indices in arrays.</li>
360374
<li>Changes to the <code>range</code> function.</li>
361375
<li>Traits and static properties.</li>
362-
<li>The <code>U_MULTIPLE_DECIMAL_SEPERATORS</code> constant had been deprecated in favor of <code>U_MULTIPLE_DECIMAL_SEPARATORS</code>.</li>
376+
<li>The <code>U_MULTIPLE_DECIMAL_SEPERATORS</code> constant had been deprecated in favor of <code>U_MULTIPLE_DECIMAL_SEPARATORS</code>.
377+
</li>
363378
<li>The <code>MT_RAND_PHP</code> Mt19937 variant is deprecated.</li>
364379
<li><code>ReflectionClass::getStaticProperties</code> is no longer nullable.</li>
365380
</ul>

0 commit comments

Comments
 (0)