Skip to content

Commit 398ef53

Browse files
Add #[Deprecated] to the PHP 8.4 polyfill
1 parent e85ab80 commit 398ef53

File tree

6 files changed

+31
-3
lines changed

6 files changed

+31
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Polyfills are provided for:
6868
- the `Date*Exception/Error` classes introduced in PHP 8.3;
6969
- the `SQLite3Exception` class introduced in PHP 8.3;
7070
- the `mb_ucfirst` and `mb_lcfirst` functions introduced in PHP 8.4;
71+
- the `Deprecated` attribute introduced in PHP 8.4;
7172

7273
It is strongly recommended to upgrade your PHP version and/or install the missing
7374
extensions whenever possible. This polyfill should be used only when there is no

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"src/Intl/Icu/Resources/stubs",
6565
"src/Intl/MessageFormatter/Resources/stubs",
6666
"src/Intl/Normalizer/Resources/stubs",
67+
"src/Php84/Resources/stubs",
6768
"src/Php83/Resources/stubs",
6869
"src/Php82/Resources/stubs",
6970
"src/Php81/Resources/stubs",

src/Php83/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=7.1",
20-
"symfony/polyfill-php80": "^1.14"
19+
"php": ">=7.1"
2120
},
2221
"autoload": {
2322
"psr-4": { "Symfony\\Polyfill\\Php83\\": "" },

src/Php84/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Symfony Polyfill / Php84
44
This component provides features added to PHP 8.4 core:
55

66
- [`mb_ucfirst` and `mb_lcfirst`](https://wiki.php.net/rfc/mb_ucfirst)
7+
- [`Deprecated`](https://wiki.php.net/rfc/deprecated_attribute)
78

89
More information can be found in the
910
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
if (\PHP_VERSION_ID < 80400) {
13+
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION | Attribute::TARGET_CLASS_CONSTANT)]
14+
final class Deprecated
15+
{
16+
public readonly ?string $message;
17+
public readonly ?string $since;
18+
19+
public function __construct(?string $message = null, ?string $since = null)
20+
{
21+
$this->message = $message;
22+
$this->since = $since;
23+
}
24+
}
25+
}

src/Php84/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
},
2121
"autoload": {
2222
"psr-4": { "Symfony\\Polyfill\\Php84\\": "" },
23-
"files": [ "bootstrap.php" ]
23+
"files": [ "bootstrap.php" ],
24+
"classmap": [ "Resources/stubs" ]
2425
},
2526
"minimum-stability": "dev",
2627
"extra": {

0 commit comments

Comments
 (0)