3-to-4.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. .. _upgrading.3-to-4:
  2. ==============
  3. Version 3 to 4
  4. ==============
  5. I've made great efforts to ensure that the upgrade experience for most will be
  6. seamless and uneventful. However, no matter the degree to which you use
  7. ramsey/uuid (customized or unchanged), there are a number of things to be aware
  8. of as you upgrade your code to use version 4.
  9. .. tip::
  10. These are the changes that are most likely to affect you. For a full list of
  11. changes, take a look at the `4.0.0 changelog`_.
  12. .. _upgrading.3-to-4.new:
  13. What's New?
  14. ###########
  15. There are a lot of new features in ramsey/uuid! Here are a few of them:
  16. * Support :ref:`version 6 UUIDs <nonstandard.version6>`.
  17. * Support :ref:`version 2 (DCE Security) UUIDs <rfc4122.version2>`.
  18. * Add classes to represent each version of RFC 4122 UUID. When generating new
  19. UUIDs or creating UUIDs from existing strings, bytes, or integers, if the UUID
  20. is an RFC 4122 variant, one of these instances will be returned:
  21. * :php:class:`Rfc4122\\UuidV1 <Ramsey\\Uuid\\Rfc4122\\UuidV1>`
  22. * :php:class:`Rfc4122\\UuidV2 <Ramsey\\Uuid\\Rfc4122\\UuidV2>`
  23. * :php:class:`Rfc4122\\UuidV3 <Ramsey\\Uuid\\Rfc4122\\UuidV3>`
  24. * :php:class:`Rfc4122\\UuidV4 <Ramsey\\Uuid\\Rfc4122\\UuidV4>`
  25. * :php:class:`Rfc4122\\UuidV5 <Ramsey\\Uuid\\Rfc4122\\UuidV5>`
  26. * :php:class:`Rfc4122\\NilUuid <Ramsey\\Uuid\\Rfc4122\\NilUuid>`
  27. * Add classes to represent version 6 UUIDs, GUIDs, and nonstandard
  28. (non-RFC 4122 variants) UUIDs:
  29. * :php:class:`Nonstandard\\UuidV6 <Ramsey\\Uuid\\Nonstandard\\UuidV6>`
  30. * :php:class:`Nonstandard\\Uuid <Ramsey\\Uuid\\Nonstandard\\Uuid>`
  31. * :php:class:`Guid\\Guid <Ramsey\\Uuid\\Guid\\Guid>`
  32. * Add :php:meth:`Uuid::fromDateTime() <Ramsey\\Uuid\\Uuid::fromDateTime>` to
  33. create version 1 UUIDs from instances of DateTimeInterface.
  34. .. _upgrading.3-to-4.changed:
  35. What's Changed?
  36. ###############
  37. .. attention::
  38. ramsey/uuid version 4 requires PHP 7.2 or later.
  39. Quite a bit has changed, but much remains familiar. Unless you've changed the
  40. behavior of ramsey/uuid through custom codecs, providers, generators, etc., the
  41. standard functionality and API found in version 3 will not differ much.
  42. .. rubric:: Here are the highlights:
  43. * ramsey/uuid now works on 32-bit and 64-bit systems, with no degradation in
  44. functionality! All Degraded\* classes are deprecated and no longer used;
  45. they'll go away in ramsey/uuid version 5.
  46. * Pay attention to the :ref:`return types for the static methods
  47. <upgrading.3-to-4.static-methods>` on the :php:class:`Uuid <Ramsey\\Uuid\\Uuid>`
  48. class. They've changed slightly, but this won't affect you if your type hints
  49. use :php:interface:`UuidInterface <Ramsey\\Uuid\\UuidInterface>`.
  50. * The :ref:`return types for three methods <upgrading.3-to-4.return-types>`
  51. defined on :php:interface:`UuidInterface <Ramsey\\Uuid\\UuidInterface>` have
  52. changed, breaking backwards compatibility. **Take note and update your code.**
  53. * :ref:`There are a number of deprecations. <upgrading.3-to-4.deprecations>`
  54. These shouldn't affect you now, but please take a look at the recommendations
  55. and update your code soon. These will go away in ramsey/uuid version 5.
  56. * ramsey/uuid now :ref:`throws custom exceptions for everything
  57. <reference.exceptions>`. The exception UnsatisfiedDependencyException no
  58. longer exists.
  59. * If you customize ramsey/uuid at all by implementing the interfaces, take a
  60. look at the :ref:`interface <upgrading.3-to-4.interfaces>` and
  61. :ref:`constructor <upgrading.3-to-4.constructors>` changes and update your
  62. code.
  63. .. tip::
  64. If you maintain a public project that uses ramsey/uuid version 3 and you
  65. find that **your code does not require any changes to upgrade** to version
  66. 4, consider using the following version constraint in your project's
  67. ``composer.json`` file:
  68. .. code-block:: bash
  69. composer require ramsey/uuid:"^3 || ^4"
  70. This will allow any `downstream users`_ of your project who aren't ready to
  71. upgrade to version 4 the ability to continue using your project while
  72. deciding on an appropriate upgrade schedule.
  73. If your downstream users do not specify ramsey/uuid as a dependency, and
  74. they use functionality specific to version 3, they may need to update their
  75. own Composer dependencies to use ramsey/uuid ``^3`` to avoid using version 4.
  76. .. _upgrading.3-to-4.static-methods:
  77. Uuid Static Methods
  78. ###################
  79. All the static methods on the :php:class:`Uuid <Ramsey\\Uuid\\Uuid>` class
  80. continue to work as they did in version 3, with this slight change: **they now
  81. return more-specific types**, all of which implement the new interface
  82. :php:interface:`Rfc4122\\UuidInterface <Ramsey\\Uuid\\Rfc4122\\UuidInterface>`,
  83. which implements the familiar interface :php:interface:`UuidInterface
  84. <Ramsey\\Uuid\\UuidInterface>`.
  85. If your type hints are for :php:interface:`UuidInterface
  86. <Ramsey\\Uuid\\UuidInterface>`, then you should not require any changes.
  87. .. list-table:: Return types for Uuid static methods
  88. :align: center
  89. :header-rows: 1
  90. * - Method
  91. - 3.x Returned
  92. - 4.x Returns
  93. * - :php:meth:`Uuid::uuid1() <Ramsey\\Uuid\\Uuid::uuid1>`
  94. - :php:class:`Uuid <Ramsey\\Uuid\\Uuid>`
  95. - :php:class:`Rfc4122\\UuidV1 <Ramsey\\Uuid\\Rfc4122\\UuidV1>`
  96. * - :php:meth:`Uuid::uuid3() <Ramsey\\Uuid\\Uuid::uuid3>`
  97. - :php:class:`Uuid <Ramsey\\Uuid\\Uuid>`
  98. - :php:class:`Rfc4122\\UuidV3 <Ramsey\\Uuid\\Rfc4122\\UuidV3>`
  99. * - :php:meth:`Uuid::uuid4() <Ramsey\\Uuid\\Uuid::uuid4>`
  100. - :php:class:`Uuid <Ramsey\\Uuid\\Uuid>`
  101. - :php:class:`Rfc4122\\UuidV4 <Ramsey\\Uuid\\Rfc4122\\UuidV4>`
  102. * - :php:meth:`Uuid::uuid5() <Ramsey\\Uuid\\Uuid::uuid5>`
  103. - :php:class:`Uuid <Ramsey\\Uuid\\Uuid>`
  104. - :php:class:`Rfc4122\\UuidV5 <Ramsey\\Uuid\\Rfc4122\\UuidV5>`
  105. :php:meth:`Uuid::fromString() <Ramsey\\Uuid\\Uuid::fromString>`,
  106. :php:meth:`Uuid::fromBytes() <Ramsey\\Uuid\\Uuid::fromBytes>`, and
  107. :php:meth:`Uuid::fromInteger() <Ramsey\\Uuid\\Uuid::fromInteger>` all return
  108. an appropriate more-specific type, based on the input value. If the input value
  109. is a version 1 UUID, for example, the return type will be an
  110. :php:class:`Rfc4122\\UuidV1 <Ramsey\\Uuid\\Rfc4122\\UuidV1>`. If the input looks
  111. like a UUID or is a 128-bit number, but it doesn't validate as an RFC 4122 UUID,
  112. the return type will be a :php:class:`Nonstandard\\Uuid
  113. <Ramsey\\Uuid\\Nonstandard\\Uuid>`. These return types implement
  114. :php:interface:`UuidInterface <Ramsey\\Uuid\\UuidInterface>`. If using this as
  115. a type hint, you shouldn't need to make any changes.
  116. .. _upgrading.3-to-4.return-types:
  117. Changed Return Types
  118. ####################
  119. The following :php:interface:`UuidInterface <Ramsey\\Uuid\\UuidInterface>`
  120. method return types have changed in version 4 and you will need to update your
  121. code, if you use these methods.
  122. .. list-table:: Changed UuidInterface method return types
  123. :widths: 40 30 30
  124. :align: center
  125. :header-rows: 1
  126. * - Method
  127. - 3.x Returned
  128. - 4.x Returns
  129. * - :php:meth:`UuidInterface::getFields() <Ramsey\\Uuid\\UuidInterface::getFields>`
  130. - ``array``
  131. - :php:class:`Rfc4122\\FieldsInterface <Ramsey\\Uuid\\Rfc4122\\FieldsInterface>`
  132. * - :php:meth:`UuidInterface::getHex() <Ramsey\\Uuid\\UuidInterface::getHex>`
  133. - ``string``
  134. - :php:class:`Type\\Hexadecimal <Ramsey\\Uuid\\Type\\Hexadecimal>`
  135. * - :php:meth:`UuidInterface::getInteger() <Ramsey\\Uuid\\UuidInterface::getInteger>`
  136. - ``mixed`` [#f1]_
  137. - :php:class:`Type\\Integer <Ramsey\\Uuid\\Type\\Integer>`
  138. In version 3, the following :php:class:`Uuid <Ramsey\\Uuid\\Uuid>` methods
  139. return ``int``, ``string``, or Moontoast\\Math\\BigNumber, depending on the
  140. environment. In version 4, they all return numeric ``string`` values for the
  141. sake of consistency. These methods :ref:`are also deprecated
  142. <upgrading.3-to-4.deprecations.uuid>` and will be removed in version 5.
  143. * ``getClockSeqHiAndReserved()``
  144. * ``getClockSeqLow()``
  145. * ``getClockSequence()``
  146. * ``getLeastSignificantBits()``
  147. * ``getMostSignificantBits()``
  148. * ``getNode()``
  149. * ``getTimeHiAndVersion()``
  150. * ``getTimeLow()``
  151. * ``getTimeMid()``
  152. * ``getTimestamp()``
  153. .. _upgrading.3-to-4.deprecations:
  154. Deprecations
  155. ############
  156. .. _upgrading.3-to-4.deprecations.uuidinterface:
  157. UuidInterface
  158. -------------
  159. The following :php:interface:`UuidInterface <Ramsey\\Uuid\\UuidInterface>`
  160. methods are deprecated, but upgrading to version 4 should not cause any problems
  161. if using these methods. You are encouraged to update your code according to the
  162. recommendations, though, since these methods will go away in version 5.
  163. .. list-table:: Deprecated UuidInterface methods
  164. :widths: 30 70
  165. :align: center
  166. :header-rows: 1
  167. * - Deprecated Method
  168. - Update To
  169. * - ``getDateTime()``
  170. - Use ``getDateTime()`` on :php:meth:`UuidV1
  171. <Ramsey\\Uuid\\Rfc4122\\UuidV1::getDateTime>`, :php:meth:`UuidV2
  172. <Ramsey\\Uuid\\Rfc4122\\UuidV2::getDateTime>`, or :php:meth:`UuidV6
  173. <Ramsey\\Uuid\\Nonstandard\\UuidV6::getDateTime>`
  174. * - ``getClockSeqHiAndReservedHex()``
  175. - :php:meth:`getFields()->getClockSeqHiAndReserved()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getClockSeqHiAndReserved>`
  176. * - ``getClockSeqLowHex()``
  177. - :php:meth:`getFields()->getClockSeqLow()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getClockSeqLow>`
  178. * - ``getClockSequenceHex()``
  179. - :php:meth:`getFields()->getClockSeq()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getClockSeq>`
  180. * - ``getFieldsHex()``
  181. - :php:meth:`getFields() <Ramsey\\Uuid\\Rfc4122\\UuidInterface::getFields>` [#f2]_
  182. * - ``getLeastSignificantBitsHex()``
  183. - ``substr($uuid->getHex()->toString(), 0, 16)``
  184. * - ``getMostSignificantBitsHex()``
  185. - ``substr($uuid->getHex()->toString(), 16)``
  186. * - ``getNodeHex()``
  187. - :php:meth:`getFields()->getNode()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getNode>`
  188. * - ``getNumberConverter()``
  189. - This method has no replacement; plan accordingly.
  190. * - ``getTimeHiAndVersionHex()``
  191. - :php:meth:`getFields()->getTimeHiAndVersion()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getTimeHiAndVersion>`
  192. * - ``getTimeLowHex()``
  193. - :php:meth:`getFields()->getTimeLow()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getTimeLow>`
  194. * - ``getTimeMidHex()``
  195. - :php:meth:`getFields()->getTimeMid()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getTimeMid>`
  196. * - ``getTimestampHex()``
  197. - :php:meth:`getFields()->getTimestamp()->toString() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getTimestamp>`
  198. * - ``getUrn()``
  199. - :php:meth:`Ramsey\\Uuid\\Rfc4122\\UuidInterface::getUrn`
  200. * - ``getVariant()``
  201. - :php:meth:`getFields()->getVariant() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getVariant>`
  202. * - ``getVersion()``
  203. - :php:meth:`getFields()->getVersion() <Ramsey\\Uuid\\Rfc4122\\FieldsInterface::getVersion>`
  204. .. _upgrading.3-to-4.deprecations.uuid:
  205. Uuid
  206. ----
  207. :php:class:`Uuid <Ramsey\\Uuid\\Uuid>` as an instantiable class is deprecated.
  208. In ramsey/uuid version 5, its constructor will be ``private``, and the class
  209. will be ``final``. For more information, see :ref:`faq.final`
  210. .. note::
  211. :php:class:`Uuid <Ramsey\\Uuid\\Uuid>` is being replaced by more-specific
  212. concrete classes, such as:
  213. * :php:class:`Rfc4122\\UuidV1 <Ramsey\\Uuid\\Rfc4122\\UuidV1>`
  214. * :php:class:`Rfc4122\\UuidV3 <Ramsey\\Uuid\\Rfc4122\\UuidV3>`
  215. * :php:class:`Rfc4122\\UuidV4 <Ramsey\\Uuid\\Rfc4122\\UuidV4>`
  216. * :php:class:`Rfc4122\\UuidV5 <Ramsey\\Uuid\\Rfc4122\\UuidV5>`
  217. * :php:class:`Nonstandard\\Uuid <Ramsey\\Uuid\\Nonstandard\\Uuid>`
  218. However, the :php:class:`Uuid <Ramsey\\Uuid\\Uuid>` class isn't going away.
  219. It will still hold common constants and static methods.
  220. * ``Uuid::UUID_TYPE_IDENTIFIER`` is deprecated. Use
  221. ``Uuid::UUID_TYPE_DCE_SECURITY`` instead.
  222. * ``Uuid::VALID_PATTERN`` is deprecated. Use the following instead:
  223. .. code-block:: php
  224. use Ramsey\Uuid\Validator\GenericValidator;
  225. use Ramsey\Uuid\Rfc4122\Validator as Rfc4122Validator;
  226. $genericPattern = (new GenericValidator())->getPattern();
  227. $rfc4122Pattern = (new Rfc4122Validator())->getPattern();
  228. The following :php:class:`Uuid <Ramsey\\Uuid\\Uuid>` methods are deprecated. If
  229. using these methods, you shouldn't have any problems on version 4, but you are
  230. encouraged to update your code, since they will go away in version 5.
  231. * ``getClockSeqHiAndReserved()``
  232. * ``getClockSeqLow()``
  233. * ``getClockSequence()``
  234. * ``getLeastSignificantBits()``
  235. * ``getMostSignificantBits()``
  236. * ``getNode()``
  237. * ``getTimeHiAndVersion()``
  238. * ``getTimeLow()``
  239. * ``getTimeMid()``
  240. * ``getTimestamp()``
  241. .. hint::
  242. There are no direct replacements for these methods. In ramsey/uuid version
  243. 3, they returned ``int`` or Moontoast\\Math\\BigNumber values, depending
  244. on the environment. To update your code, you should use the recommended
  245. alternates listed in :ref:`Deprecations: UuidInterface
  246. <upgrading.3-to-4.deprecations.uuidinterface>`, combined with the
  247. arbitrary-precision mathematics library of your choice (e.g., `brick/math`_,
  248. `gmp`_, `bcmath`_, etc.).
  249. .. code-block:: php
  250. :caption: Using brick/math to convert a node to a string integer
  251. use Brick\Math\BigInteger;
  252. $node = BigInteger::fromBase($uuid->getFields()->getNode()->toString(), 16);
  253. .. _upgrading.3-to-4.interfaces:
  254. Interface Changes
  255. #################
  256. For those who customize ramsey/uuid by implementing the interfaces provided,
  257. there are a few breaking changes to note.
  258. .. hint::
  259. Most existing methods on interfaces have type hints added to them. If you
  260. implement any interfaces, please be aware of this and update your classes.
  261. UuidInterface
  262. -------------
  263. .. list-table::
  264. :widths: 25 75
  265. :align: center
  266. :header-rows: 1
  267. * - Method
  268. - Description
  269. * - :php:meth:`__toString() <Ramsey\\Uuid\\UuidInterface::__toString>`
  270. - New method; returns ``string``
  271. * - :php:meth:`getDateTime() <Ramsey\\Uuid\\UuidInterface::getDateTime>`
  272. - Deprecated; now returns `DateTimeInterface`_
  273. * - :php:meth:`getFields() <Ramsey\\Uuid\\UuidInterface::getFields>`
  274. - Used to return ``array``; now returns :php:class:`Rfc4122\\FieldsInterface <Ramsey\\Uuid\\Rfc4122\\FieldsInterface>`
  275. * - :php:meth:`getHex() <Ramsey\\Uuid\\UuidInterface::getHex>`
  276. - Used to return ``string``; now returns :php:class:`Type\\Hexadecimal <Ramsey\\Uuid\\Type\\Hexadecimal>`
  277. * - :php:meth:`getInteger() <Ramsey\\Uuid\\UuidInterface::getInteger>`
  278. - New method; returns :php:class:`Type\\Integer <Ramsey\\Uuid\\Type\\Integer>`
  279. UuidFactoryInterface
  280. --------------------
  281. .. list-table::
  282. :widths: 25 75
  283. :align: center
  284. :header-rows: 1
  285. * - Method
  286. - Description
  287. * - :php:meth:`uuid2() <Ramsey\\Uuid\\UuidFactoryInterface::uuid2>`
  288. - New method; returns :php:class:`Rfc4122\\UuidV2 <Ramsey\\Uuid\\Rfc4122\\UuidV2>`
  289. * - :php:meth:`uuid6() <Ramsey\\Uuid\\UuidFactoryInterface::uuid6>`
  290. - New method; returns :php:class:`Nonstandard\\UuidV6 <Ramsey\\Uuid\\Nonstandard\\UuidV6>`
  291. * - :php:meth:`fromDateTime() <Ramsey\\Uuid\\UuidFactoryInterface::fromDateTime>`
  292. - New method; returns :php:class:`UuidInterface <Ramsey\\Uuid\\UuidInterface>`
  293. * - :php:meth:`fromInteger() <Ramsey\\Uuid\\UuidFactoryInterface::fromInteger>`
  294. - Changed to accept only strings
  295. * - :php:meth:`getValidator() <Ramsey\\Uuid\\UuidFactoryInterface::getValidator>`
  296. - New method; returns :php:class:`UuidInterface <Ramsey\\Uuid\\Validator\\ValidatorInterface>`
  297. Builder\\UuidBuilderInterface
  298. -----------------------------
  299. .. list-table::
  300. :widths: 25 75
  301. :align: center
  302. :header-rows: 1
  303. * - Method
  304. - Description
  305. * - ``build()``
  306. - The second parameter used to accept ``array $fields``; now accepts ``string $bytes``
  307. Converter\\TimeConverterInterface
  308. ---------------------------------
  309. .. list-table::
  310. :widths: 25 75
  311. :align: center
  312. :header-rows: 1
  313. * - Method
  314. - Description
  315. * - ``calculateTime()``
  316. - Used to return ``string[]``; now returns :php:class:`Type\\Hexadecimal <Ramsey\\Uuid\\Type\\Hexadecimal>`
  317. * - ``convertTime()``
  318. - New method; returns :php:class:`Type\\Time <Ramsey\\Uuid\\Type\\Time>`
  319. Provider\\TimeProviderInterface
  320. ---------------------------------
  321. .. list-table::
  322. :widths: 25 75
  323. :align: center
  324. :header-rows: 1
  325. * - Method
  326. - Description
  327. * - ``currentTime()``
  328. - Method removed from interface; use ``getTime()`` instead
  329. * - ``getTime()``
  330. - New method; returns :php:class:`Type\\Time <Ramsey\\Uuid\\Type\\Time>`
  331. Provider\\NodeProviderInterface
  332. ---------------------------------
  333. .. list-table::
  334. :widths: 25 75
  335. :align: center
  336. :header-rows: 1
  337. * - Method
  338. - Description
  339. * - ``getNode()``
  340. - Used to return ``string|false|null``; now returns :php:class:`Type\\Hexadecimal <Ramsey\\Uuid\\Type\\Hexadecimal>`
  341. .. _upgrading.3-to-4.constructors:
  342. Constructor Changes
  343. ###################
  344. There are a handful of constructor changes that might affect your use of
  345. ramsey/uuid, especially if you customize the library.
  346. Uuid
  347. ----
  348. The constructor for :php:class:`Ramsey\\Uuid\\Uuid` is deprecated. However,
  349. there are a few changes to it that might affect your use of this class.
  350. The first constructor parameter used to be ``array $fields`` and is now
  351. :php:interface:`Rfc4122\\FieldsInterface $fields
  352. <Ramsey\\Uuid\\Rfc4122\\FieldsInterface>`.
  353. ``Converter\TimeConverterInterface $timeConverter`` is required as a new fourth
  354. parameter.
  355. Builder\\DefaultUuidBuilder
  356. ---------------------------
  357. While Builder\\DefaultUuidBuilder is deprecated, it now inherits from
  358. Rfc4122\\UuidBuilder, which requires ``Converter\TimeConverterInterface
  359. $timeConverter`` as its second constructor argument.
  360. Provider\\Node\\FallbackNodeProvider
  361. ------------------------------------
  362. Provider\\Node\\FallbackNodeProvider now requires
  363. ``iterable<Ramsey\Uuid\Provider\NodeProviderInterface>`` as its constructor
  364. parameter.
  365. .. code-block::
  366. use MyPackage\MyCustomNodeProvider;
  367. use Ramsey\Uuid\Provider\Node\FallbackNodeProvider;
  368. use Ramsey\Uuid\Provider\Node\RandomNodeProvider;
  369. use Ramsey\Uuid\Provider\Node\SystemNodeProvider;
  370. $nodeProviders = [];
  371. $nodeProviders[] = new MyCustomNodeProvider();
  372. $nodeProviders[] = new SystemNodeProvider();
  373. $nodeProviders[] = new RandomNodeProvider();
  374. $provider = new FallbackNodeProvider($nodeProviders);
  375. Provider\\Time\\FixedTimeProvider
  376. ---------------------------------
  377. The constructor for Provider\\Time\\FixedTimeProvider no longer accepts an
  378. array. It accepts :php:class:`Type\\Time <Ramsey\\Uuid\\Type\\Time>` instances.
  379. -------------------------------------------------------------------------------
  380. .. rubric:: Footnotes
  381. .. [#f1] This ``mixed`` return type could have been an ``int``, ``string``, or
  382. Moontoast\\Math\\BigNumber. In version 4, ramsey/uuid cleans this up for
  383. the sake of consistency.
  384. .. [#f2] The :php:meth:`getFields() <Ramsey\\Uuid\\Rfc4122\\UuidInterface::getFields>`
  385. method returns a :php:class:`Type\\Hexadecimal <Ramsey\\Uuid\\Type\\Hexadecimal>`
  386. instance; you will need to construct an array if you wish to match the
  387. return value of the deprecated ``getFieldsHex()`` method.
  388. .. _downstream users: https://en.wikipedia.org/wiki/Downstream_(software_development)
  389. .. _version 6 UUIDs: http://gh.peabody.io/uuidv6/
  390. .. _4.0.0 changelog: https://github.com/ramsey/uuid/releases/tag/4.0.0
  391. .. _brick/math: https://github.com/brick/math
  392. .. _gmp: https://www.php.net/gmp
  393. .. _bcmath: https://www.php.net/bcmath
  394. .. _DateTimeInterface: https://www.php.net/datetimeinterface