Skip to content

Commit ebb6bf3

Browse files
Apply suggestions from code review
Co-authored-by: Tim Düsterhus <[email protected]>
1 parent 3846a53 commit ebb6bf3

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

releases/8.3/release.inc

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ PHP
101101

102102
<div class="php8-compare">
103103
<h2 class="php8-h2" id="override_attribute">
104-
<code>#[Override]</code> attribute
104+
<code>#[\Override]</code> attribute
105105
<a class="php8-rfc" href="https://wiki.php.net/rfc/marking_overriden_methods">RFC</a>
106106
</h2>
107107
<div class="php8-compare__main">
@@ -110,7 +110,26 @@ PHP
110110
<div class="php8-code phpcode">
111111
<?php highlight_php_trimmed(
112112
<<<'PHP'
113-
// TODO
113+
use PHPUnit\Framework\TestCase;
114+
115+
final class MyTest extends TestCase
116+
{
117+
protected $logFile;
118+
119+
protected function setUp(): void
120+
{
121+
$this->logFile = fopen('/tmp/logfile', 'w');
122+
}
123+
124+
protected function taerDown(): void
125+
{
126+
fclose($this->logFile);
127+
unlink('/tmp/logfile');
128+
}
129+
}
130+
131+
// The log file will never be removed, because the
132+
// method name was mistyped (taerDown vs tearDown).
114133
PHP
115134

116135
); ?>
@@ -123,7 +142,27 @@ PHP
123142
<?php highlight_php_trimmed(
124143
<<<'PHP'
125144
// TODO
126-
PHP
145+
use PHPUnit\Framework\TestCase;
146+
147+
final class MyTest extends TestCase
148+
{
149+
protected $logFile;
150+
151+
protected function setUp(): void
152+
{
153+
$this->logFile = fopen('/tmp/logfile', 'w');
154+
}
155+
156+
#[\Override]
157+
protected function taerDown(): void
158+
{
159+
fclose($this->logFile);
160+
unlink('/tmp/logfile');
161+
}
162+
}
163+
164+
// Fatal error: MyTest::taerDown() has #[\Override] attribute,
165+
// but no matching parent method exists
127166
); ?>
128167
</div>
129168
</div>

0 commit comments

Comments
 (0)