Skip to content

Commit

Permalink
Simplify context calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jul 19, 2019
1 parent 91c34dd commit 64e211c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions phpmd.xml
Expand Up @@ -26,6 +26,7 @@
</rule>
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml">
<exclude name="EvalExpression" />
<exclude name="CouplingBetweenObjects" />
</rule>
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
Expand Down
3 changes: 1 addition & 2 deletions src/Carbon/Traits/Macro.php
Expand Up @@ -165,8 +165,7 @@ protected static function loadMixinClass($mixin)

protected static function loadMixinTrait($trait)
{
$context = null;
eval('$context = new class() extends '.static::class.' {use '.$trait.';};');
$context = eval('return new class() extends '.static::class.' {use '.$trait.';};');
$className = get_class($context);
/** @var \ReflectionMethod[] $methods */
$methods = (new \ReflectionClass($className))->getMethods(\ReflectionMethod::IS_PUBLIC);
Expand Down

0 comments on commit 64e211c

Please sign in to comment.