Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-2975

Enable PHP linting and fix its errors

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.11.0
    • php
    • None

    Description

      Currently, running ./build.sh test in the toplevel directory doesn't execute linter for PHP.
      And if it's enabled (with adding lang/php/.phpunit.result.cache to the RAT's exclude list, for avoiding license error), the following errors occur:

      sekikn@db1999569f2f:~/avro$ ./build.sh clean test
      
      (snip)
      
      + cd lang/php
      + ./build.sh lint test
      
      (snip)
      
      FILE: /home/sekikn/avro/lang/php/lib/AvroDebug.php
      -------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 3 LINES
      -------------------------------------------------------------------------------------------------------
       32 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       36 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       40 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
      -------------------------------------------------------------------------------------------------------
      
      
      FILE: /home/sekikn/avro/lang/php/lib/Schema/AvroSchema.php
      ------------------------------------------------------------------------------------------------------------
      FOUND 1 ERROR AND 32 WARNINGS AFFECTING 33 LINES
      ------------------------------------------------------------------------------------------------------------
        59 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        64 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        69 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        74 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        79 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        84 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        90 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
        96 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       102 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       108 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       114 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       120 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       127 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       132 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       137 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       143 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       150 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       155 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       160 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       166 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       171 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       178 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       183 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       188 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       193 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       198 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       203 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       208 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       213 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       218 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       223 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
       224 | ERROR   | [x] Whitespace found at end of line
       226 | WARNING | [ ] Visibility must be declared on all constants if your project supports PHP 7.1 or later
      ------------------------------------------------------------------------------------------------------------
      PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
      ------------------------------------------------------------------------------------------------------------
      
      
      FILE: /home/sekikn/avro/lang/php/lib/Schema/AvroName.php
      -------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
      -------------------------------------------------------------------------------------------------------
       31 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       36 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
      -------------------------------------------------------------------------------------------------------
      
      
      FILE: /home/sekikn/avro/lang/php/lib/Schema/AvroField.php
      -------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 6 WARNINGS AFFECTING 6 LINES
      -------------------------------------------------------------------------------------------------------
       32 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       37 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       42 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       47 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       52 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       57 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
      -------------------------------------------------------------------------------------------------------
      
      
      FILE: /home/sekikn/avro/lang/php/lib/DataFile/AvroDataIO.php
      -------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 11 WARNINGS AFFECTING 11 LINES
      -------------------------------------------------------------------------------------------------------
       37 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       42 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       48 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       53 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       58 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       62 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       67 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       72 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       74 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       76 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       78 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
      -------------------------------------------------------------------------------------------------------
      
      
      FILE: /home/sekikn/avro/lang/php/lib/IO/AvroFile.php
      -------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
      -------------------------------------------------------------------------------------------------------
       34 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       39 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
      -------------------------------------------------------------------------------------------------------
      
      
      FILE: /home/sekikn/avro/lang/php/lib/AvroIO.php
      -------------------------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 5 WARNINGS AFFECTING 5 LINES
      -------------------------------------------------------------------------------------------------------
       34 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       38 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       43 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       47 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
       51 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later
      -------------------------------------------------------------------------------------------------------
      
      Time: 434ms; Memory: 10MB
      

      Without explicit declaration, constant's visibility is public. So I'm going to add "public" keyword to them so as not to break code compatibility.

      Attachments

        Issue Links

          Activity

            People

              sekikn Kengo Seki
              sekikn Kengo Seki
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: