Download the PHP package ducks-project/spl-types without Composer
On this page you can find all versions of the php package ducks-project/spl-types. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ducks-project/spl-types
More information about ducks-project/spl-types
Files in ducks-project/spl-types
Package spl-types
Short Description Polyfill Module for SplType PHP extension. This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string
License MIT
Homepage https://github.com/ducks-project/spl-types/
Rated 5.00 based on 1 reviews
Informations about the package spl-types
SplTypes
- Project page: https://github.com/ducks-project/spl-types
- Repository: https://github.com/ducks-project/spl-types
- Original PHP extension: http://php.net/manual/en/intro.spl-types.php
Description
This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string
It provides classes unavailable if you can't install SPL Types extension:
Known Issues & Limitations
SplTypes
Because limitations of PHP it is impossible to directly reaffect Spl variables like the original extension. For example:
In the same way, Spl_Types polyfill is not really strict typing the extension. So, the code below is not "correct".
SplInt & Splfloat
Because of PHP behaviors you can't easily do operations like:
Unfortunately, you need to do like below:
SplEnum
As it was said, you need to manually cast your object to string in order to make comparison.
SplBool
Like it was explain above, the \SplBool object isn't a strict boolean so take care about your equality test.
License
This library is released under the MIT license.