- Issue created by @samit.310@gmail.com
- Merge request !2Issue #3336362: Drupal Coding Standards Issues | phpcs ā (Open) created by Sonal Gyanani
- š®š³India Sonal Gyanani
Patch #2 applied cleanly all errors and warnings are fixed.
So moving it to RTBC.
Thanks - Issue was unassigned.
- Status changed to Needs work
over 1 year ago 6:54pm 1 May 2023 - š®š¹Italy apaderno Brescia, š®š¹
+ /** + * Constructs a FileManagementViewController object. + */ + public function __construct(EntityTypeManagerInterface $entity_type_manager) {
The class name is missing its namespace.
+ /** + * The File Management service. + *
File and Management are misspelled.
$link = Link::fromTextAndUrl( $file->getFilename(), - //Url::fromUri(file_create_url($file->getFileUri())) - Url::fromUri(\Drupal::service('file_url_generator')->generateAbsoluteString($file->getFileUri())) + // Url::fromUri(file_create_url($file->getFileUri())) + Url::fromUri(\Drupal::service('file_url_generator')->generateAbsoluteString($file->getFileUri()))
The indentation of the last line is wrong.
+ * @param array $form + * Form array.
The short description is missing an article.
+ * The form state. * @param \Drupal\file\FileInterface $file - * (optional) The file to be deleted. + * The file to be deleted (optional).
It is not necessary to write when a parameter is optional; that is evident from the code.
+ $new_file_markup = new FormattableMarkup( + 'The new file to be used.<br /> + Leave empty to keep the existing file.<br /> + <strong>Important:</strong> The filename will not be changed unless you specify a new filename below.', + [ + '' => '', + ] + ); + $form['new_file_details']['new_file'] = [ '#title' => $this->t('New file'), '#type' => 'file', - '#description' => $this->t( - 'The new file to be used.<br />' - . 'Leave empty to keep the existing file.<br />' - . '<strong>Important:</strong> The filename will not be changed unless you specify a new filename below.' - ), + '#description' => $this->t('@new_file_markup', ['@new_file_markup' => $new_file_markup]), ];
The existing code is already correct.
- // TODO: set file_validate_extensions correctly - // TODO: Also check the return value of file_save_upload()[0] (could be FALSE) + // @todo set file_validate_extensions correctly
What follows
@todo
is a sentence: It starts with a capitalized word and ends with a period. - First commit to issue fork.
- Status changed to Needs review
about 1 year ago 8:26am 13 October 2023 - Status changed to RTBC
7 months ago 7:07am 22 April 2024 - Status changed to Needs review
7 months ago 11:36am 1 May 2024 - šµšPhilippines clarkssquared
Hi
I applied MR !2 and there are few PHPCS warning and errors
ā file_management git:(6c34ec1) curl https://git.drupalcode.org/project/file_management/-/merge_requests/2.diff | patch -p1 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 24382 0 24382 0 0 44059 0 --:--:-- --:--:-- --:--:-- 44574 patching file .gitlab-ci.yml patching file composer.json patching file file_management.info.yml patching file 'modules/file_management_view/README.md' patching file 'modules/file_management_view/file_management_view.info.yml' patching file 'modules/file_management_view/file_management_view.install' patching file 'modules/file_management_view/src/Controller/FileManagementViewController.php' patching file 'src/Controller/FileManagementController.php' patching file 'src/FileManagement.php' patching file 'src/Form/FileManagementDeleteFileConfirmForm.php' patching file 'src/Form/FileManagementEditFileForm.php' patching file 'src/Plugin/views/field/FileManagementOperations.php' ā file_management git:(6c34ec1) ā .. ā contrib git:(master) ā phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml file_management FILE: .../web/modules/contrib/file_management/modules/file_management_view/src/Controller/FileManagementViewController.php ----------------------------------------------------------------------------------------------------------------------- FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------- 23 | WARNING | Line exceeds 80 characters; contains 98 characters ----------------------------------------------------------------------------------------------------------------------- FILE: ...arksubing-subing/Projects/d9/d9-local/web/modules/contrib/file_management/src/Form/FileManagementEditFileForm.php ----------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is | | Drupal\Core\Entity\EntityTypeManagerInterface. ----------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------- FILE: ...bing/Projects/d9/d9-local/web/modules/contrib/file_management/src/Plugin/views/field/FileManagementOperations.php ----------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------- 6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Url. ----------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------- FILE: /Users/clarksubing-subing/Projects/d9/d9-local/web/modules/contrib/file_management/src/FileManagement.php ----------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------- 8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is | | Drupal\field\Entity\FieldConfig. ----------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------- FILE: ...ubing-subing/Projects/d9/d9-local/web/modules/contrib/file_management/src/Controller/FileManagementController.php ----------------------------------------------------------------------------------------------------------------------- FOUND 1 ERROR AFFECTING 1 LINE ----------------------------------------------------------------------------------------------------------------------- 10 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is | | Drupal\file_management\FileManagement. ----------------------------------------------------------------------------------------------------------------------- PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY ----------------------------------------------------------------------------------------------------------------------- Time: 384ms; Memory: 10MB ā contrib git:(master) ā
retaining the status to needs review for others to take a look and if they can replicate the issues I reported
- First commit to issue fork.
- š®š¹Italy apaderno Brescia, š®š¹