Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications to be able to work with PHP_CodeSniffer version 2.3.0 (stable) #65

Merged
merged 2 commits into from
Sep 14, 2015

Conversation

anorgan
Copy link
Contributor

@anorgan anorgan commented Apr 2, 2015

$forbiddenFunctions declared public, if not, the following error happens with PHPCS 2.3.0:

PHP Fatal error:  Access level to PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff::$forbiddenFunctions 
must be public (as in class Generic_Sniffs_PHP_ForbiddenFunctionsSniff) in 
/usr/share/pear/PHP/CodeSniffer/Standards/PHPCompatibility/Sniffs/PHP/DeprecatedFunctionsSniff.php on line 358

Solves PHP Fatal error:  Access level to PHPCompatibility_Sniffs_PHP_DeprecatedFunctionsSniff::$forbiddenFunctions must be public (as in class Generic_Sniffs_PHP_ForbiddenFunctionsSniff)
Solves PHP Fatal error:  Access level to PHPCompatibility_Sniffs_PHP_NewFunctionsSniff::$forbiddenFunctions must be public (as in class Generic_Sniffs_PHP_ForbiddenFunctionsSniff)
@wimg
Copy link
Member

wimg commented Apr 2, 2015

That's quite odd, since all tests are running fine with PHPCS 2.3 on Travis-CI : https://travis-ci.org/wimg/PHPCompatibility/jobs/56856730
Are you sure you're running PHPCS 2.3.0 and not just calling an older version in your path by accident ?

@anorgan
Copy link
Contributor Author

anorgan commented Apr 3, 2015

Fresh install. My env:

[vagrant@app ~]$ phpcs --version
PHP_CodeSniffer version 2.3.0 (stable) by Squiz (http://www.squiz.net)
[vagrant@app ~]$ php -v
PHP 5.5.22 (cli) (built: Feb 18 2015 17:54:45)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.3.1, Copyright (c) 2002-2015, by Derick Rethans

Property is declared public in Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php or Squiz/Sniffs/PHP/DiscouragedFunctionsSniff.php for example, both come with PHPCS by default (i.e.: https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/Generic/Sniffs/PHP/ForbiddenFunctionsSniff.php).

Also:

class A { public $prop = 'a'; };
class B extends A { protected $prop = 'a'; };
// PHP Fatal error:  Access level to B::$prop must be public (as in class A) in php shell code on line 1

wimg added a commit that referenced this pull request Sep 14, 2015
Modifications to be able to work with PHP_CodeSniffer version 2.3.0 (stable)
@wimg wimg merged commit 1abfd70 into PHPCompatibility:master Sep 14, 2015
@jrfnl jrfnl modified the milestone: 5.6 Apr 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants