Skip to content

Commit

Permalink
Merge branch '6.0' into 6
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 13, 2025
2 parents b9bd8f7 + 2c8fbec commit baba2d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/Control/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\View\SSViewer;
use SilverStripe\View\TemplateEngine;
use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\Dev\Deprecation;

/**
* Controllers are the cornerstone of all site functionality in SilverStripe. The {@link Director}
Expand Down Expand Up @@ -534,6 +535,7 @@ public static function curr()
if (Controller::$controller_stack) {
return Controller::$controller_stack[0];
}
// This user_error() will be removed in the next major version of Silverstripe CMS
user_error("No current controller available", E_USER_WARNING);
return null;
}
Expand All @@ -543,9 +545,11 @@ public static function curr()
* controller in the stack.
*
* @return bool
* @deprecated 5.4.0 Will be removed without equivalent functionality to replace it
*/
public static function has_curr()
{
Deprecation::noticeWithNoReplacment('5.4.0');
return Controller::$controller_stack ? true : false;
}

Expand Down
6 changes: 3 additions & 3 deletions tests/php/Forms/GridField/GridFieldPrintButtonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use LogicException;
use ReflectionMethod;
use PHPUnit\Framework\Attributes\DataProvider;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\CSSContentParser;
Expand Down Expand Up @@ -98,7 +99,7 @@ public function testGeneratePrintData()
$this->assertSame($names, $foundNames);
}

public function provideHandlePrintEscaping(): array
public static function provideHandlePrintEscaping(): array
{
return [
// Without data columns component
Expand Down Expand Up @@ -193,9 +194,8 @@ public function provideHandlePrintEscaping(): array
* Explicitly tests that the following are both true:
* - XML entities are not double-escaped
* - XSS attack vectors are not introduced
*
* @dataProvider provideHandlePrintEscaping
*/
#[DataProvider('provideHandlePrintEscaping')]
public function testHandlePrintEscaping(string|DBField $value, bool $useGridFieldDataColumns, string $expected): void
{
$component = new GridFieldPrintButton();
Expand Down
6 changes: 2 additions & 4 deletions tests/php/ORM/DataObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2855,9 +2855,7 @@ public static function provideProvideI18nEntities(): array
];
}

/**
* @dataProvider provideProvideI18nEntities
*/
#[DataProvider('provideProvideI18nEntities')]
public function testProvideI18nEntities(?string $classDescription, bool $expected): void
{
$obj = new class extends DataObject {
Expand All @@ -2870,7 +2868,7 @@ public function plural_name()
{
return 'Clouds';
}
public function classDescription()
public function classDescription(): ?string
{
return $this->classDescription;
}
Expand Down

0 comments on commit baba2d8

Please sign in to comment.