Merge pull request #961 from dhensby/pulls/5.5/lint-fix

Linting fixes
This commit is contained in:
Robbie Averill 2020-05-11 12:44:31 -07:00 committed by GitHub
commit 26004d464a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 17 deletions

View File

@ -38,7 +38,7 @@ before_script:
script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml -vvv; fi
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs code/ tests/; fi
- if [[ $PHPCS_TEST ]]; then composer run-script lint; fi
- if [[ $NPM_TEST ]]; then git diff-files --quiet -w --relative=client; fi
- if [[ $NPM_TEST ]]; then git diff -w --no-color --relative=client; fi
- if [[ $NPM_TEST ]]; then yarn run lint; fi

View File

@ -62,7 +62,7 @@ class RecoverUploadLocationsHelper
/**
* Cache of the EditableFileField versions
*
*
* @var EditableFileField
*/
private $fieldFolderCache = array();
@ -115,7 +115,7 @@ class RecoverUploadLocationsHelper
/**
* Process all the files and return the number
*
*
* @return int Number of files processed
*/
protected function process()
@ -134,7 +134,7 @@ class RecoverUploadLocationsHelper
$errorsCount = 0;
// Loop over the files to process
foreach($this->chunk() as $uploadRecord) {
foreach ($this->chunk() as $uploadRecord) {
++$processedCount;
$fileId = $uploadRecord['UploadedFileID'];
@ -171,10 +171,10 @@ class RecoverUploadLocationsHelper
/**
* Fetches the EditableFileField version from cache and returns its FolderID
*
*
* @param int $fieldId EditableFileField.ID
* @param int EditableFileField Version
*
*
* @return int
*/
protected function getExpectedUploadFolderId($fieldId, $fieldVersion)
@ -196,11 +196,11 @@ class RecoverUploadLocationsHelper
/**
* Fetches a Folder by its ID, gracefully handling
* deleted folders
*
*
* @param int $id Folder.ID
*
*
* @return Folder
*
*
* @throws RuntimeException when folder could not be found
*/
protected function getFolder($id)
@ -231,10 +231,10 @@ class RecoverUploadLocationsHelper
/**
* Recover an uploaded file location
*
*
* @param int $fileId File.ID
* @param int $expectedFolderId ID of the folder where the file should have end up
*
*
* @return int Number of files recovered
*/
protected function recover($fileId, $expectedFolderId)
@ -247,7 +247,8 @@ class RecoverUploadLocationsHelper
if ($this->filesVersioned) {
$draftVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::DRAFT, $fileId);
$liveVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::LIVE, $fileId);;
$liveVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::LIVE, $fileId);
;
if ($draftVersion && $draftVersion != $liveVersion) {
$draft = Versioned::get_version(File::class, $fileId, $draftVersion);
@ -305,11 +306,11 @@ class RecoverUploadLocationsHelper
* when manually moving them to another folder through CMS
*
* @see https://github.com/silverstripe/silverstripe-userforms/issues/944
*
*
* @param int $fileId File.ID
* @param File $file The live version of the file
* @param File|null $draft The draft version of the file
*
*
* @return int Number of files recovered
*/
protected function checkResidual($fileId, File $file, File $draft = null)
@ -370,7 +371,7 @@ class RecoverUploadLocationsHelper
*
* @param File $file the file instance
* @param int $expectedFolder The expected folder
*
*
* @return int How many files have been recovered
*/
protected function recoverLiveOnly(File $file, Folder $expectedFolder)
@ -560,11 +561,11 @@ limit 100
/**
* Returns DataList object containing every
* uploaded file record
*
*
* @return DataList
*/
private function getCountQuery()
{
return SubmittedFileField::get()->filter(['UploadedFileID:NOT' => 0]);
}
}
}

View File

@ -49,6 +49,10 @@
"colymba/gridfield-bulk-editing-tools": "Allows for bulk management of form submissions",
"silverstripe/gridfieldqueuedexport": "Export large submission as CSV through queued jobs in the background"
},
"scripts": {
"lint": "phpcs code/ tests/",
"lint-clean": "phpcbf code/ tests/"
},
"extra": {
"expose": [
"client/dist",