Skip to content

Commit

Permalink
Merge branch 'QA_5_1'
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Dec 18, 2020
2 parents 0c81985 + b4f1e14 commit 8485674
Show file tree
Hide file tree
Showing 17 changed files with 115 additions and 49 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -84,7 +84,7 @@
"php-webdriver/webdriver": "^1.8",
"phpmyadmin/coding-standard": "^2.1.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^0.12.61",
"phpstan/phpstan": "^0.12.63",
"phpstan/phpstan-phpunit": "^0.12.17",
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.0",
"pragmarx/google2fa-qrcode": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Database/Designer/Common.php
Expand Up @@ -554,7 +554,7 @@ public function saveTablePositions($pg)
* @param string $table table name
* @param string $field display field name
*
* @return array<int, (string|bool|null)>
* @return array<int,string|bool|null>
*/
public function saveDisplayField($db, $table, $field): array
{
Expand Down
4 changes: 3 additions & 1 deletion libraries/classes/Plugins/Auth/AuthenticationSignon.php
Expand Up @@ -209,7 +209,9 @@ public function readCredentials()
/* Restart phpMyAdmin session */
if (! defined('TESTSUITE')) {
$this->setCookieParams($oldCookieParams);
session_name($old_session);
if ($old_session !== null) {
session_name($old_session);
}
if (! empty($old_id)) {
session_id($old_id);
}
Expand Down
12 changes: 8 additions & 4 deletions libraries/classes/Plugins/Schema/Dia/Dia.php
Expand Up @@ -27,7 +27,9 @@ class Dia extends XMLWriter
/**
* Upon instantiation This starts writing the Dia XML document
*
* @see XMLWriter::openMemory(),XMLWriter::setIndent(),XMLWriter::startDocument()
* @see XMLWriter::openMemory()
* @see XMLWriter::setIndent()
* @see XMLWriter::startDocument()
*/
public function __construct()
{
Expand All @@ -52,8 +54,9 @@ public function __construct()
* to define the document, then finally a Layer starts which
* holds all the objects.
*
* @see XMLWriter::startElement(),XMLWriter::writeAttribute(),
* XMLWriter::writeRaw()
* @see XMLWriter::startElement()
* @see XMLWriter::writeAttribute()
* @see XMLWriter::writeRaw()
*
* @param string $paper the size of the paper/document
* @param float $topMargin top margin of the paper/document in cm
Expand Down Expand Up @@ -154,7 +157,8 @@ public function startDiaDoc(
/**
* Ends Dia Document
*
* @see XMLWriter::endElement(),XMLWriter::endDocument()
* @see XMLWriter::endElement()
* @see XMLWriter::endDocument()
*
* @return void
*
Expand Down
4 changes: 3 additions & 1 deletion libraries/classes/Plugins/Schema/Dia/DiaRelationSchema.php
Expand Up @@ -54,7 +54,9 @@ class DiaRelationSchema extends ExportRelationSchema
* Upon instantiation This outputs the Dia XML document
* that user can download
*
* @see Dia,TableStatsDia,RelationStatsDia
* @see Dia
* @see TableStatsDia
* @see RelationStatsDia
*
* @param string $db database name
*/
Expand Down
11 changes: 6 additions & 5 deletions libraries/classes/Plugins/Schema/Eps/EpsRelationSchema.php
Expand Up @@ -26,7 +26,7 @@
* This class inherits ExportRelationSchema class has common functionality added
* to this class
*
* @name Eps_Relation_Schema
* @name EpsRelationSchema
*/
class EpsRelationSchema extends ExportRelationSchema
{
Expand Down Expand Up @@ -163,8 +163,9 @@ public function showOutput()
/**
* Defines relation objects
*
* @see _setMinMax,Table_Stats_Eps::__construct(),
* PhpMyAdmin\Plugins\Schema\Eps\RelationStatsEps::__construct()
* @see _setMinMax
* @see TableStatsEps::__construct()
* @see PhpMyAdmin\Plugins\Schema\Eps\RelationStatsEps::__construct()
*
* @param string $masterTable The master table name
* @param string $font The font
Expand Down Expand Up @@ -224,7 +225,7 @@ private function addRelation(
* Draws relation arrows and lines connects master table's master field to
* foreign table's foreign field
*
* @see Relation_Stats_Eps::relationDraw()
* @see RelationStatsEps::relationDraw()
*
* @return void
*/
Expand All @@ -238,7 +239,7 @@ private function drawRelations()
/**
* Draws tables
*
* @see Table_Stats_Eps::Table_Stats_tableDraw()
* @see TableStatsEps::Table_Stats_tableDraw()
*
* @return void
*/
Expand Down
6 changes: 3 additions & 3 deletions libraries/classes/Plugins/Schema/Eps/RelationStatsEps.php
Expand Up @@ -18,9 +18,9 @@
* master table's master field to foreign table's foreign key
* in EPS document.
*
* @see PMA_EPS
* @see Eps
*
* @name Relation_Stats_Eps
* @name RelationStatsEps
*/
class RelationStatsEps extends RelationStats
{
Expand Down Expand Up @@ -54,7 +54,7 @@ public function __construct(
* draws relation links and arrows
* shows foreign key relations
*
* @see PMA_EPS
* @see Eps
*
* @return void
*/
Expand Down
15 changes: 9 additions & 6 deletions libraries/classes/Plugins/Schema/Eps/TableStatsEps.php
Expand Up @@ -19,9 +19,9 @@
* This class preserves the table co-ordinates,fields
* and helps in drawing/generating the Tables in EPS.
*
* @see PMA_EPS
* @see Eps
*
* @name Table_Stats_Eps
* @name TableStatsEps
*/
class TableStatsEps extends TableStats
{
Expand All @@ -32,8 +32,9 @@ class TableStatsEps extends TableStats
public $currentCell = 0;

/**
* @see PMA_EPS, Table_Stats_Eps::Table_Stats_setWidth,
* PhpMyAdmin\Plugins\Schema\Eps\TableStatsEps::Table_Stats_setHeight
* @see Eps
* @see TableStatsEps::setWidthTable
* @see TableStatsEps::setHeightTable
*
* @param object $diagram The EPS diagram
* @param string $db The database name
Expand Down Expand Up @@ -98,7 +99,7 @@ protected function showMissingTableError()
/**
* Sets the width of the table
*
* @see PMA_EPS
* @see Eps
*
* @param string $font The font name
* @param int $fontSize The font size
Expand Down Expand Up @@ -149,7 +150,9 @@ private function setHeightTable($fontSize)
/**
* Draw the table
*
* @see PMA_EPS,PMA_EPS::line,PMA_EPS::rect
* @see Eps
* @see Eps::line
* @see Eps::rect
*
* @param bool $showColor Whether to display color
*
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Plugins/Schema/Pdf/PdfRelationSchema.php
Expand Up @@ -498,7 +498,7 @@ private function drawRelations()
/**
* Draws tables
*
* @see Table_Stats_Pdf::tableDraw()
* @see TableStatsPdf::tableDraw()
*
* @return void
*/
Expand Down
7 changes: 4 additions & 3 deletions libraries/classes/Plugins/Schema/Pdf/TableStatsPdf.php
Expand Up @@ -23,7 +23,7 @@
*
* @see PMA_Schema_PDF
*
* @name Table_Stats_Pdf
* @name TableStatsPdf
*/
class TableStatsPdf extends TableStats
{
Expand All @@ -34,8 +34,9 @@ class TableStatsPdf extends TableStats
private $ff = PdfLib::PMA_PDF_FONT;

/**
* @see PMA_Schema_PDF, Table_Stats_Pdf::Table_Stats_setWidth,
* PhpMyAdmin\Plugins\Schema\Pdf\TableStatsPdf::Table_Stats_setHeight
* @see PMA_Schema_PDF
* @see TableStatsPdf::setWidthTable
* @see PhpMyAdmin\Plugins\Schema\Pdf\TableStatsPdf::setHeightTable
*
* @param object $diagram The PDF diagram
* @param string $db The database name
Expand Down
24 changes: 16 additions & 8 deletions libraries/classes/Plugins/Schema/Svg/Svg.php
Expand Up @@ -40,7 +40,9 @@ class Svg extends XMLWriter
/**
* Upon instantiation This starts writing the RelationStatsSvg XML document
*
* @see XMLWriter::openMemory(),XMLWriter::setIndent(),XMLWriter::startDocument()
* @see XMLWriter::openMemory()
* @see XMLWriter::setIndent()
* @see XMLWriter::startDocument()
*/
public function __construct()
{
Expand Down Expand Up @@ -140,7 +142,8 @@ public function getFontSize()
* which contains all the attributes and namespace that needed
* to define the svg document
*
* @see XMLWriter::startElement(),XMLWriter::writeAttribute()
* @see XMLWriter::startElement()
* @see XMLWriter::writeAttribute()
*
* @param int $width total width of the RelationStatsSvg document
* @param int $height total height of the RelationStatsSvg document
Expand Down Expand Up @@ -173,7 +176,8 @@ public function startSvgDoc($width, $height, $x = 0, $y = 0)
/**
* Ends RelationStatsSvg Document
*
* @see XMLWriter::endElement(),XMLWriter::endDocument()
* @see XMLWriter::endElement()
* @see XMLWriter::endDocument()
*
* @return void
*/
Expand All @@ -190,7 +194,8 @@ public function endSvgDoc()
* RelationStatsSvg document saved in .svg extension and can be
* easily changeable by using any svg IDE
*
* @see XMLWriter::startElement(),XMLWriter::writeAttribute()
* @see XMLWriter::startElement()
* @see XMLWriter::writeAttribute()
*
* @param string $fileName file name
*
Expand All @@ -216,8 +221,10 @@ public function showOutput($fileName)
* and other elements who have x,y co-ordinates are drawn.
* specify their width and height and can give styles too.
*
* @see XMLWriter::startElement(), XMLWriter::writeAttribute(),
* XMLWriter::text(), XMLWriter::endElement()
* @see XMLWriter::startElement()
* @see XMLWriter::writeAttribute()
* @see XMLWriter::text()
* @see XMLWriter::endElement()
*
* @param string $name RelationStatsSvg element name
* @param int $x The x attr defines the left position of the element
Expand Down Expand Up @@ -264,8 +271,9 @@ public function printElement(
* arrows are also drawn by specify its start and ending
* co-ordinates
*
* @see XMLWriter::startElement(), XMLWriter::writeAttribute(),
* XMLWriter::endElement()
* @see XMLWriter::startElement()
* @see XMLWriter::writeAttribute()
* @see XMLWriter::endElement()
*
* @param string $name RelationStatsSvg element name i.e line
* @param int $x1 Defines the start of the line on the x-axis
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Plugins/Schema/Svg/SvgRelationSchema.php
Expand Up @@ -197,7 +197,7 @@ private function setMinMax($table)
/**
* Defines relation objects
*
* @see setMinMax,Table_Stats_Svg::__construct(),
* @see setMinMax,TableStatsSvg::__construct(),
* PhpMyAdmin\Plugins\Schema\Svg\RelationStatsSvg::__construct()
*
* @param string $masterTable The master table name
Expand Down Expand Up @@ -275,7 +275,7 @@ private function drawRelations()
/**
* Draws tables
*
* @see Table_Stats_Svg::Table_Stats_tableDraw()
* @see TableStatsSvg::Table_Stats_tableDraw()
*
* @return void
*/
Expand Down
9 changes: 5 additions & 4 deletions libraries/classes/Plugins/Schema/Svg/TableStatsSvg.php
Expand Up @@ -22,7 +22,7 @@
*
* @see PMA_SVG
*
* @name Table_Stats_Svg
* @name TableStatsSvg
*/
class TableStatsSvg extends TableStats
{
Expand All @@ -33,8 +33,9 @@ class TableStatsSvg extends TableStats
public $currentCell = 0;

/**
* @see PMA_SVG, Table_Stats_Svg::Table_Stats_setWidth,
* PhpMyAdmin\Plugins\Schema\Svg\TableStatsSvg::Table_Stats_setHeight
* @see Svg
* @see TableStatsSvg::setWidthTable
* @see TableStatsSvg::setHeightTable
*
* @param object $diagram The current SVG image document
* @param string $db The database name
Expand Down Expand Up @@ -138,7 +139,7 @@ private function setHeightTable($fontSize): void
/**
* draw the table
*
* @see PMA_SVG,PMA_SVG::printElement
* @see Svg::printElement
*
* @param bool $showColor Whether to display color
*
Expand Down
1 change: 0 additions & 1 deletion libraries/classes/Util.php
Expand Up @@ -816,7 +816,6 @@ public static function localisedDate($timestamp = -1, $format = '')
$ret = strftime($date, (int) $timestamp);
// Some OSes such as Win8.1 Traditional Chinese version did not produce UTF-8
// output here. See https://github.com/phpmyadmin/phpmyadmin/issues/10598
/** @phpstan-ignore-next-line */
if ($ret === false
|| mb_detect_encoding($ret, 'UTF-8', true) !== 'UTF-8'
) {
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Utils/FormatConverter.php
Expand Up @@ -86,12 +86,12 @@ public static function ipToLong(string $buffer)
*
* @return string
*/
public static function longToIp($buffer)
public static function longToIp($buffer): string
{
if (! Util::isInteger($buffer) || $buffer < 0 || $buffer > 4294967295) {
return $buffer;
}

return long2ip((int) $buffer);
return (string) long2ip((int) $buffer);
}
}

0 comments on commit 8485674

Please sign in to comment.