-
Notifications
You must be signed in to change notification settings - Fork 589
[WIP] PHP 8.5 release page #1454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🚀 Regression report for commit 55be0cb is at https://web-php-regression-report-pr-1454.preview.thephp.foundation |
🚀 Preview for commit 55be0cb can be found at https://web-php-pr-1454.preview.thephp.foundation |
releases/8.5/release.inc
Outdated
$versions = ['PHP 8.1', 'PHP 8.2', 'PHP 8.3', 'PHP 8.4', 'PHP 8.5']; | ||
var_dump($versions[array_key_first($versions)]); | ||
// string(7) "PHP 8.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this example too simple to be useful, especially because $versions[0]
works for a list
. Perhaps we can find something with an associative array?
Co-authored-by: Tim Düsterhus <[email protected]>
$upcomingRelease = null; | ||
foreach ($php as $key => $version) { | ||
if ($version['state'] === 'upcoming') { | ||
$upcomingRelease = $version; | ||
break; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a good example, because this could just be array_find()
.
$upcomingRelease = array_first( | ||
array_filter( | ||
$php, | ||
static fn($version) => $version['state'] === 'upcoming' | ||
) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
<div class="php8-compare__main"> | ||
<div class="php8-compare__block example-contents"> | ||
<div class="php8-compare__label">PHP < 8.5</div> | ||
<div class="php8-code phpcode"> | ||
<?php highlight_php_trimmed( | ||
<<<'PHP' | ||
$sh = curl_share_init(); | ||
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); | ||
curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); | ||
|
||
$ch1 = curl_init('https://php.net/'); | ||
curl_setopt($ch1, CURLOPT_SHARE, $sh); | ||
curl_exec($ch1); | ||
|
||
$ch2 = curl_init('https://thephp.foundation/'); | ||
curl_setopt($ch2, CURLOPT_SHARE, $sh); | ||
curl_exec($ch2); | ||
|
||
curl_share_close($sh); | ||
|
||
curl_close($ch1); | ||
curl_close($ch2); | ||
PHP | ||
|
||
); ?> | ||
</div> | ||
</div> | ||
<div class="php8-compare__arrow"></div> | ||
<div class="php8-compare__block example-contents" style="display: table;"> | ||
<div class="php8-compare__label php8-compare__label_new">PHP 8.5</div> | ||
<div class="php8-code phpcode" style="display: table-cell;"> | ||
<?php highlight_php_trimmed( | ||
<<<'PHP' | ||
$sh = curl_share_init_persistent([ | ||
CURL_LOCK_DATA_DNS, | ||
CURL_LOCK_DATA_CONNECT | ||
]); | ||
|
||
$ch1 = curl_init('https://php.net/'); | ||
curl_setopt($ch1, CURLOPT_SHARE, $sh); | ||
curl_exec($ch1); | ||
|
||
$ch2 = curl_init('https://thephp.foundation/'); | ||
curl_setopt($ch2, CURLOPT_SHARE, $sh); | ||
curl_exec($ch2); | ||
|
||
curl_close($ch1); | ||
curl_close($ch2); | ||
PHP | ||
); ?> | ||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison is not really meaningful to understand what has changed. At least some explanation is necessary. curl_close()
should be removed in all cases, since it is useless with 8.0 and deprecated with 8.5.
#[DataProvider('subtractionProvider')] | ||
public function testSubtraction( | ||
int $minuend, | ||
int $subtrahend, | ||
int $result | ||
): void | ||
{ | ||
$this->assertSame( | ||
$result, | ||
Calculator::subtract($minuend, $subtrahend) | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be kept in sync with the 8.5 version. Unfortunately the 8.5 version can't yet use PHPUnit, since sebastianbergmann/phpunit#6136 is not implemented yet. So both should use some “generic test framework”.
Co-authored-by: Tim Düsterhus <[email protected]>
releases/8.5/release.inc
Outdated
|> (fn (string $string) => str_replace(' ', '-', $string)) | ||
|> (fn (string $string) => str_replace(['.', '/', '…'], '', $string)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|> (fn (string $string) => str_replace(' ', '-', $string)) | |
|> (fn (string $string) => str_replace(['.', '/', '…'], '', $string)) | |
|> (fn($string) => str_replace(' ', '-', $string)) | |
|> (fn($string) => str_replace(['.', '/', '…'], '', $string)) |
No space after fn
for PER-CS. Removed the type, because it seems unlikely for folks to add an explict type in pipes, which will also shorten the line.
/cc @Crell
Co-authored-by: Tim Düsterhus <[email protected]>
'url_parsing_api_title' => 'Add RFC 3986 and WHATWG URL compliant API', | ||
'url_parsing_api_description' => '<code>Uri\UriException</code>, <code>Uri\InvalidUriException</code>, <code>Uri\UriComparisonMode</code>, | ||
<code>Uri\Rfc3986\Uri</code>, <code>Uri\WhatWg\InvalidUrlException</code>, <code>Uri\WhatWg\UrlValidationErrorType</code>, <code>Uri\WhatWg\UrlValidationError</code>, and <code>Uri\WhatWg\Url</code> are now available.', | ||
'clone_with_title' => 'Clone with v2', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'clone_with_title' => 'Clone with v2', | |
'clone_with_title' => 'Clone With', |
I don't think we need the v2 here, since this is intended for the end user, not the folks who actually read RFCs 😀
'main_subtitle' => 'PHP 8.5 is a major update of the PHP language.<br class="display-none-md"> It contains many new features, such as the new URI extension, support for modifying properties while cloning, the Pipe operator, performance improvements, bug fixes, and general cleanup.', | ||
'upgrade_now' => 'Upgrade to PHP 8.5 now!', | ||
|
||
'pipe_operator_title' => 'Pipe operator', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'pipe_operator_title' => 'Pipe operator', | |
'pipe_operator_title' => 'Pipe Operator', |
'upgrade_now' => 'Upgrade to PHP 8.5 now!', | ||
|
||
'pipe_operator_title' => 'Pipe operator', | ||
'url_parsing_api_title' => 'Add RFC 3986 and WHATWG URL compliant API', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'url_parsing_api_title' => 'Add RFC 3986 and WHATWG URL compliant API', | |
'url_parsing_api_title' => 'New URI Extension', |
'url_parsing_api_description' => '<code>Uri\UriException</code>, <code>Uri\InvalidUriException</code>, <code>Uri\UriComparisonMode</code>, | ||
<code>Uri\Rfc3986\Uri</code>, <code>Uri\WhatWg\InvalidUrlException</code>, <code>Uri\WhatWg\UrlValidationErrorType</code>, <code>Uri\WhatWg\UrlValidationError</code>, and <code>Uri\WhatWg\Url</code> are now available.', | ||
'clone_with_title' => 'Clone with v2', | ||
'no_discard_title' => 'New <code>#[\NoDiscard]</code> Attribute', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'no_discard_title' => 'New <code>#[\NoDiscard]</code> Attribute', | |
'no_discard_title' => '<code>#[\NoDiscard]</code> Attribute', |
'clone_with_title' => 'Clone with v2', | ||
'no_discard_title' => 'New <code>#[\NoDiscard]</code> Attribute', | ||
'fcc_in_const_expr_title' => 'First Class Callables in constant expressions', | ||
'curl_share_persistence_improvement_title' => 'Persistent cURL share handle improvement', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'curl_share_persistence_improvement_title' => 'Persistent cURL share handle improvement', | |
'curl_share_persistence_improvement_title' => 'Persistent cURL Share Handles', |
<code>Uri\Rfc3986\Uri</code>, <code>Uri\WhatWg\InvalidUrlException</code>, <code>Uri\WhatWg\UrlValidationErrorType</code>, <code>Uri\WhatWg\UrlValidationError</code>, and <code>Uri\WhatWg\Url</code> are now available.', | ||
'clone_with_title' => 'Clone with v2', | ||
'no_discard_title' => 'New <code>#[\NoDiscard]</code> Attribute', | ||
'fcc_in_const_expr_title' => 'First Class Callables in constant expressions', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'fcc_in_const_expr_title' => 'First Class Callables in constant expressions', | |
'fcc_in_const_expr_title' => 'Closures and First Class Callables in Constant Expressions', |
</div> | ||
</div> | ||
<div class="php8-compare__content"> | ||
<?= message('url_parsing_api_description', $lang) ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an always-available part of PHP's standard library the new URI extension provides APIs to parse and modify URIs and URLs according to the RFC 3986 and the WHATWG URL standards.
The secure and standards-compliant URI parsing is powered by the uriparser (RFC 3986) and Lexbor (WHATWG URL) libraries.
|
||
<div class="php8-compare"> | ||
<h2 class="php8-h2" id="clone_with"> | ||
<?= message('clone_with_title', $lang) ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description:
It is not possible to update properties during object cloning by passing an associative array with the updated to the
clone()
function. This enables straight-forward support of the "with-er" pattern forreadonly
classes.
|
||
<div class="php8-compare"> | ||
<h2 class="php8-h2" id="no_discard"> | ||
<?= message('no_discard_title', $lang) ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description:
By adding the
#[\NoDiscard]
attribute to a function, PHP will check whether the returned value is consumed and emit a warning if it is not. This allows to improve the safety of APIs where the returned value is important, but where it is easy to forget using the return value by accident.The associated
(void)
cast can be used to indicate that a value is intentionally unused.
Preview: https://web-php-pr-1454.preview.thephp.foundation/releases/8.5/en.php