-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ClassStructureSniff: Support for shortcuts
- Loading branch information
Showing
5 changed files
with
287 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
tests/Sniffs/Classes/data/classStructureWithShortcutsErrors.fixed.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
abstract class Whatever | ||
{ | ||
public const PUBLIC_CONSTANT = 1; | ||
|
||
private const PRIVATE_CONSTANT = 0; | ||
private $privateProperty; | ||
|
||
public static $publicStaticProperty; | ||
|
||
private static $privateStaticProperty; | ||
|
||
public $nonStaticProperty; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
public function publicMethod() | ||
{ | ||
} | ||
|
||
final protected function finalProtectedMethod() | ||
{ | ||
} | ||
|
||
public abstract function abstractPublicMethod(); | ||
|
||
abstract protected function abstractProtectedMethod(); | ||
|
||
public static function publicStaticMethod() | ||
{ | ||
} | ||
|
||
private static function privateStaticMethod() | ||
{ | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
} | ||
|
||
protected function protectedMethod() | ||
{ | ||
} | ||
|
||
private function privateMethod() | ||
{ | ||
} | ||
|
||
public function __get($name) | ||
{ | ||
return null; | ||
} | ||
|
||
} |
57 changes: 57 additions & 0 deletions
57
tests/Sniffs/Classes/data/classStructureWithShortcutsErrors.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
abstract class Whatever | ||
{ | ||
public static $publicStaticProperty; | ||
|
||
public const PUBLIC_CONSTANT = 1; | ||
private const PRIVATE_CONSTANT = 0; | ||
|
||
private static $privateStaticProperty; | ||
|
||
public $nonStaticProperty; | ||
|
||
private $privateProperty; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
public function __destruct() | ||
{ | ||
} | ||
|
||
protected function protectedMethod() | ||
{ | ||
} | ||
|
||
private function privateMethod() | ||
{ | ||
} | ||
|
||
final protected function finalProtectedMethod() | ||
{ | ||
} | ||
|
||
abstract protected function abstractProtectedMethod(); | ||
|
||
public abstract function abstractPublicMethod(); | ||
|
||
public static function publicStaticMethod() | ||
{ | ||
} | ||
|
||
public function publicMethod() | ||
{ | ||
} | ||
|
||
private static function privateStaticMethod() | ||
{ | ||
} | ||
|
||
public function __get($name) | ||
{ | ||
return null; | ||
} | ||
|
||
} |