Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ phpunit.xml
.phpunit
vendor/
/tests/Io/Poll/phpt/*.php
/tests/Time/phpt/*.php
/tests/Time/phpt/methods/*.php
/tests/unicode
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Polyfills are provided for:
- the `SortDirection` enum introduced in PHP 8.6;
- the `grapheme_strrev` function introduced in PHP 8.6;
- the `Io\Poll` API and `StreamPollHandle` introduced in PHP 8.6 (requires PHP >= 8.1; only the `Poll` backend is available);
- the `Time\Duration` class introduced in PHP 8.6 (requires PHP >= 8.1);

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
Expand Down Expand Up @@ -173,6 +174,7 @@ should **not** `require` the `symfony/polyfill` package, but the standalone ones
- `symfony/polyfill-intl-normalizer` for using the intl normalizer,
- `symfony/polyfill-io-poll` for using the `Io\Poll` API and `StreamPollHandle`,
- `symfony/polyfill-mbstring` for using the mbstring functions,
- `symfony/polyfill-time` for using the `Time` API,
- `symfony/polyfill-util` for using the polyfill utility helpers.
- `symfony/polyfill-uuid` for using the `uuid_*` functions,

Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"symfony/polyfill-intl-normalizer": "self.version",
"symfony/polyfill-io-poll": "self.version",
"symfony/polyfill-mbstring": "self.version",
"symfony/polyfill-time": "self.version",
"symfony/polyfill-util": "self.version",
"symfony/polyfill-uuid": "self.version"
},
Expand All @@ -69,6 +70,7 @@
"src/Intl/MessageFormatter/Resources/stubs",
"src/Intl/Normalizer/Resources/stubs",
"src/Io/Poll/Resources/stubs",
"src/Time/Resources/stubs",
"src/Php86/Resources/stubs",
"src/Php85/Resources/stubs",
"src/Php84/Resources/stubs",
Expand Down
1 change: 1 addition & 0 deletions splitsh.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"polyfill-intl-messageformatter": "src/Intl/MessageFormatter",
"polyfill-intl-normalizer": "src/Intl/Normalizer",
"polyfill-mbstring": "src/Mbstring",
"polyfill-time": "src/Time",
"polyfill-util": "src/Util",
"polyfill-uuid": "src/Uuid"
},
Expand Down
19 changes: 19 additions & 0 deletions src/Time/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2026-present Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
21 changes: 21 additions & 0 deletions src/Time/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Symfony Polyfill / Time
=======================

This component provides the [`Time` API](https://wiki.php.net/rfc/duration_class)
added to PHP 8.6 core, for PHP >= 8.1:

- `Time\TimeException`, `Time\Duration`

The phpt tests of the native implementation, borrowed from php-src, run against
the polyfill as part of the test suite. One divergence remains: `Duration` is a
plain final class with readonly properties instead of a `readonly` class, so
`ReflectionClass::newInstanceWithoutConstructor()` succeeds where the native
class rejects it. Dynamic properties are rejected as they are natively.

More information can be found in the
[main Polyfill README](https://github.com/symfony/polyfill/blob/main/README.md).

License
=======

This library is released under the [MIT license](LICENSE).
Loading