Skip to content

Commit

Permalink
Closes wapmorgan#83
Browse files Browse the repository at this point in the history
Allows phpdd to catch use of not yet implemented functions
in code designed to run on older versions of PHP. This will
give developers the ability to know when changes break
backward compatibility.
  • Loading branch information
NathanGibbs3 committed Jun 4, 2023
1 parent 860e40c commit 7369e50
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion data/5.4.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
'mcrypt_generic_end' => 'mcrypt_generic_deinit',
'magic_quotes_runtime',
'mysql_list_dbs',
]
],
'functions_usage' => [
'imagescale' => '@not_yet_implemented',
],
];
21 changes: 21 additions & 0 deletions data/not_yet_implemented.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace wapmorgan\PhpCodeFixer;

/**
*
* @test Any
* @param array $usageTokens
* @return bool|string
*/

function not_yet_implemented(array $usageTokens){
if (count($usageTokens) === 0)
return false;

// Make these Vars so that in the future this could work for more than
// just functions. See Issue #84
$Pfx = 'Function';
$Sfx = '()';
return "$Pfx " . $usageTokens[0][1]
. "$Sfx not yet implemented on this version of PHP.";
}

0 comments on commit 7369e50

Please sign in to comment.