kenny1911/typed-properties-helper

Set of helper functions to working with typed class properties.

v1.0.1 2022-08-01 07:20 UTC

This package is auto-updated.

Last update: 2024-05-29 05:08:43 UTC


README

TypedPropertiesHelper is a set of helper function to working with typed class properties.

Installation

composer require kenny1911/typed-properties-helper

Usage

Check, that object property initialized:

use function Kenny1911\TypedProperties\is_initialized;

$obj = new class {
    public int $init = 123;
    public int $notInit;
};

is_initialized($obj, 'init');       // True
is_initialized($obj, 'notInit');    // False

Check, that object property typed:

use function Kenny1911\TypedProperties\is_typed;

$obj = new class {
    public int $typed;
    public $notTyped;
};

is_typed($obj, 'typed');        // True
is_typed($obj, 'notTyped');     // False