Skip to content

Instantly share code, notes, and snippets.

@SerafimArts
Created April 11, 2022 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SerafimArts/a2a8ffefb1e8bba026e882e16b8bab47 to your computer and use it in GitHub Desktop.
Save SerafimArts/a2a8ffefb1e8bba026e882e16b8bab47 to your computer and use it in GitHub Desktop.
phpwtf-2
<?php
class Example
{
public function __construct(
public ?string $value = null,
) {
}
}
/** @var Example $object */
$object = (new \ReflectionClass(Example::class))
->newInstanceWithoutConstructor();
echo $object->value; // Well, wut a happened?
// TL;DR; For example, Doctrine Hydrator may fail when promoted properties has been used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment