Commit 4d111785 authored by Mitch Portier's avatar Mitch Portier Committed by Klaus Purer
Browse files

feat(VariableComment): Add support for PHP 7.4 typed properties (#3096239 by Arkener)

parent 1bdc29a4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ class VariableCommentSniff extends AbstractVariableSniff
            T_VAR,
            T_STATIC,
            T_WHITESPACE,
            T_STRING,
            T_NS_SEPARATOR,
            T_NULLABLE,
        ];

        $commentEnd = $phpcsFile->findPrevious($ignore, ($stackPtr - 1), null, true);
+5 −0
Original line number Diff line number Diff line
@@ -46,4 +46,9 @@ class Test {

  protected $missingComment;

  /**
   * A typed property should still contain a variable comment.
   */
  public ?Bar $bar;

}
+5 −0
Original line number Diff line number Diff line
@@ -50,4 +50,9 @@ class Test {

  protected $missingComment;

  /**
   * A typed property should still contain a variable comment.
   */
  public ?Bar $bar;

}
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ class VariableCommentUnitTest extends CoderSniffUnitTest
            42 => 1,
            45 => 1,
            47 => 1,
            51 => 1,
        ];

    }//end getErrorList()
+7 −0
Original line number Diff line number Diff line
@@ -606,6 +606,13 @@ class Bar {
   */
  public $barProperty = 1;

  /**
   * Using property types is allowed.
   *
   * @var \Foo\Bar
   */
  public ?Bar $bar;

  /**
   * Public static variables use camelCase, too.
   *