Skip to content

`codekandis/types` is a library providing base types.

License

Notifications You must be signed in to change notification settings

codekandis/types

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codekandis/json-codec

Version License Minimum PHP Version Code Coverage

codekandis/types is a library providing base types, interfaces and classes.

Index

Installation

Install the latest version with

$ composer require codekandis/types

How to use

Type determination

The following examples show how to determine the type of a value with the TypeDeterminator. The parameter $native specifies if the determined type has to be as PHP's wrapped function gettype() returns it or if it has to be as strict as type hints.

$value = false;

( new TypeDeterminator() )
  ->determine( $value );
/**
 * boolean
 */

( new TypeDeterminator() )
  ->determine( $value, true );
/**
 * boolean
 */

( new TypeDeterminator() )
  ->determine( $value, false );
/**
 * bool
 */

$value = 42.42;

( new TypeDeterminator() )
  ->determine( $value );
/**
 * double
 */

( new TypeDeterminator() )
  ->determine( $value, true );
/**
 * double
 */

( new TypeDeterminator() )
  ->determine( $value, false );
/**
 * float
 */

About

`codekandis/types` is a library providing base types.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published