diff --git a/README.md b/README.md index f3bbe6a04..8e1067376 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ Polyfills are provided for: - the `SQLite3Exception` class introduced in PHP 8.3; - the `mb_ucfirst` and `mb_lcfirst` functions introduced in PHP 8.4; - the `array_find`, `array_find_key`, `array_any` and `array_all` functions introduced in PHP 8.4; +- the `Deprecated` attribute introduced in PHP 8.4; It is strongly recommended to upgrade your PHP version and/or install the missing extensions whenever possible. This polyfill should be used only when there is no diff --git a/composer.json b/composer.json index ee5e7180b..9a3012ed0 100644 --- a/composer.json +++ b/composer.json @@ -64,6 +64,7 @@ "src/Intl/Icu/Resources/stubs", "src/Intl/MessageFormatter/Resources/stubs", "src/Intl/Normalizer/Resources/stubs", + "src/Php84/Resources/stubs", "src/Php83/Resources/stubs", "src/Php82/Resources/stubs", "src/Php81/Resources/stubs", diff --git a/src/Php83/composer.json b/src/Php83/composer.json index a5fb4241d..02a0bf830 100644 --- a/src/Php83/composer.json +++ b/src/Php83/composer.json @@ -16,8 +16,7 @@ } ], "require": { - "php": ">=7.1", - "symfony/polyfill-php80": "^1.14" + "php": ">=7.1" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php83\\": "" }, diff --git a/src/Php84/README.md b/src/Php84/README.md index 443e3d1b9..96921439d 100644 --- a/src/Php84/README.md +++ b/src/Php84/README.md @@ -5,6 +5,7 @@ This component provides features added to PHP 8.4 core: - [`mb_ucfirst` and `mb_lcfirst`](https://wiki.php.net/rfc/mb_ucfirst) - [`array_find`, `array_find_key`, `array_any` and `array_all`](https://wiki.php.net/rfc/array_find) +- [`Deprecated`](https://wiki.php.net/rfc/deprecated_attribute) More information can be found in the [main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md). diff --git a/src/Php84/Resources/stubs/Deprecated.php b/src/Php84/Resources/stubs/Deprecated.php new file mode 100644 index 000000000..aa039e3e5 --- /dev/null +++ b/src/Php84/Resources/stubs/Deprecated.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +if (\PHP_VERSION_ID < 80400) { + #[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_FUNCTION | Attribute::TARGET_CLASS_CONSTANT)] + final class Deprecated + { + public readonly ?string $message; + public readonly ?string $since; + + public function __construct(?string $message = null, ?string $since = null) + { + $this->message = $message; + $this->since = $since; + } + } +} diff --git a/src/Php84/composer.json b/src/Php84/composer.json index 0819da716..9ceeee1be 100644 --- a/src/Php84/composer.json +++ b/src/Php84/composer.json @@ -20,7 +20,8 @@ }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php84\\": "" }, - "files": [ "bootstrap.php" ] + "files": [ "bootstrap.php" ], + "classmap": [ "Resources/stubs" ] }, "minimum-stability": "dev", "extra": {