Skip to content

Instantly share code, notes, and snippets.

@SerafimArts
Last active November 21, 2016 12:38
Show Gist options
  • Save SerafimArts/3ec650844d546ec19acbeae5f519d26e to your computer and use it in GitHub Desktop.
Save SerafimArts/3ec650844d546ec19acbeae5f519d26e to your computer and use it in GitHub Desktop.
Yay! Example
<?php
@Some(a = 23, b = 42)
class TestClass
{
public function test($a)
{
}
}
<?php
macro ·global ·unsafe {
@·ns()·class(
·ls (
·chain (T_STRING·field, ·token('='), ·label()·value),
·token(',')
)
·fields
)
class T_STRING·class_name
} >> {
new class(new \ReflectionClass(T_STRING·class_name::class)) extends ·class {
public function __construct(\ReflectionClass $context)
{
·fields ··· {
$this->T_STRING·field = ·value;
}
}
}
class T_STRING·class_name
}
<?php
new class(new \ReflectionClass(TestClass::class)) extends Some {
public function __construct(\ReflectionClass $context)
{
$this->a = 23;
$this->b = 42;
}
}
class TestClass
{
public function test($a)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment