Use more return types for some plugin classes
I did not change getters because I am unsure about the non initialized properties Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
parent
5ae6f1e16b
commit
b4e8fd4f97
@ -52,8 +52,8 @@ class DiaRelationSchema extends ExportRelationSchema
|
||||
|
||||
$this->setShowColor(isset($_REQUEST['dia_show_color']));
|
||||
$this->setShowKeys(isset($_REQUEST['dia_show_keys']));
|
||||
$this->setOrientation($_REQUEST['dia_orientation']);
|
||||
$this->setPaper($_REQUEST['dia_paper']);
|
||||
$this->setOrientation((string) $_REQUEST['dia_orientation']);
|
||||
$this->setPaper((string) $_REQUEST['dia_paper']);
|
||||
|
||||
$this->diagram->startDiaDoc(
|
||||
$this->paper,
|
||||
|
||||
@ -53,7 +53,7 @@ class EpsRelationSchema extends ExportRelationSchema
|
||||
$this->setShowKeys(isset($_REQUEST['eps_show_keys']));
|
||||
$this->setTableDimension(isset($_REQUEST['eps_show_table_dimension']));
|
||||
$this->setAllTablesSameWidth(isset($_REQUEST['eps_all_tables_same_width']));
|
||||
$this->setOrientation($_REQUEST['eps_orientation']);
|
||||
$this->setOrientation((string) $_REQUEST['eps_orientation']);
|
||||
|
||||
$this->diagram->setTitle(
|
||||
sprintf(
|
||||
|
||||
@ -11,7 +11,6 @@ use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
use function htmlspecialchars;
|
||||
use function intval;
|
||||
use function rawurldecode;
|
||||
|
||||
/**
|
||||
@ -43,7 +42,7 @@ class ExportRelationSchema
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->diagram = $diagram;
|
||||
$this->setPageNumber($_REQUEST['page_number']);
|
||||
$this->setPageNumber((int) $_REQUEST['page_number']);
|
||||
$this->setOffline(isset($_REQUEST['offline_export']));
|
||||
$this->relation = new Relation($GLOBALS['dbi']);
|
||||
}
|
||||
@ -55,9 +54,9 @@ class ExportRelationSchema
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPageNumber($value)
|
||||
public function setPageNumber(int $value): void
|
||||
{
|
||||
$this->pageNumber = intval($value);
|
||||
$this->pageNumber = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -77,7 +76,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setShowColor($value)
|
||||
public function setShowColor(bool $value): void
|
||||
{
|
||||
$this->showColor = $value;
|
||||
}
|
||||
@ -99,7 +98,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTableDimension($value)
|
||||
public function setTableDimension(bool $value): void
|
||||
{
|
||||
$this->tableDimension = $value;
|
||||
}
|
||||
@ -121,7 +120,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAllTablesSameWidth($value)
|
||||
public function setAllTablesSameWidth(bool $value): void
|
||||
{
|
||||
$this->sameWide = $value;
|
||||
}
|
||||
@ -145,7 +144,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setShowKeys($value)
|
||||
public function setShowKeys(bool $value): void
|
||||
{
|
||||
$this->showKeys = $value;
|
||||
}
|
||||
@ -169,7 +168,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setOrientation($value)
|
||||
public function setOrientation(string $value): void
|
||||
{
|
||||
$this->orientation = $value == 'P' ? 'P' : 'L';
|
||||
}
|
||||
@ -193,7 +192,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setPaper($value)
|
||||
public function setPaper(string $value): void
|
||||
{
|
||||
$this->paper = $value;
|
||||
}
|
||||
@ -217,7 +216,7 @@ class ExportRelationSchema
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setOffline($value)
|
||||
public function setOffline(bool $value): void
|
||||
{
|
||||
$this->offline = $value;
|
||||
}
|
||||
@ -237,9 +236,9 @@ class ExportRelationSchema
|
||||
/**
|
||||
* Get the table names from the request
|
||||
*
|
||||
* @return array an array of table names
|
||||
* @return string[] an array of table names
|
||||
*/
|
||||
protected function getTablesFromRequest()
|
||||
protected function getTablesFromRequest(): array
|
||||
{
|
||||
$tables = [];
|
||||
if (isset($_POST['t_tbl'])) {
|
||||
|
||||
@ -96,8 +96,8 @@ class PdfRelationSchema extends ExportRelationSchema
|
||||
$this->setAllTablesSameWidth(isset($_REQUEST['pdf_all_tables_same_width']));
|
||||
$this->setWithDataDictionary(isset($_REQUEST['pdf_with_doc']));
|
||||
$this->setTableOrder($_REQUEST['pdf_table_order']);
|
||||
$this->setOrientation($_REQUEST['pdf_orientation']);
|
||||
$this->setPaper($_REQUEST['pdf_paper']);
|
||||
$this->setOrientation((string) $_REQUEST['pdf_orientation']);
|
||||
$this->setPaper((string) $_REQUEST['pdf_paper']);
|
||||
|
||||
// Initializes a new document
|
||||
parent::__construct(
|
||||
|
||||
@ -83,7 +83,7 @@ class TableStatsSvg extends TableStats
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function showMissingTableError()
|
||||
protected function showMissingTableError(): void
|
||||
{
|
||||
ExportRelationSchema::dieSchema(
|
||||
$this->pageNumber,
|
||||
@ -104,7 +104,7 @@ class TableStatsSvg extends TableStats
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function _setWidthTable($font, $fontSize)
|
||||
private function _setWidthTable($font, $fontSize): void
|
||||
{
|
||||
foreach ($this->fields as $field) {
|
||||
$this->width = max(
|
||||
@ -132,7 +132,7 @@ class TableStatsSvg extends TableStats
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function _setHeightTable($fontSize)
|
||||
private function _setHeightTable($fontSize): void
|
||||
{
|
||||
$this->heightCell = $fontSize + 4;
|
||||
$this->height = (count($this->fields) + 1) * $this->heightCell;
|
||||
@ -149,7 +149,7 @@ class TableStatsSvg extends TableStats
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function tableDraw($showColor)
|
||||
public function tableDraw($showColor): void
|
||||
{
|
||||
$this->diagram->printElement(
|
||||
'rect',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user