Skip to content

Commit b655856

Browse files
saundefinedTimWolla
andcommitted
Apply suggestions from code review
Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
1 parent 6e7045f commit b655856

1 file changed

Lines changed: 33 additions & 19 deletions

File tree

releases/8.5/release.inc

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ final readonly class PhpVersion {
101101
}
102102
}
103103
104-
var_dump(new PhpVersion()->withVersion('PHP 8.5'));
104+
$version = new PhpVersion();
105+
106+
var_dump($version->version);
107+
// string(7) "PHP 8.4"
108+
109+
var_dump($version->withVersion('PHP 8.5')->version);
105110
// Fatal error: Uncaught Error: Cannot modify readonly property PhpVersion::$version
106111
PHP
107112

@@ -120,16 +125,22 @@ final readonly class PhpVersion {
120125
) {}
121126
122127
public function withVersion(string $version) {
123-
return clone($this, ['version' => $version]);
128+
return clone($this, [
129+
'version' => $version,
130+
]);
124131
}
125132
}
126133
127134
$version = new PhpVersion();
128135
129-
var_dump(
130-
$version->withVersion('PHP 8.5'),
131-
$version->version,
132-
);
136+
var_dump($version->version);
137+
// string(7) "PHP 8.4"
138+
139+
var_dump($version->withVersion('PHP 8.5')->version);
140+
// string(7) "PHP 8.5"
141+
142+
var_dump($version->version);
143+
// string(7) "PHP 8.4"
133144
PHP
134145
); ?>
135146
</div>
@@ -157,6 +168,9 @@ $output = strtolower(
157168
)
158169
)
159170
);
171+
172+
var_dump($output);
173+
// string(19) "some-kind-of-string"
160174
PHP
161175

162176
); ?>
@@ -175,6 +189,9 @@ $output = $input
175189
|> (fn (string $string) => str_replace(' ', '-', $string))
176190
|> (fn (string $string) => str_replace(['.', '/', '…'], '', $string))
177191
|> strtolower(...);
192+
193+
var_dump($output);
194+
// string(19) "some-kind-of-string"
178195
PHP
179196
); ?>
180197
</div>
@@ -193,7 +210,8 @@ PHP
193210
<div class="php8-code phpcode">
194211
<?php highlight_php_trimmed(
195212
<<<'PHP'
196-
function getPhpVersion(): string {
213+
function getPhpVersion(): string
214+
{
197215
return 'PHP 8.4';
198216
}
199217
@@ -210,8 +228,9 @@ PHP
210228
<?php highlight_php_trimmed(
211229
<<<'PHP'
212230
#[\NoDiscard]
213-
function getPhpVersion(): string {
214-
return 'PHP 8.4';
231+
function getPhpVersion(): string
232+
{
233+
return 'PHP 8.5';
215234
}
216235
217236
getPhpVersion();
@@ -276,7 +295,7 @@ final class CalculatorTest
276295
for ($i = -10; $i <= 10; $i++) {
277296
yield [$i, $i, 0];
278297
yield [$i, 0, $i];
279-
yield [0, $i, ($i * -1)];
298+
yield [0, $i, -$i];
280299
}
281300
})]
282301
public function testSubtraction(
@@ -322,9 +341,6 @@ curl_setopt($ch2, CURLOPT_SHARE, $sh);
322341
curl_exec($ch2);
323342
324343
curl_share_close($sh);
325-
326-
curl_close($ch1);
327-
curl_close($ch2);
328344
PHP
329345

330346
); ?>
@@ -348,9 +364,6 @@ curl_exec($ch1);
348364
$ch2 = curl_init('https://thephp.foundation/');
349365
curl_setopt($ch2, CURLOPT_SHARE, $sh);
350366
curl_exec($ch2);
351-
352-
curl_close($ch1);
353-
curl_close($ch2);
354367
PHP
355368
); ?>
356369
</div>
@@ -429,11 +442,12 @@ PHP
429442
<ul>
430443
<li>Property Promotion is now available for <code>final</code></li>
431444
<li>Attributes are now available for constants</li>
432-
<li>Attribute <code>#[\Override]</code> now works on properties</li>
433-
<li>Attribute <code>#[\Deprecated]</code> available for traits</li>
445+
<li>Attribute <a href="/manual/<?= $documentation ?>/class.override.php"><code>#[\Override]</code></a> now works on properties</li>
446+
<li>Attribute <a href="/manual/<?= $documentation ?>/class.deprecated.php"><code>#[\Deprecated]</code></a> available for traits</li>
434447
<li>Asymmetric Visibility for Static Properties</li>
435448
<li>New <code>#[\DelayedTargetValidation]</code> attribute is available</li>
436-
<li>New <code>get_error_handler()</code>, <code>get_exception_handler()</code> functions, and <code>Closure::getCurrent</code> method are available.</li>
449+
<li>New <a href="/manual/<?= $documentation ?>/function.get-error-handler.php"><code>get_error_handler()</code></a>, <a href="/manual/<?= $documentation ?>/function.get-exception-handler.php"><code>get_exception_handler()</code></a> functions are available.</li>
450+
<li>New <code>Closure::getCurrent</code> method is available.</li>
437451
<li>New <code>Dom\Element::getElementsByClassName()</code> and <code>Dom\Element::insertAdjacentHTML()</code> methods are available.</li>
438452
<li>New <code>enchant_dict_remove_from_session()</code> and <code>enchant_dict_remove()</code> functions are available.</li>
439453
<li>New <code>grapheme_levenshtein()</code> function is available.</li>

0 commit comments

Comments
 (0)