Skip to content

Commit

Permalink
Merge pull request #465 from wimg/bugfix-fp-deprecatedfunction-class
Browse files Browse the repository at this point in the history
False positive on deprecated functions after class definition - Fixes #464
  • Loading branch information
jrfnl authored Jun 14, 2017
2 parents be16e59 + ff96d19 commit 5d42644
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Sniffs/PHP/DeprecatedFunctionsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
T_DOUBLE_COLON,
T_OBJECT_OPERATOR,
T_FUNCTION,
T_CLASS,
T_CONST,
T_USE,
T_NS_SEPARATOR,
Expand Down
4 changes: 2 additions & 2 deletions Tests/Sniffs/PHP/DeprecatedFunctionsSniffTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ public function dataDeprecatedFunctionWithAlternative()
array('mcrypt_module_self_test', '7.1', 'OpenSSL', array(130), '7.0'),
array('mdecrypt_generic', '7.1', 'OpenSSL', array(131), '7.0'),

array('jpeg2wbmp', '7.2', 'imagecreatefromjpeg() and imagewbmp()', array(143), '7.1'),
array('png2wbmp', '7.2', 'imagecreatefrompng() or imagewbmp()', array(144), '7.1'),
array('jpeg2wbmp', '7.2', 'imagecreatefromjpeg() and imagewbmp()', array(144), '7.1'),
array('png2wbmp', '7.2', 'imagecreatefrompng() or imagewbmp()', array(145), '7.1'),
);
}

Expand Down
1 change: 1 addition & 0 deletions Tests/sniff-examples/deprecated_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
const php_check_syntax;
use php_check_syntax;
function php_check_syntax() {}
abstract class Split {}

// More deprecated functions, PHP 7.2
jpeg2wbmp();
Expand Down

0 comments on commit 5d42644

Please sign in to comment.