Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Anders Jenbo
@AJenbo
@kylekatarnls @manderson the issues with count() is because invalid input to the function has been deprecated since PHP 7.2. This is one of the issues I'm working to eradicate from the codebase (mainly on the PDepend side of things at the moment).
scope-li
@scope-li
Hi, is anybody here?
It's possible, that all current phpmd version has absolutely no support for php 7.4 and typed properties?
Kyle
@kylekatarnls
Hello, yes, we actually re-maintain the project after a long period of inactivity.
We currently finish supporting PHP 7.1 and 7.2 features. See pdepend/pdepend#383
Features of 7.3 and 7.4 should be a bit easier to handle but we need to proceed incrementally.
scope-li
@scope-li
Oh, so i looking on the wrong github repo (pdepend and not phpmd)
Thanks for the feedback
Anders Jenbo
@AJenbo
phpmd is build on top of pdepend so that is where the support needs to be added (at least first)
Kyle
@kylekatarnls
pdepend is our parser, this is the library that allow us to read your PHP files and understand them.
phpmd is the rule checker that will use what pdepend read to know if rules are fulfilled or not.
scope-li
@scope-li
Your are right, it's my mistake, if I don't check the dependency from phpmd ;-)
kierandelaney
@kierandelaney
Hi guys, we have some feedback on the beta release this morning, but I don't want to log a ticket because I haven't got much more than a bad feeling, not sure how best to diagnose and give you as much detail as possible... basically - we downloaded the phar and when you run it against a project it shows no errors. Even when you deliberately add some. We've looked through recent commits and see no reason for that, we even disabled xdebug in case, and no dice.
A php file with the single line $ennvbnvbnvbnvbnfeffwwwwwwwwfvbnvbnbvnvbnvnvbnvbnvbnvbnvbnvbnvbnnlndkegibeuyberguyberuyberuyfwfwefwfwefwefwefwefwefwefwefwefwefwefwefwfberuyfberyufberyufyeufbuyerbfeuybfuylastic = TRUE; and the command phpmd tester.php xml naming should yield at least one error LongVariable but the output is empty.
kierandelaney
@kierandelaney
I can log an issue if it helps, but as you can see I don't have much to go on and I am not sure what info is actually helpful - tested on PHP 7.2.25 and PHP 7.3.12
Tobias van Beek
@tvbeek
@kierandelaney I beleave that PHPMD currently doesn't check the most code outside classes. So your example will probably also not work with an older PHPMD version. Did you check it?
We should like to have an issue with parts that did work with 2.7 but not with the beta.
kierandelaney
@kierandelaney
Yes that example works in 2.7
The majority of the code we check is not in a class and PHPMD has always worked well for us for the rules we care about :)
At this point I cannot trigger any rule with the beta, but they work just fine in 2.7 - I wonder if this is something to do with our environments but we have removed and reinstalled PHP with no extensions so I am not sure how to identify what might be causing it, it is like it is skipping every single rule.
Kyle
@kylekatarnls

I just did the following:

echo "<?php copy('https://github.com/phpmd/phpmd/releases/download/2.7.0/phpmd.phar', 'phpmd.phar');" | php
php phpmd.phar file.php text naming

with file.php containing just <?php then the code you gave.

And phpmd 2.7.0 output no error so do 2.8.0 as this point is not yet fixed. It's in discussion on multiple issues including this one: phpmd/phpmd#681
Then I wrapped you code into a method into a class and re-run both phpmd 2.7.0 and 2.8.0-beta.1
Both gave the same output:
file.php:7       Avoid excessively long variable names like $ennvbnvbnvbnvbnfeffwwwwwwwwfvbnvbnbvnvbnvnvbnv. Keep variable name length under 20.
Please provide a code chunk that can show the regression (that we can run on both 2.7.0 and 2.8.0-beta.1 and give a different result)
Ideally a unit test we can add directly in the project.
kierandelaney
@kierandelaney
Ah, I am sorry, when I reverted to the older version we were testing against, it was 2.6.1
Kyle
@kylekatarnls
Thanks, I will download it and retry.
kierandelaney
@kierandelaney
We skipped 2.7.0 because the released PHAR did not work with PHP7.2
Kyle
@kylekatarnls
Sorry but still no output for the LongVariable rule using your code and PHPMD 2.6.1.
kierandelaney
@kierandelaney
Sigh I am so sorry for wasting your time - I understand the issue now. Our test case has never worked, but we thought it did because we do see errors inside functions (despite not using classes).
Kyle
@kylekatarnls
Yes in fact most rules (but not all) are based on symbols (classes, interfaces, functions, etc.)
kierandelaney
@kierandelaney
So phpmd/phpmd#681 is pretty much our issue and we failed to understand that was a limitation. More or less everything is wrapped in a function on our side so we do in fact see PHPMD lints very often and convinced ourselves it worked everywhere.
So actually there is no regression.
Kyle
@kylekatarnls
And so they ignore pure inline PHP code.
kierandelaney
@kierandelaney
But we do now understand a bit more how PHPMD works.
Sorry - I will update our test case so we are not being dumb in future.
Thanks so much for your help.
@tvbeek thanks for your help as well, you were right and I should have read your message more clearly. :)
Tobias van Beek
@tvbeek
No problem, still thanks for reporting. We really like feedback on the beta.
kierandelaney
@kierandelaney
As it stands - it is doing what we expected and we have finally been able to bin PHP@7.1 on the CLI side.
Kyle
@kylekatarnls
The only advice I can give you for now is using functions/classes as often as you can, it's not only to help static analyzers, it also help re-usability of the code and encapsulation.
kierandelaney
@kierandelaney
Yeah we do mostly, which is why we've never noticed it not working on inline code as we have so little of it :D
Thanks again everyone, it is so good to see this project reinvigorated!
Kyle
@kylekatarnls
You're welcome
Marc W├╝rth
@ravage84
@kierandelaney could your problem have been prevented with improved documentation?
kierandelaney
@kierandelaney
@ravage84 I think so. I am happy to contribute, is a PR the best way to do that?
Kyle
@kylekatarnls
kierandelaney
@kierandelaney
:thumbsup: