povils / phpmnd Goto Github PK
View Code? Open in Web Editor NEWPHP Magic Number Detector
License: MIT License
PHP Magic Number Detector
License: MIT License
The dependency phpunit/php-timer is 3 major revisions behind. It currently requires ^2.3
but the latest version is v5.0.3
.
I'm not sure what the changes were but I doubt it is breaking.
phpunit v9.x requires phpunit/php-timer ^5.0.2.
(e.g. your package is not compatible with Laravel/Lumen v7.x
)
Root composer.json requires php ^8.0 but your php version (7.4.14) does not satisfy that requirement.
It would be nice to have a way of passing an argument to the command which allows you to filter out file names with a given string.
For example: My tests are always in the format of ****Test.php
and if we could filter out these from the checks it would be good.
I don't think the exclude directory argument would be suitable due to the location of all our test files (Tests are alongside the code).
I'm happy to take a look at this.
Cheers
Library looks super useful and I could not help seeing the similarity with generic approaches like phpstan/psalm provide.
Are they are any plans/desire to provide these analysis "integrate-able" as part of other tools?
thanks!
define( 'FOO__HTTPS_PORT', 80 );
That gets identified as a magic number as part of the argument
extension.
Perhaps an allowance can be made if the magic number is the 2nd argument in a define()
call?
I guess the reach and proliferation of phpmnd could benefit from having a simple but sufficient informational website. At best under a simple domain such as phpmnd.org.
Like:
This website should contain the most important documentation (or link to it, if held externally, e.g. on readthedocs) and could have some marketing material (e.g. who uses phpmnd etc).
df5c2c5#diff-743c6cb860ef35ef01f8d2b848a2cb88L18
breaks the command on Centos 7 installation with composer. Previous version worked.
Hi, at first: I'm completely new to this package and I'm pleased about the possibilities! :-)
Currently I have this piece of code:
throw new InvalidArgumentException(
'Exception message',
1583854980
);
This position is found from phpmnd and apparently no extension is active here, tested with setting "all".
Is it possible and useful to add an extension for this? Or how would you handle this case?
Hi everybody,
Thanks for this great work.
I wondering if it would be possible to release a new minor version that embeds this commit 310eb6c. Actually we are forced to pull the dev-master on our Satis and it could be great to create a release instead ;-)
Thanks per advance,
If you plan to support & maintain this project over many years, it could be beneficial to move this tool away from your personal namespace/GitHub user to a phpmnd specific namespace/GitHub organisation.
This could also lower the barriers for others to co-maintain it (if that's an option anyway).
The latest version of php-timer is 5.0.1 and thus need to update:
Line 21 in 00b6170
to:
"phpunit/php-timer": "^2.0||^3.0||^4.0||^5.0"
https://github.com/sebastianbergmann/php-timer
Releases: https://github.com/sebastianbergmann/php-timer/tags
path: ~/.composer/cache/files
tilde is not expanded by GHA.
Please see https://github.com/ergebnis/php-library-template/blob/9f19720edb26c1ce11ea3a571cc751eb36556e7d/.github/workflows/integrate.yaml#L49-L55 - the mother of all GHA configs.
phpmnd v2.0.0 requires jakub-onderka/php-console-highlighter v0.3.2 but this library is outdated. 0.4 version is 12 days ago
Get the following message when trying to install PHPUnit 7 with this package.
Problem 1
- Installation request for povils/phpmnd ^1.1 -> satisfiable by povils/phpmnd[1.1.x-dev, v1.1.0, v1.1.1].
- Conclusion: don't install phpunit/php-timer 2.0.0
- phpunit/phpunit 7.0.0 requires phpunit/php-timer ^2.0 -> satisfiable by phpunit/php-timer[2.0.0, 2.0.x-dev].
- phpunit/phpunit 7.1.x-dev requires phpunit/php-timer ^2.0 -> satisfiable by phpunit/php-timer[2.0.0, 2.0.x-dev].
- phpunit/phpunit 7.0.x-dev requires phpunit/php-timer ^2.0 -> satisfiable by phpunit/php-timer[2.0.0, 2.0.x-dev].
- Conclusion: don't install phpunit/php-timer 2.0.x-dev
- Installation request for phpunit/phpunit ^7 -> satisfiable by phpunit/phpunit[7.0.0, 7.0.x-dev, 7.1.x-dev].
Could we update the dependency to php-timer ^2.0? I'll submit a PR for this later tonight
Eg self::SOMETHING_SIX = 6; should be disallowed
Will need to work out languages but default to English
Console\Application version reads 1.1.0
, current release is 1.1.1
. Not anything critical, obviously ๐ . Just noticed it merging master into the phar self-update work (where it would impact assuming the updater stuff is merged).
Please consider using https://phar.io/ in your release process
I'm maintaining a docker image with qa tools which phpmnd is part of.
I'm trying to limit number of dependencies installed with "composer global require" to prevent conflicts between tools. Having a phar to download would be really helpful.
Example file:
<?php
declare(strict_types=1);
namespace Test;
class Match
{
public function compareTo(Match $other)
{
// do something
}
}
Call:
phpmnd test.php
Expected result (more or less):
phpmnd 2.3.0 by Povilas Susinskas
--------------------------------------------------------------------------------
Total of Magic Numbers: 0
Time: 54 ms, Memory: 12.00 MB
Insted it returns:
phpmnd 2.3.0 by Povilas Susinskas
Syntax error, unexpected T_MATCH, expecting T_STRING on line 6
--------------------------------------------------------------------------------
Total of Magic Numbers: 0
Time: 65 ms, Memory: 12.00 MB
More info:
# php -v
PHP 7.4.11 (cli) (built: Oct 13 2020 10:09:45) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans
with blackfire v1.42.0~linux-x64-non_zts74, https://blackfire.io, by Blackfire
The documentation says
By default 0 and 1 are not considered to be magic numbers.
But when I use the --include-numeric-string
option I get warnings for strings '0'
and '1'
:
tests/bootstrap.php:5. Magic number: 1
> 5| ini_set('display_errors', '1');
tests/bootstrap.php:7. Magic number: 0
> 7| ini_set('display_startup_errors', '0');
Shouldn't '0'
and '1'
be considered as non-magic?
PHPMND version: b720469
When trying to upgrade illuminate/database to ^7.18 povils/phpmnd requires an older version of symfony/console ^4.0. It looks like I need to remove povils/phpmnd to use a newer version of illuminate/database.
Problem 1
- povils/phpmnd v2.2.0 requires symfony/console ^4.0 -> satisfiable by symfony/console[4.0.x-dev, 4.1.x-dev, 4.2.x-dev, 4.3.x-dev, 4.4.x-dev, v4.0.0, v4.0.0-BETA1, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.0-RC1, v4.0.0-RC2, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.0-BETA1, v4.1.0-BETA2, v4.1.0-BETA3, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.0-BETA1, v4.2.0-BETA2, v4.2.0-RC1, v4.2.1, v4.2.10, v4.2.11, v4.2.12, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.0-BETA1, v4.3.0-BETA2, v4.3.0-RC1, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9, v4.4.0, v4.4.0-BETA1, v4.4.0-BETA2, v4.4.0-RC1, v4.4.1, v4.4.10, v4.4.2, v4.4.3, v4.4.4, v4.4.5, v4.4.6, v4.4.7, v4.4.8, v4.4.9] but these conflict with your requirements or minimum-stability.
- povils/phpmnd v2.2.0 requires symfony/console ^4.0 -> satisfiable by symfony/console[4.0.x-dev, 4.1.x-dev, 4.2.x-dev, 4.3.x-dev, 4.4.x-dev, v4.0.0, v4.0.0-BETA1, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.0-RC1, v4.0.0-RC2, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.0-BETA1, v4.1.0-BETA2, v4.1.0-BETA3, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.0-BETA1, v4.2.0-BETA2, v4.2.0-RC1, v4.2.1, v4.2.10, v4.2.11, v4.2.12, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.0-BETA1, v4.3.0-BETA2, v4.3.0-RC1, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9, v4.4.0, v4.4.0-BETA1, v4.4.0-BETA2, v4.4.0-RC1, v4.4.1, v4.4.10, v4.4.2, v4.4.3, v4.4.4, v4.4.5, v4.4.6, v4.4.7, v4.4.8, v4.4.9] but these conflict with your requirements or minimum-stability.
- povils/phpmnd v2.2.0 requires symfony/console ^4.0 -> satisfiable by symfony/console[4.0.x-dev, 4.1.x-dev, 4.2.x-dev, 4.3.x-dev, 4.4.x-dev, v4.0.0, v4.0.0-BETA1, v4.0.0-BETA2, v4.0.0-BETA3, v4.0.0-BETA4, v4.0.0-RC1, v4.0.0-RC2, v4.0.1, v4.0.10, v4.0.11, v4.0.12, v4.0.13, v4.0.14, v4.0.15, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7, v4.0.8, v4.0.9, v4.1.0, v4.1.0-BETA1, v4.1.0-BETA2, v4.1.0-BETA3, v4.1.1, v4.1.10, v4.1.11, v4.1.12, v4.1.2, v4.1.3, v4.1.4, v4.1.5, v4.1.6, v4.1.7, v4.1.8, v4.1.9, v4.2.0, v4.2.0-BETA1, v4.2.0-BETA2, v4.2.0-RC1, v4.2.1, v4.2.10, v4.2.11, v4.2.12, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9, v4.3.0, v4.3.0-BETA1, v4.3.0-BETA2, v4.3.0-RC1, v4.3.1, v4.3.10, v4.3.11, v4.3.2, v4.3.3, v4.3.4, v4.3.5, v4.3.6, v4.3.7, v4.3.8, v4.3.9, v4.4.0, v4.4.0-BETA1, v4.4.0-BETA2, v4.4.0-RC1, v4.4.1, v4.4.10, v4.4.2, v4.4.3, v4.4.4, v4.4.5, v4.4.6, v4.4.7, v4.4.8, v4.4.9] but these conflict with your requirements or minimum-stability.
- Installation request for povils/phpmnd ^2.2 -> satisfiable by povils/phpmnd[v2.2.0].
Given the following code
Package jakub-onderka/php-console-highlighter is abandoned, you should avoid using it. Use php-parallel-lint/php-console-highlighter instead
Keep a change log, it's best practicse nowadays:
http://keepachangelog.com/en/0.3.0/
For example:
https://github.com/thephpleague/skeleton/blob/master/CHANGELOG.md
php phpmnd.phar mysrcpath
I thought about implementing of showing possible constants for magic numbers and strings. I will not mention strings below, as I think the principles for numbers and strings are similar. Below I will describe possible interface implementation and some thougts about probability of constants hinting.
Below is the example of an interface implementation for console output:
--------------------------------------------------------------------------------
src/SomeTestFile.php:34. Magic number: 1121
Possible constants:
SomeTestFile::SOME_NUMBER
> 34| if (($x == 1121) || ($x == 2351)) {
src/SomeTestFile.php:34. Magic number: 2351
Possible constants:
SomeTestFile::SOME_OTHER_NUMBER
> 34| if (($x == 1121) || ($x == 2351)) {
--------------------------------------------------------------------------------
Constant hinting:
I was thinking about this idea for some time, and found out that all the use-cases of magic numbers can be divided into two big groups:
This description does not covers some interesting topics like constant order in hints, number of constants shown in hints etc. But I think they can be specified later.
Since the number of options keeps growing it would be considerable to allow their configuration via a dedicated configuration file. Whether this happens via a programmtic approach, like done by the PHP Coding Standards Fixer or via a configuration format of choice e.g. yaml
, json
or ini
is up to you.
A contribution guide could help the potential contributors to create pull requests and issues in a quality the project expects.
For example:
https://github.com/thephpleague/skeleton/blob/master/CONTRIBUTING.md
PHP-Parser 4.0.0 has been released 17 days ago.
When I'm trying to use PHP Magic Number Detector
and PHP-Parser 4
together, I run into error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- povils/phpmnd dev-master requires nikic/php-parser ^3.0 -> satisfiable by nikic/php-parser[3.x-dev, v3.0.0, v3.0.0alpha1, v3.0.0beta1, v3.0.0beta2, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.1.0, v3.1.1, v3.1.2, v3.1.3, v3.1.4, v3.1.5] but these conflict with your requirements or minimum-stability.
- povils/phpmnd dev-master requires nikic/php-parser ^3.0 -> satisfiable by nikic/php-parser[3.x-dev, v3.0.0, v3.0.0alpha1, v3.0.0beta1, v3.0.0beta2, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.1.0, v3.1.1, v3.1.2, v3.1.3, v3.1.4, v3.1.5] but these conflict with your requirements or minimum-stability.
- Installation request for povils/phpmnd dev-master -> satisfiable by povils/phpmnd[dev-master].
Hey,
I'm currently running mnd on a larger codebase (~1k classes) and noticed that the tools reports some warnings that I would not consider a problem in the specific context. This clutters the output and prevents a 0 exit code.
It would be great if we could introduce something like
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-parts-of-a-file
to mark certain exceptions as "okay".
Currently, I'd have to ignore the whole file via `--exclude-file=.." - which I'd like to avoid.
PS: This frequently happens on the null coalesce operator for setting default values. E.g.
function foo($arg = null){
$arg = $arg ?? 1000;
}
Having that operator "removed" from the "conditions" extension (per config?) would also help a lot ;)
Any thoughts?
Make an option --exclude-file
(multiple) which will exclude specific files from code analysis.
On large code bases phpmnd can be very slow. Allow a list of files to be passed in as text / stdin.
This file would usually be generated from your VCS software
Can v2.1.0 be released ? To get the whitelist files
PHP Mess Detector and PHP Code Sniffer support various report output formats.
Supporting certain formats could make the check results of phpmnd non-human processable.
For example, this way, a continuous integration system/service like Scrutinizer could use the results in its application.
<?php
$a = [];
unset($a[1234]);
Shows no magic numbers
Though it will be enforced through Composer, it would be better to clearly state the system requirements.
What OSes are generally supported? I Assume at least:
What PHP versions are supported?
According to https://github.com/povils/phpmnd/blob/v1.0.3/composer.json#L21 it would be PHP 5.6.+ incl. 7.x, right now.
Are there any PHP extensions needed? It seems not, at the moment.
I have a Symfony 4 project where i like to install phpmnd locally, i get the following error:
$ composer require --dev povils/phpmnd
Using version ^1.1 for povils/phpmnd
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- povils/phpmnd v1.1.1 requires symfony/console ^2.4 || ^3.0 -> satisfiable by symfony/console[2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev, 3.1.x-dev, 3.2.x-dev, 3.3.x-dev, 3.4.x-dev, v2.4.0, v2.4.0-BETA1, v2.4.0-BETA2, v2.4.0-RC1, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.0-BETA1, v2.6.0-BETA2, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.40, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.33, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.0-BETA1, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.0-RC1, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.15, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2, v3.4.1, v3.4.2, v3.4.3] but these conflict with your requirements or minimum-stability.
- povils/phpmnd v1.1.0 requires symfony/console ^2.4 || ^3.0 -> satisfiable by symfony/console[2.4.x-dev, 2.5.x-dev, 2.6.x-dev, 2.7.x-dev, 2.8.x-dev, 3.0.x-dev, 3.1.x-dev, 3.2.x-dev, 3.3.x-dev, 3.4.x-dev, v2.4.0, v2.4.0-BETA1, v2.4.0-BETA2, v2.4.0-RC1, v2.4.1, v2.4.10, v2.4.2, v2.4.3, v2.4.4, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9, v2.5.0, v2.5.0-BETA1, v2.5.0-BETA2, v2.5.0-RC1, v2.5.1, v2.5.10, v2.5.11, v2.5.12, v2.5.2, v2.5.3, v2.5.4, v2.5.5, v2.5.6, v2.5.7, v2.5.8, v2.5.9, v2.6.0, v2.6.0-BETA1, v2.6.0-BETA2, v2.6.1, v2.6.10, v2.6.11, v2.6.12, v2.6.13, v2.6.2, v2.6.3, v2.6.4, v2.6.5, v2.6.6, v2.6.7, v2.6.8, v2.6.9, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.40, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.33, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.0-BETA1, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.0-RC1, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.15, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2, v3.4.1, v3.4.2, v3.4.3] but these conflict with your requirements or minimum-stability.
- Installation request for povils/phpmnd ^1.1 -> satisfiable by povils/phpmnd[v1.1.0, v1.1.1].
I ran composer update
but it changed nothing.
Good day, I get an issue for such case. Package doesn't recognize this like a magic number
$limit = Carbon::now()->addYears(-123123);
Interesting that with the second example works fine
$limit = Carbon::now()->addYears(123123);
As I understand it's bug or I'm wrong
Currently a command run with n magic numbers found evaluates to 0 via echo $?
. This should prolly should return a non zero exit code for usage in CI tooling.
Just a quick question on whether having an "all" extensions option would be appropriate, or is there a deliberate choice to make that slightly hard (e.g. users not understanding it's not necessarily a good idea as Step 1).
Especially if this tools becomes bigger and gets more features, it would benefit from having a complete documentation.
This documentation should not live in the README.md, as it would bloat it over time.
Such a documentation could live in an informational website (#17), on an external host such as Read the Docs or simply as a collection of linked Markdown files in the docs folder or a mixture of them (like Composer).
Such a documentation should also document how to extend the current library, if necessary or possible.
I've a general preference for using composer require --dev
rather than using global installs/phar builds.
Are there any plans to nudge up compatibility with symfony/console, i.e. symfony/console:^4.0|^5.0
?
Create an option ignore-func
(comma separted) which will ignore functions in code analysis when using 'argument' extension.
Example:
phpmnd code --ignore-func=round,usleep,sleep --extensions=argument
povils/phpmnd (dev-master 0471854)
$phpmnd app
phpmnd 2.1.0 by Povilas Susinskas
PHP Notice: Undefined property: PhpParser\Node\Expr\PropertyFetch::$value in /Users/xxx/xxx/vendor/povils/phpmnd/src/Visitor/DetectorVisitor.php on line 55
PHP Stack trace:
PHP 1. {main}() /Users/xxx/xxx/vendor/povils/phpmnd/bin/phpmnd:0
PHP 2. Povils\PHPMND\Console\Application->run() /Users/xxx/xxx/vendor/povils/phpmnd/bin/phpmnd:40
PHP 3. Povils\PHPMND\Console\Application->doRun() /Users/xxx/xxx/vendor/symfony/console/Application.php:145
PHP 4. Povils\PHPMND\Console\Application->doRun() /Users/xxx/xxx/vendor/povils/phpmnd/src/Console/Application.php:66
PHP 5. Povils\PHPMND\Console\Application->doRunCommand() /Users/xxx/xxx/vendor/symfony/console/Application.php:262
PHP 6. Povils\PHPMND\Console\Command->run() /Users/xxx/xxx/vendor/symfony/console/Application.php:901
PHP 7. Povils\PHPMND\Console\Command->execute() /Users/xxx/xxx/vendor/symfony/console/Command/Command.php:255
PHP 8. Povils\PHPMND\Detector->detect() /Users/xxx/xxx/vendor/povils/phpmnd/src/Console/Command.php:172
PHP 9. PhpParser\NodeTraverser->traverse() /Users/xxx/xxx/vendor/povils/phpmnd/src/Detector.php:51
PHP 10. PhpParser\NodeTraverser->traverseArray() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:91
PHP 11. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PHP 12. PhpParser\NodeTraverser->traverseArray() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PHP 13. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PHP 14. PhpParser\NodeTraverser->traverseArray() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PHP 15. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PHP 16. PhpParser\NodeTraverser->traverseArray() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PHP 17. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PHP 18. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:146
PHP 19. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:146
PHP 20. PhpParser\NodeTraverser->traverseArray() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:114
PHP 21. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:223
PHP 22. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:146
PHP 23. PhpParser\NodeTraverser->traverseNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:146
PHP 24. Povils\PHPMND\Visitor\DetectorVisitor->enterNode() /Users/xxx/xxx/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php:123
The rest of the checks work fine and gives the normal output
Total of Magic Numbers: 10
Time: 1.54 seconds, Memory: 124.00 MB
Hello. I see some nice features in the master branch, however the last release is pretty old. Are you going to release a new version soon?
Integrate with Stickler CI to check and enforce the coding style of your choice (PSR-2, i believe).
It would be nice to be able to define which files get checked by providing a comma separated list of file extensions.
That could look like:
$ phpmnd cakephp-app --file-extensions=php,php5,ctp,bla.foo
The above would check files with the following file extension:
This is relevant for every PHP project that has more than just the typical .php
files.
For example, CakePHP has template files with the .ctp
extension.
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.