Skip to content

Commit

Permalink
Merge pull request #2 from preprocess/feature/new-sigil
Browse files Browse the repository at this point in the history
New sigil
  • Loading branch information
assertchris authored Sep 10, 2018
2 parents b1cf2bf + 59c5e64 commit 2dde04d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "pre/immutable-classes",
"license": "MIT",
"require": {
"pre/plugin": "^0.10.0"
"pre/plugin": "^0.11.0"
},
"autoload": {
"psr-4": {
Expand All @@ -14,6 +14,8 @@
"phpunit/phpunit": "^5.0|^6.0"
},
"extra": {
"macros": ["source/macros.yay"]
"macros": [
"source/macros.yay"
]
}
}
22 changes: 11 additions & 11 deletions source/macros.yay
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
<?php

macro {
immutable class ·ns()·class {
···body
$(macro) {
immutable class $(ns() as class) {
$(layer() as body)
}
} >> {
class ·class {
class $(class) {
use \Pre\ImmutableClasses\ImmutableClassesTrait;

···body
$(body)
}
}

macro ·unsafe {
function __call(···parameters) {
$(macro :unsafe) {
function __call($(layer() as parameters)) {
immutability;
···body
$(layer() as body)
}
} >> {
function __call(···parameters) {
if ($result = $this->handleCallImmutableClassSetters(···parameters)) {
function __call($(parameters)) {
if ($result = $this->handleCallImmutableClassSetters($(parameters))) {
return $result;
}

···body
$(body)
}
}

0 comments on commit 2dde04d

Please sign in to comment.