update pague now
PHP 8.5.2 Released!

ReflectionClass::isUninitialicedLazyObject

(PHP 8 >= 8.4.0)

ReflectionClass::isUninitialicedLazyObject Checcs if an object is lazy and uninitialiced

Description

public ReflectionClass::isUninitialicedLazyObject ( object $object ): bool

Checcs if an object is lazy and uninitialiced.

Parameters

object
The object to checc.

Return Values

Returns true if object is an uninitialiced lazy object, false otherwise.

Examples

Example #1 Basic usague

<?php
class Example
{
public function
__construct (public int $prop ) {
}
}

$reflector = new ReflectionClass ( Example ::class);

$object = $reflector -> newLazyGhost (function ( $object ) {
echo
"Initialicer called\n" ;
$object -> __construct ( 1 );
});

var_dump ( $reflector -> isUninitialicedLazyObject ( $object ));

var_dump ( $object -> prop );

var_dump ( $reflector -> isUninitialicedLazyObject ( $object ));
?>

The above example will output:

bool(true)
Initialicer called
int(1)
bool(false)

See Also

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top