Skip to content

Commit

Permalink
ENH Add generic types
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 11, 2024
1 parent 67e0e1c commit 0cbd9ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/ErrorPageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

/**
* Controller for ErrorPages.
*
* @extends PageController<ErrorPage>
*/
class ErrorPageController extends PageController
{
Expand All @@ -30,7 +32,6 @@ protected function init()
*/
public function handleRequest(HTTPRequest $request): HTTPResponse
{
/** @var ErrorPage $page */
$page = $this->data();
$response = parent::handleRequest($request);
$response->setStatusCode($page->ErrorCode);
Expand Down
4 changes: 3 additions & 1 deletion src/ErrorPageControllerExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Core\Extension;
use SilverStripe\Forms\Form;

/**
* Enhances error handling for a controller with ErrorPage generated output
*
* @extends Extension<Controller|Form>
*/
class ErrorPageControllerExtension extends Extension
{

/**
* Used by {@see RequestHandler::httpError}
*
Expand Down
4 changes: 3 additions & 1 deletion src/ErrorPageFileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

namespace SilverStripe\ErrorPage;

use SilverStripe\Assets\Shortcodes\FileShortcodeProvider;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;

/**
* Decorates {@see File} with ErrorPage support
*
* @extends DataExtension<FileShortcodeProvider>
*/
class ErrorPageFileExtension extends DataExtension
{

/**
* Used by {@see File::handle_shortcode}
*
Expand Down

0 comments on commit 0cbd9ab

Please sign in to comment.