ondrejbouda / php7backport Goto Github PK
View Code? Open in Web Editor NEWTool for backporting PHP7 scripts to PHP5
License: MIT License
Tool for backporting PHP7 scripts to PHP5
License: MIT License
I cloned the repo into the Composer/vendor folder. I run on Command Prompt
php converter.php "C:/User/..../..../ Php7CodeFolder" "C:/Users/.../..../Php5CodeFolder"
It give me some "Warning" -->
mkdir(): Invalid argument in C:\Users..........\Composer\vendor\php7backport\src\Bouda\Php7Backport\DirectoryBackporter.php on line 31
and a "Fatal Error" -->
Uncaught Error: Class 'PhpParser\Lexer\Emulative' not found in C:\Users.........\Composer\vendor\php7backport\src\Bouda\Php7Backport\Backporter.php:21
I don't understand why and how to resolve these errors.
Can you give me some help?
Can u do this?
foo() ?? $bar
becomes
!is_null(foo()) ? foo() : $bar
foo() is called twice. This could have side effects.
Source files to be converted:
Command I use:
php convert.php src /tmp
It will produce warning like: file_put_contents(/tmp/B/B.php): failed to open stream: No such file or directory
By adding var_dump($file);
to DirectoryBackporter.php Line 28, it dumps src/A.php
, src/B/B.php
, src/B
. So the order is not what we expected.
I made some change to DirectoryBackporter.php, which can fix this bug in 5.6. I can send you PR if you think my code is okay to use.
Hey there,
thanks for your work!
I just noticed that you're not using PHP 7 for the project's source code. Would you consider a PR adding PHP 7 features and a backported version for users of old versions (branch or phar)?
Cheers,
Mike
function (string $foo) {}
should become
function ($foo) { $foo = (string) $foo; }
Identifiers used for generated names (e.g. anonymous classes) use sequence which is reset for each converted file. Conflicts could arise.
Proposed solution: add some kind of hash to the generated name (hashed source file maybe?) to ensure uniqueness
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.