monque / php-migration Goto Github PK
View Code? Open in Web Editor NEWA static analyzer for PHP version migration
License: MIT License
A static analyzer for PHP version migration
License: MIT License
I have downloaded the phar and want to run it on a windows machine like this "php phpmig.phar ".
But always I get the error "Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 11
52 bytes) in phar://path/to/phpmig/phpmig_2015-10-15.phar/src/Ch
anges/AbstractRemoved.php on line 49".
I have tried to change the memory_limit to 1 gb than to 4 gb and the error is still there.
is it possible to printout only fatals?
I'm trying to determine if we can upgrade some of our servers that currently run 5.3, but this code requires at least 5.4 due to the array syntax. Would you support merging a PR that changed the array syntax to support PHP 5.3?
Just for clarity, here's the error I get when running the .phar:
PHP Parse error: syntax error, unexpected '[' in phar:///home/star/phpmig.phar/src/App.php on line 83
Hi,
Your tool is great.
But I have a big project to migrate, and I can't do it in one shot. So I progressively check files.
But when some alerts are not identified with the *
(or they are identified but I don't care), I have no way to say "Ok this file has been reviewed", so phpmig does not need to care about it anymore.
So they popup everytime I run phpmig
I suggest phpmig watch for a "@phpmig-reviewed" tag in comments in the X first lines of the file. And if the tag exists, phpmig just ignore that file.
Or maybe create a ~/.phpmigignore
file with absolute paths and phpmig watch for it and ignore files in that file.
Thank you.
Notice: Undefined property: PhpParser\Node\Expr\ConstFetch::$value in /home/vagrant/Tools/vendor/monque/php-migration/src/Changes/AbstractIntroduced.php on line 150
Call Stack:
0.0005 225744 1. {main}() /home/vagrant/Tools/vendor/monque/php-migration/bin/phpmig:0
0.0017 466224 2. PhpMigration\App->run() /home/vagrant/Tools/vendor/monque/php-migration/bin/phpmig:30
0.0018 469144 3. PhpMigration\App->commandMain() /home/vagrant/Tools/vendor/monque/php-migration/src/App.php:203
28.0882 11913544 4. PhpParser\NodeTraverser->traverse(array(5)) /home/vagrant/Tools/vendor/monque/php-migration/src/App.php:371
28.0883 11913592 5. PhpParser\NodeTraverser->traverseArray(array(5)) /home/vagrant/Tools/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
28.1168 12001232 6. PhpParser\NodeTraverser->traverseNode(class PhpParser\Node\Expr\ErrorSuppress) /home/vagrant/Tools/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:129
28.1190 12008200 7. PhpMigration\CheckVisitor->leaveNode(class PhpParser\Node\Expr\FuncCall) /home/vagrant/Tools/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:101
28.1192 12012304 8. PhpMigration\Changes\AbstractIntroduced->leaveNode(class PhpParser\Node\Expr\FuncCall) /home/vagrant/Tools/vendor/monque/php-migration/src/CheckVisitor.php:169
28.1192 12012352 9. PhpMigration\Changes\AbstractIntroduced->isNewConst(class PhpParser\Node\Expr\FuncCall) /home/vagrant/Tools/vendor/monque/php-migration/src/Changes/AbstractIntroduced.php:93
is it possible to check all php files in a directory?
When your run on a PHP 5.3 plaform to detect if keywords reserved are used. E.g
php phpmig -s to54 /path/to/keywords_reserved.php
With source file (keywords_reserved.php)
<?php
class Trait
{
const FOO = "foo";
}
class finally
{
function __construct()
{
$trait = new Trait;
$foo = Trait::FOO;
}
}
You got following error
File: keywords_reserved.php
--------------------------------------------------------------------------------
3 | PARSE | * | NONE | Syntax error, unexpected T_TRAIT, expecting T_STRING on line 3
--------------------------------------------------------------------------------
Reason is that PHP-Parser is not yet able to catch such condition, until now. I've proposed an improvement nikic/PHP-Parser#202
And soon, I'll propose a migration analyser on my php-compatinfo project, based on Sniff pattern.
See llaville/php-compatinfo#202
I must gave you a credit, because this future analyser (that is available to detect even keywords reserved) is due to a deeper analysis of your project architecture.
Dependency is too restrictive, and does not allow benefit of new versions
"nikic/php-parser": "~1.0.1",
You should changed this at least to
"nikic/php-parser": "~1.1",
Better will be ~1.3
or even ~1.2
In version 0.1.1 that i have installed via composer on a debian, the shellscript "phpmig" under vender/../bin produce an error. I have change the path to the autoload.php an all was nice.
php phpmig.phar app/
PHP Fatal error: Call to undefined method PhpParser\Node\Expr\ArrayDimFetch::toString() in phar://C:/dev/inos/api/phpmig.phar/src/Changes/v5dot3/IncompByReference.php on line 396
PHP Stack trace:
PHP 1. {main}() C:\dev\inos\api\phpmig.phar:0
PHP 2. PhpMigration\App->run() C:\dev\inos\api\phpmig.phar:9
PHP 3. PhpMigration\App->commandMain() phar://C:/dev/inos/api/phpmig.phar/src/App.php:194
PHP 4. PhpParser\NodeTraverser->traverse() phar://C:/dev/inos/api/phpmig.phar/src/App.php:399
PHP 5. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
PHP 6. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP 7. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 8. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP 9. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 10. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP 11. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 12. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP 13. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
PHP 14. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
PHP 15. PhpMigration\CheckVisitor->leaveNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:101
PHP 16. PhpMigration\Changes\v5dot3\IncompByReference->leaveNode() phar://C:/dev/inos/api/phpmig.phar/src/CheckVisitor.php:176
PHP 17. PhpMigration\Changes\v5dot3\IncompByReference->populateCall() phar://C:/dev/inos/api/phpmig.phar/src/Changes/v5dot3/IncompByReference.php:254
Fatal error: Call to undefined method PhpParser\Node\Expr\ArrayDimFetch::toString() in phar://C:/dev/inos/api/phpmig.phar/src/Changes/v5dot3/IncompByReference.php on line 396
Call Stack:
0.0034 233144 1. {main}() C:\dev\inos\api\phpmig.phar:0
0.0047 367168 2. PhpMigration\App->run() C:\dev\inos\api\phpmig.phar:9
0.0047 369000 3. PhpMigration\App->commandMain() phar://C:/dev/inos/api/phpmig.phar/src/App.php:194
4.9199 6224744 4. PhpParser\NodeTraverser->traverse() phar://C:/dev/inos/api/phpmig.phar/src/App.php:399
4.9200 6195928 5. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:64
4.9201 6196776 6. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
4.9205 6197712 7. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
4.9207 6152120 8. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
4.9207 6152992 9. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
4.9228 6148072 10. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
4.9231 6149312 11. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
4.9336 6157224 12. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
4.9349 6159064 13. PhpParser\NodeTraverser->traverseArray() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:84
4.9374 6161328 14. PhpParser\NodeTraverser->traverseNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:135
4.9416 6165456 15. PhpMigration\CheckVisitor->leaveNode() phar://C:/dev/inos/api/phpmig.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:101
4.9417 6167736 16. PhpMigration\Changes\v5dot3\IncompByReference->leaveNode() phar://C:/dev/inos/api/phpmig.phar/src/CheckVisitor.php:176
4.9417 6167784 17. PhpMigration\Changes\v5dot3\IncompByReference->populateCall() phar://C:/dev/inos/api/phpmig.phar/src/Changes/v5dot3/IncompByReference.php:254```
php -v
php -v
PHP 5.6.19 (cli) (built: Mar 2 2016 20:08:35)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
app/
contains our Laravel 5.2 project, which I am unable to share, although I could provide more pointers or other info if requested.
Any plans to introduce checks for (breaking) changes in PHP 7.1?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.