Skip to content

Commit

Permalink
FIX Call defineMethods if lower method is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 21, 2024
1 parent ba97de9 commit ba5f55e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Core/CustomMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,14 @@ protected function getExtraMethodConfig($method)
}
// Lazy define methods
$lowerClass = strtolower(static::class);
if (!isset(self::class::$extra_methods[$lowerClass])) {
$lowerMethod = strtolower($method);
if (!array_key_exists($lowerClass, self::class::$extra_methods)
|| !array_key_exists($lowerMethod, self::class::$extra_methods[$lowerClass])
) {
$this->defineMethods();
}

return self::class::$extra_methods[$lowerClass][strtolower($method)] ?? null;
return self::class::$extra_methods[$lowerClass][$lowerMethod] ?? null;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Dev/DeprecationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testNoticeNoReplacement()
'Will be removed without equivalent functionality to replace it.',
'Called from SilverStripe\Dev\Tests\DeprecationTest->testNoticeNoReplacement.'
]);
$this->expectDeprecation();
$this->expectException(DeprecationTestException::class);
$this->expectDeprecationMessage($message);
$this->enableDeprecationNotices(true);
$ret = $this->myDeprecatedMethodNoReplacement();
Expand Down

0 comments on commit ba5f55e

Please sign in to comment.