Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
php5to7/php5to7.php /
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
56 lines (44 sloc)
1.36 KB
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
#!/usr/bin/env php | |
<?php | |
use michaelbutler\php5to7; | |
$autoloads = [ | |
__DIR__ . '/vendor/autoload.php', | |
__DIR__ . '/../../../autoload.php', | |
__DIR__ . '/../vendor/autoload.php', | |
]; | |
foreach ($autoloads as $file) { | |
if (file_exists($file)) { | |
require $file; | |
break; | |
} | |
} | |
ini_set('xdebug.max_nesting_level', 3000); | |
// Disable XDebug var_dump() output truncation | |
ini_set('xdebug.var_display_max_children', -1); | |
ini_set('xdebug.var_display_max_data', -1); | |
ini_set('xdebug.var_display_max_depth', -1); | |
$helpMsg = <<<HELP | |
Usage: | |
php php5to7.php [OPTIONS] <file/directory> | |
--overwrite Instead of outputting the changed source, writes | |
the php7 changes into the file. | |
--backup For every file it modifies, copies the original | |
to filename.php.bak. | |
-h --help This help message. | |
<file/directory> The path to the individual file, or a directory | |
to process every php file recursively. | |
https://github.com/michaelbutler/php5to7 | |
Licensed under the GPLv3 (http://www.gnu.org/licenses/gpl.html) | |
HELP; | |
$options = new php5to7\Options($argv); | |
if ($options->showHelp) { | |
echo $helpMsg; | |
return; | |
} | |
if (empty($options->inputPath)) { | |
echo "Please pass the input path (file or directory) as an argument.\n"; | |
echo $helpMsg; | |
exit(2); | |
} | |
$upgrader = new php5to7\Upgrader($options); | |
$upgrader->run(); |