Skip to content

v1.0.0-RC2

Pre-release
Pre-release

Choose a tag to compare

@SoloPHP SoloPHP released this 26 Oct 07:29
· 13 commits to main since this release
f64ce31

Second release candidate of Solo Input (solophp/input). It adds the built-in cast #[Cast('decimal')], which moving the first real application to RC1 called for: a number for a DECIMAL column, bcmath or a decimal library, written in plain decimal notation instead of the exponent notation PHP gives a small float.

This is a prerelease: the 1.0 API is being validated in real applications before the stable 1.0.0 tag.

Changes since 1.0.0-RC1

  • #[Cast('decimal')] on a string (or untyped / mixed) property writes a number in plain decimal notation: 0.00001 and '1e-5' as '0.00001', where the string cast gives '1.0E-5'. An int or a numeric string keeps every digit it has, and a float gives its shortest round-trip digits, so 0.1 stays '0.1'. "" is no value, as for int and float. Input that is no number, or a number a float overflows to infinity or rounds to zero although it is not zero, fails numeric. The schema reports such a field with cast: 'decimal'. See Type Casting → Decimal.
  • A property typed with a class named like a built-in cast (json, decimal) fails metadata building with ConfigurationException, like any class no input can produce, instead of being cast as that type.

Install

composer require 'solophp/input:^1.0@RC'

See the documentation and the full diff since RC1.