Skip to content
Snippets Groups Projects

Issue #3495465: Drupal 11 + code standards update

Merged Stephen Mustgrave requested to merge issue/scanner-3495465:2.0.x into 2.0.x
Files
24
@@ -3,43 +3,27 @@
@@ -3,43 +3,27 @@
namespace Drupal\scanner\Controller;
namespace Drupal\scanner\Controller;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Datetime\DateFormatter;
use Drupal\Core\Database\Connection;
use Drupal\Core\Link;
use Drupal\Core\Url;
use Drupal\Core\Url;
 
use Drupal\Core\Link;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
 
use Drupal\Core\Datetime\DateFormatter;
 
use Drupal\Core\Database\Connection;
/**
/**
* Controller for Search and Replace module.
* Controller for Search and Replace module.
*/
*/
class ScannerController extends ControllerBase {
class ScannerController extends ControllerBase {
/**
* Drupal\Core\Datetime\DateFormatter.
*
* @var \Drupal\Core\Datetime\DateFormatter
*/
protected $dateFormatter;
/**
* Drupal\Core\Database\Connection.
*
* @var Drupal\Core\Database\Connection
*/
protected $database;
/**
/**
* Class constructor.
* Class constructor.
*/
*/
public function __construct(DateFormatter $dateFormatter, Connection $database) {
public function __construct(protected DateFormatter $dateFormatter, protected Connection $database) {
$this->dateFormatter = $dateFormatter;
$this->database = $database;
}
}
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public static function create(ContainerInterface $container) {
public static function create(ContainerInterface $container): static {
// Instantiates this form class.
// Instantiates this form class.
return new static(
return new static(
// Load the service required to construct this class.
// Load the service required to construct this class.
@@ -54,7 +38,7 @@ class ScannerController extends ControllerBase {
@@ -54,7 +38,7 @@ class ScannerController extends ControllerBase {
* @return array
* @return array
* A render array (table).
* A render array (table).
*/
*/
public function undoListing() {
public function undoListing(): array {
$query = $this->database->query('SELECT * from {scanner} WHERE undone = 0');
$query = $this->database->query('SELECT * from {scanner} WHERE undone = 0');
$results = $query->fetchAll();
$results = $query->fetchAll();
$header = [
$header = [
@@ -78,14 +62,12 @@ class ScannerController extends ControllerBase {
@@ -78,14 +62,12 @@ class ScannerController extends ControllerBase {
];
];
}
}
$table = [
return [
'#type' => 'table',
'#type' => 'table',
'#header' => $header,
'#header' => $header,
'#rows' => $rows,
'#rows' => $rows,
'#attributes' => NULL,
'#attributes' => NULL,
];
];
return $table;
}
}
}
}
Loading