1. Go to this page and download the library: Download lisachenko/scalar-objects library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Lisachenko\ScalarObjects\Handler\NullHandler;
use Lisachenko\ScalarObjects\Registry;
use Lisachenko\ScalarObjects\ScalarType;
Registry::register(ScalarType::Null, NullHandler::class);
(null)->coalesce('fallback'); // "fallback"
use Lisachenko\ScalarObjects\TypeHandler;
final class ShoutHandler extends TypeHandler
{
public function shout(): string
{
return strtoupper((string) $this->value) . '!';
}
}
Registry::register(ScalarType::String, ShoutHandler::class);
"beep"->shout(); // "BEEP!"
use Lisachenko\ScalarObjects\AstRewriter;
AstRewriter::kip these even inside them