Skip to content

Commit

Permalink
Fixed bug where dice was triggering the autoloader with lowercase name
Browse files Browse the repository at this point in the history
  • Loading branch information
TRPB committed Oct 13, 2015
1 parent c6b68a8 commit 53ca10c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dice.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public function addRule($name, array $rule) {
}

public function getRule($name) {
if (isset($this->rules[strtolower(ltrim($name, '\\'))])) return $this->rules[strtolower(ltrim($name, '\\'))];
$lcName = strtolower(ltrim($name, '\\'));
if (isset($this->rules[$lcName])) return $this->rules[$lcName];

foreach ($this->rules as $key => $rule) {
if (empty($rule['instanceOf']) && $key !== '*' && is_subclass_of($name, $key) && (empty($rule['inherit']) || $rule['inherit'] === true )) return $rule;
}
Expand Down

0 comments on commit 53ca10c

Please sign in to comment.