cakephp-codesniffer
cakephp-codesniffer copied to clipboard
Problems with Property Hooks
Doing a simple
class ConfigChecker
{
public FTPInterface $ftpCheckObject {
get {
return $this->ftpCheckObject;
}
set(FTPInterface $value) {
$this->ftpCheckObject = $value;
}
}
}
causes the following errors:
--------------------------------------------------------------------------------
FOUND 10 ERRORS AND 2 WARNINGS AFFECTING 4 LINES
--------------------------------------------------------------------------------
10 | ERROR | There must not be more than one property declared per statement
12 | ERROR | Visibility must be declared on property "$this"
12 | ERROR | Scope modifier not specified for member variable "$this"
14 | WARNING | Code after the RETURN statement on line 12 cannot be executed
14 | ERROR | There must not be more than one property declared per statement
14 | ERROR | Visibility must be declared on property "$value"
14 | ERROR | Scope modifier not specified for member variable "$value"
15 | WARNING | Code after the RETURN statement on line 12 cannot be executed
15 | ERROR | There must not be more than one property declared per statement
15 | ERROR | Visibility must be declared on property "$this"
15 | ERROR | Scope modifier not specified for member variable "$this"
15 | ERROR | Scope modifier not specified for member variable "$value"
--------------------------------------------------------------------------------
Seems like PHP_Codesniffer is not 8.4 ready yet
https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/734
phpcs v4 beta1 is out. Hoping by the time it's stable it will have support for property hooks.
4.0.0 was released yesterday