nilportugues / php-backslasher Goto Github PK
View Code? Open in Web Editor NEW[Git hook] Tool to add all PHP internal functions and constants to its namespace by adding backslash to them.
Home Page: http://nilportugues.com
License: MIT License
[Git hook] Tool to add all PHP internal functions and constants to its namespace by adding backslash to them.
Home Page: http://nilportugues.com
License: MIT License
The README states that: "[...] and therefore execution is faster". It would be nice to have some bechmarks or profile comparisons showing that difference in real world applications (Symfony, Drupal, etc.)
Bootstrap should look for autoload file
Composer should be compiled into the generated Phar
This step is necessary in order to place it inside /bin dir for those using the library as a composer dependency
Better testing for constants
Self::DIRECTORY_SEPARATOR may be slashed when it shouldnt...
The current release does not support PHP 7.4 (check below).
flavio@homer:~/php-backslasher$ ./vendor/bin/phpunit tests/
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
Runtime: PHP 7.4.4
Configuration: /Users/flavio/php-backslasher/phpunit.xml.dist
Error: No code coverage driver is available
EEEEE 5 / 5 (100%)
Time: 97 ms, Memory: 4.00MB
There were 5 errors:
1) NilPortugues\Tests\BackslashFixer\Fixer\FileEditorTest::testItCanBackSlashBooleansAndAndNull
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
/Users/flavio/php-backslasher/vendor/zendframework/zend-code/src/Generator/FileGenerator.php:135
/Users/flavio/php-backslasher/tests/Fixer/FileEditorTest.php:47
2) NilPortugues\Tests\BackslashFixer\Fixer\FileEditorTest::testItCanBackSlashConstants
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
/Users/flavio/php-backslasher/vendor/zendframework/zend-code/src/Generator/FileGenerator.php:135
/Users/flavio/php-backslasher/tests/Fixer/FileEditorTest.php:47
3) NilPortugues\Tests\BackslashFixer\Fixer\FileEditorTest::testItCanBackSlashFunctions
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
/Users/flavio/php-backslasher/vendor/zendframework/zend-code/src/Generator/FileGenerator.php:135
/Users/flavio/php-backslasher/tests/Fixer/FileEditorTest.php:47
4) NilPortugues\Tests\BackslashFixer\Fixer\FileEditorTest::testItDoesNotBackSlashFunctionsFromImportedFunctions
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
/Users/flavio/php-backslasher/vendor/zendframework/zend-code/src/Generator/FileGenerator.php:135
/Users/flavio/php-backslasher/tests/Fixer/FileEditorTest.php:47
5) NilPortugues\Tests\BackslashFixer\Fixer\FileEditorTest::testItDoesNotBackSlashAliasedFunctions
"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?
/Users/flavio/php-backslasher/vendor/zendframework/zend-code/src/Generator/FileGenerator.php:135
/Users/flavio/php-backslasher/tests/Fixer/FileEditorTest.php:47
ERRORS!
Tests: 5, Assertions: 0, Errors: 5.
I've tracked down the problem to be within Zend-Code.
flavio@homer:~/php-backslasher$ php -v
PHP 7.4.4 (cli) (built: Apr 6 2020 12:54:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Seems that the source of this has php functions call without \
๐
Hi !
Idea behind this package is really great!
This package is not actively maintained, and
some time ago, one of open-source contributor bring this feature into https://github.com/FriendsOfPHP/PHP-CS-Fixer/ as native_function_invocation
rule.
Maybe you want to deprecate this package and redirect users to PHP CS Fixer to not need to maintain this package ?
This should be added too
Then add to README.md
Maybe do this for booleans too. Adds one less call.
https://3v4l.org/cqCno/vld#tabs ops = 7
https://3v4l.org/k5lL1/vld#tabs ops = 8
Check all backslashed functions and undo them, then apply backslashing.
It can be argued that code would be kept cleaner by adding at the top of the modified file 'use' statements for each of the optimizeable functions instead of backslashes in the calls.
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.