Drupal 10 compatibility

Created on 19 January 2024, 5 months ago
Updated 31 January 2024, 5 months ago

Problem/Motivation

This module isn't support Drupal 10 core. Let's do this module compatible with Drupal 10

šŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code

Created by

šŸ‡ŗšŸ‡¦Ukraine ankondrat4

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @ankondrat4
  • Merge request !1Issue #3415772 | Drupal 10 compatibility ā†’ (Merged) created by ankondrat4
  • Status changed to Needs review 5 months ago
  • Issue was unassigned.
  • šŸ‡ŗšŸ‡¦Ukraine ankondrat4

    Hello.

    Module was adapted to Drupal 10.

    Please, review.

  • Pipeline finished with Success
    5 months ago
    Total: 182s
    #85318
  • Status changed to Needs work 5 months ago
  • šŸ‡ŗšŸ‡¦Ukraine ankondrat4

    Need to fix phpstan errors:

    $ php vendor/bin/phpstan analyze $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME $PHPSTAN_CONFIGURATION --no-progress || EXIT_CODE=$?
     ------ ------------------------------------------------------------------------------ 
      Line   src/Form/FileCompressorRebuildForm.php                                        
     ------ ------------------------------------------------------------------------------ 
      61     Unsafe usage of new static().                                                 
             šŸ’” See:                                                                       
                https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static  
      137    \Drupal calls should be avoided in classes, use dependency injection          
             instead                                                                       
      141    Relying on entity queries to check access by default is deprecated in         
             drupal:9.2.0 and an error will be thrown from drupal:10.0.0. Call             
             \Drupal\Core\Entity\Query\QueryInterface::accessCheck() with TRUE or          
             FALSE to specify whether access should be checked.                            
             šŸ’” See https://www.drupal.org/node/3201242                                    
     ------ ------------------------------------------------------------------------------ 
     ------ ---------------------------------------------------------------------- 
      Line   src/Plugin/FileCompressor/FileCompressorGZip.php                      
     ------ ---------------------------------------------------------------------- 
      29     \Drupal calls should be avoided in classes, use dependency injection  
             instead                                                               
      33     \Drupal calls should be avoided in classes, use dependency injection  
             instead                                                               
     ------ ---------------------------------------------------------------------- 
     ------ ---------------------------------------------------------------------- 
      Line   src/Plugin/FileCompressor/FileCompressorZip.php                       
     ------ ---------------------------------------------------------------------- 
      28     \Drupal calls should be avoided in classes, use dependency injection  
             instead                                                               
      30     \Drupal calls should be avoided in classes, use dependency injection  
             instead                                                               
     ------ ---------------------------------------------------------------------- 
     [ERROR] Found 7 errors   
    

    Drupal coding standarts:

    $ vendor/bin/phpcs -s $_WEB_ROOT/modules/custom --report-junit=junit.xml --report-full --report-summary --report-source
    FILE: .../custom/file_compressor_field/src/Plugin/FileCompressorPluginInterface.php
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
        |       |     with a file doc comment
        |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
     47 | ERROR | [ ] Missing parameter type
        |       |     (Drupal.Commenting.FunctionComment.MissingParamType)
     56 | ERROR | [x] Whitespace found at end of line
        |       |     (Squiz.WhiteSpace.SuperfluousWhitespace.EndLine)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: .../modules/custom/file_compressor_field/src/Plugin/FileCompressorManager.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
        |       |     with a file doc comment
        |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
     21 | ERROR | [ ] Doc comment short description must be on a single line,
        |       |     further text should be a separate paragraph
        |       |     (Drupal.Commenting.DocComment.ShortSingleLine)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...web/modules/custom/file_compressor_field/src/Plugin/FileCompressorBase.php
    --------------------------------------------------------------------------------
    FOUND 3 ERRORS AFFECTING 3 LINES
    --------------------------------------------------------------------------------
      3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
        |       |     with a file doc comment
        |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
     14 | ERROR | [ ] Doc comment short description must be on a single line,
        |       |     further text should be a separate paragraph
        |       |     (Drupal.Commenting.DocComment.ShortSingleLine)
     41 | ERROR | [ ] Missing short description in doc comment
        |       |     (Drupal.Commenting.DocComment.MissingShort)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...stom/file_compressor_field/src/Plugin/FileCompressor/FileCompressorZip.php
    --------------------------------------------------------------------------------
    FOUND 5 ERRORS AFFECTING 5 LINES
    --------------------------------------------------------------------------------
      3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
        |       |     with a file doc comment
        |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
     23 | ERROR | [ ] Missing short description in doc comment
        |       |     (Drupal.Commenting.DocComment.MissingShort)
     41 | ERROR | [x] Short array syntax must be used to define arrays
        |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     45 | ERROR | [x] Short array syntax must be used to define arrays
        |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     49 | ERROR | [x] Short array syntax must be used to define arrays
        |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...tom/file_compressor_field/src/Plugin/FileCompressor/FileCompressorGZip.php
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
      3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
        |       |     with a file doc comment
        |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
     24 | ERROR | [ ] Missing short description in doc comment
        |       |     (Drupal.Commenting.DocComment.MissingShort)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...om/file_compressor_field/src/Plugin/Field/FieldType/FileCompressorItem.php
    --------------------------------------------------------------------------------
    FOUND 19 ERRORS AFFECTING 14 LINES
    --------------------------------------------------------------------------------
       3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
         |       |     with a file doc comment
         |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
      30 | ERROR | [x] Missing function doc comment
         |       |     (Drupal.Commenting.FunctionComment.Missing)
      31 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      40 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      41 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      61 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      70 | ERROR | [x] Expected 1 space after FUNCTION keyword; 0 found
         |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction)
      70 | ERROR | [x] Expected 1 space before opening brace; found 0
         |       |     (Generic.Functions.OpeningFunctionBraceKernighanRitchie.SpaceBeforeBrace)
      70 | ERROR | [x] Expected 1 space before opening brace; found 0
         |       |     (Squiz.Functions.MultiLineFunctionDeclaration.SpaceBeforeBrace)
      74 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      83 | ERROR | [x] Line indented incorrectly; expected 4 spaces, found 6
         |       |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
      92 | ERROR | [x] There should be no white space after an opening "("
         |       |     (Drupal.WhiteSpace.OpenBracketSpacing.OpeningWhitespace)
      92 | ERROR | [x] There should be no white space before a closing ")"
         |       |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
     104 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     106 | ERROR | [x] Expected 1 space after "=>"; 0 found
         |       |     (Squiz.ControlStructures.ForEachLoopDeclaration.NoSpaceAfterArrow)
     106 | ERROR | [x] Expected 1 space after "=>"; 0 found
         |       |     (Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter)
     107 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     107 | ERROR | [ ] The array declaration extends to column 124 (the limit is
         |       |     120). The array content should be split up over multiple
         |       |     lines (Drupal.Arrays.Array.LongLineDeclaration)
     112 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 18 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ..._field/src/Plugin/Field/FieldType/FileCompressorFieldItemListInterface.php
    --------------------------------------------------------------------------------
    FOUND 7 ERRORS AFFECTING 6 LINES
    --------------------------------------------------------------------------------
      1 | ERROR | [x] The PHP open tag must be followed by exactly one blank line
        |       |     (Drupal.WhiteSpace.OpenTagNewline.BlankLine)
      2 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
        |       |     with a file doc comment
        |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
     18 | ERROR | [ ] Missing parameter type
        |       |     (Drupal.Commenting.FunctionComment.MissingParamType)
     21 | ERROR | [ ] Return type missing for @return tag in function comment
        |       |     (Drupal.Commenting.FunctionComment.MissingReturnType)
     26 | ERROR | [x] Short array syntax must be used to define arrays
        |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     27 | ERROR | [x] Expected 1 newline at end of file; 0 found
        |       |     (Drupal.Files.EndFileNewline.NoneFound)
     27 | ERROR | [x] The closing brace for the interface must have an empty line
        |       |     before it
        |       |     (Drupal.Classes.ClassDeclaration.CloseBraceAfterBody)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 5 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...ompressor_field/src/Plugin/Field/FieldType/FileCompressorFieldItemList.php
    --------------------------------------------------------------------------------
    FOUND 14 ERRORS AND 1 WARNING AFFECTING 13 LINES
    --------------------------------------------------------------------------------
       3 | ERROR   | [x] Namespaced classes, interfaces and traits should not begin
         |         |     with a file doc comment
         |         |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
      14 | WARNING | [x] Unused use statement
         |         |     (Drupal.Classes.UnusedUseStatement.UnusedUse)
      25 | ERROR   | [x] Short array syntax must be used to define arrays
         |         |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      29 | ERROR   | [x] Expected 1 space after closing parenthesis; found 0
         |         |     (Drupal.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis)
      44 | ERROR   | [x] There should be no white space before a closing ")"
         |         |     (Drupal.WhiteSpace.CloseBracketSpacing.ClosingWhitespace)
      45 | ERROR   | [x] Short array syntax must be used to define arrays
         |         |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      54 | ERROR   | [ ] Doc comment short description must end with a full stop
         |         |     (Drupal.Commenting.DocComment.ShortFullStop)
      57 | ERROR   | [x] Parameter comment must end with a full stop
         |         |     (Drupal.Commenting.FunctionComment.ParamCommentFullStop)
      64 | ERROR   | [x] Data types in @var tags need to be fully namespaced
         |         |     (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace)
      64 | ERROR   | [x] Data types in @var tags need to be fully namespaced
         |         |     (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace)
     102 | ERROR   | [x] Short array syntax must be used to define arrays
         |         |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     111 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 2
         |         |     (Drupal.WhiteSpace.ScopeIndent.IncorrectExact)
     117 | ERROR   | [x] Short array syntax must be used to define arrays
         |         |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     141 | ERROR   | [x] Data types in @var tags need to be fully namespaced
         |         |     (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace)
     141 | ERROR   | [x] Data types in @var tags need to be fully namespaced
         |         |     (Drupal.Commenting.DataTypeNamespace.DataTypeNamespace)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 14 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...odules/custom/file_compressor_field/src/Form/FileCompressorRebuildForm.php
    --------------------------------------------------------------------------------
    FOUND 8 ERRORS AFFECTING 7 LINES
    --------------------------------------------------------------------------------
       3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
         |       |     with a file doc comment
         |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
      81 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      88 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      90 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
      90 | ERROR | [ ] The array declaration extends to column 145 (the limit is
         |       |     120). The array content should be split up over multiple
         |       |     lines (Drupal.Arrays.Array.LongLineDeclaration)
      99 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     101 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     109 | ERROR | [x] Short array syntax must be used to define arrays
         |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...web/modules/custom/file_compressor_field/src/Annotation/FileCompressor.php
    --------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    --------------------------------------------------------------------------------
     3 | ERROR | [x] Namespaced classes, interfaces and traits should not begin
       |       |     with a file doc comment
       |       |     (Drupal.Commenting.FileComment.NamespaceNoFileDoc)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    FILE: ...ield/web/modules/custom/file_compressor_field/file_compressor_field.module
    --------------------------------------------------------------------------------
    FOUND 9 ERRORS AFFECTING 5 LINES
    --------------------------------------------------------------------------------
      8 | ERROR | [x] When importing a class with "use", do not include a leading \
        |       |     (Drupal.Classes.UseLeadingBackslash.SeparatorStart)
     29 | ERROR | [x] Short array syntax must be used to define arrays
        |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     29 | ERROR | [x] Expected 1 space between double arrow and
        |       |     "'http://php.net/manual/es/book.zip.php'"; 0 found
        |       |     (Squiz.Arrays.ArrayDeclaration.NoSpaceAfterDoubleArrow)
     29 | ERROR | [x] Expected 1 space after "=>"; 0 found
        |       |     (Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter)
     30 | ERROR | [x] Short array syntax must be used to define arrays
        |       |     (Drupal.Arrays.DisallowLongArraySyntax.Found)
     30 | ERROR | [x] Expected 1 space between double arrow and
        |       |     "'http://pear.php.net/package/Archive_Tar'"; 0 found
        |       |     (Squiz.Arrays.ArrayDeclaration.NoSpaceAfterDoubleArrow)
     30 | ERROR | [x] Expected 1 space after "=>"; 0 found
        |       |     (Squiz.WhiteSpace.OperatorSpacing.NoSpaceAfter)
     32 | ERROR | [x] Case breaking statements must be followed by a single blank
        |       |     line
        |       |     (Squiz.ControlStructures.SwitchDeclaration.SpacingAfterBreak)
     62 | ERROR | [x] Expected 1 newline at end of file; 0 found
        |       |     (Drupal.Files.EndFileNewline.NoneFound)
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    Time: 161ms; Memory: 6MB
    PHP CODE SNIFFER REPORT SUMMARY
    --------------------------------------------------------------------------------
    FILE                                                            ERRORS  WARNINGS
    --------------------------------------------------------------------------------
    ...s/custom/file_compressor_field/file_compressor_field.module  9       0
    ...tom/file_compressor_field/src/Annotation/FileCompressor.php  1       0
    ...ile_compressor_field/src/Form/FileCompressorRebuildForm.php  8       0
    ...tom/file_compressor_field/src/Plugin/FileCompressorBase.php  3       0
    .../file_compressor_field/src/Plugin/FileCompressorManager.php  2       0
    ...mpressor_field/src/Plugin/FileCompressorPluginInterface.php  3       0
    .../src/Plugin/Field/FieldType/FileCompressorFieldItemList.php  14      1
    ...in/Field/FieldType/FileCompressorFieldItemListInterface.php  7       0
    ...sor_field/src/Plugin/Field/FieldType/FileCompressorItem.php  19      0
    ...ssor_field/src/Plugin/FileCompressor/FileCompressorGZip.php  2       0
    ...essor_field/src/Plugin/FileCompressor/FileCompressorZip.php  5       0
    --------------------------------------------------------------------------------
    A TOTAL OF 73 ERRORS AND 1 WARNING WERE FOUND IN 11 FILES
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX 63 OF THESE SNIFF VIOLATIONS AUTOMATICALLY
    

    ESLINT

    $ $CI_PROJECT_DIR/$_WEB_ROOT/core/node_modules/.bin/eslint --no-error-on-unmatched-pattern --ignore-pattern="*.es6.js" --resolve-plugins-relative-to=$CI_PROJECT_DIR/$_WEB_ROOT/core --ext=.js,.yml . || true
    /builds/project/file_compressor_field/web/modules/custom/file_compressor_field/file_compressor_field.services.yml
      3:1  error  Expected indentation of 4 spaces but found 6 spaces  yml/indent
      4:1  error  Expected indentation of 4 spaces but found 6 spaces  yml/indent
    āœ– 2 problems (2 errors, 0 warnings)
      2 errors and 0 warnings potentially fixable with the `--fix` option.
    

    https://git.drupalcode.org/project/file_compressor_field/-/pipelines/85323

  • Assigned to ankondrat4
  • Issue was unassigned.
  • Status changed to Fixed 5 months ago
  • Status changed to Fixed 5 months ago
Production build 0.69.0 2024