Remove File::isError() method
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
98b3db158a
commit
7db0e7c682
@ -3099,12 +3099,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Controllers/Table/ReplaceController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$messages of method PhpMyAdmin\\Message\:\:addMessagesString\(\) expects array\<string\>, list\<PhpMyAdmin\\Message\|string\|null\> given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/Controllers/Table/ReplaceController.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#2 \$relationField of method PhpMyAdmin\\InsertEdit\:\:getLinkForRelationalDisplayField\(\) expects string, \(int\|string\) given\.$#'
|
||||
identifier: argument.type
|
||||
|
||||
@ -2362,9 +2362,6 @@
|
||||
</PossiblyInvalidCast>
|
||||
</file>
|
||||
<file src="src/Controllers/Table/ReplaceController.php">
|
||||
<InvalidArgument>
|
||||
<code><![CDATA[$insertErrors]]></code>
|
||||
</InvalidArgument>
|
||||
<InvalidPropertyAssignmentValue>
|
||||
<code><![CDATA[UrlParams::$params]]></code>
|
||||
</InvalidPropertyAssignmentValue>
|
||||
|
||||
@ -397,10 +397,8 @@ final readonly class ImportController implements InvocableController
|
||||
*/
|
||||
$importHandle = new File(ImportSettings::$importFile);
|
||||
$importHandle->checkUploadedFile();
|
||||
if ($importHandle->isError()) {
|
||||
/** @var Message $errorMessage */
|
||||
$errorMessage = $importHandle->getError();
|
||||
|
||||
$errorMessage = $importHandle->getError();
|
||||
if ($errorMessage !== null) {
|
||||
$importHandle->close();
|
||||
|
||||
$_SESSION['Import_message']['message'] = $errorMessage->getDisplay();
|
||||
@ -414,10 +412,8 @@ final readonly class ImportController implements InvocableController
|
||||
|
||||
$importHandle->setDecompressContent(true);
|
||||
$importHandle->open();
|
||||
if ($importHandle->isError()) {
|
||||
/** @var Message $errorMessage */
|
||||
$errorMessage = $importHandle->getError();
|
||||
|
||||
$errorMessage = $importHandle->getError();
|
||||
if ($errorMessage !== null) {
|
||||
$importHandle->close();
|
||||
|
||||
$_SESSION['Import_message']['message'] = $errorMessage->getDisplay();
|
||||
|
||||
@ -118,9 +118,8 @@ final readonly class ManageController implements InvocableController
|
||||
) {
|
||||
$importHandle = new File($_FILES['import_file']['tmp_name']);
|
||||
$importHandle->checkUploadedFile();
|
||||
if ($importHandle->isError()) {
|
||||
$error = $importHandle->getError();
|
||||
} else {
|
||||
$error = $importHandle->getError();
|
||||
if ($error === null) {
|
||||
// read JSON from uploaded file
|
||||
$json = $importHandle->getRawContent();
|
||||
}
|
||||
|
||||
@ -192,8 +192,9 @@ final readonly class ReplaceController implements InvocableController
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileToInsert->isError()) {
|
||||
$insertErrors[] = $fileToInsert->getError();
|
||||
$errorMessage = $fileToInsert->getError();
|
||||
if ($errorMessage !== null) {
|
||||
$insertErrors[] = $errorMessage->getMessage();
|
||||
}
|
||||
|
||||
// delete $file_to_insert temporary variable
|
||||
|
||||
@ -320,14 +320,6 @@ class File
|
||||
return $this->errorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether there was any error.
|
||||
*/
|
||||
public function isError(): bool
|
||||
{
|
||||
return $this->errorMessage !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* checks the superglobals provided if the tbl_change form is submitted
|
||||
* and uses the submitted/selected file
|
||||
|
||||
Loading…
Reference in New Issue
Block a user