-
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
count(): Parameter must be an array or an object that implements Countable #1914
Comments
[20-Nov-2017 15:16:28 Europe/Vienna] PHP Warning: count(): Parameter must be an array or an object that implements Countable in phar:///mnt/data/www/thelounge.net/contentlounge/updateservice/phpDocumentor.phar/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1293 |
I fixed the problem by checking whether $thing implements the Countable interface. Changed the function to: |
I can confirm the behaviour;
Really affects the documentation. |
To add to what @imelgrat said, you may want to change the file
You should change line 33 from
to
If you are using the PHAR version, you will have to extract it to a zip, then apply the fix |
frankly why can't there be a current devel-version as phar to download since even PHP 7.1.x syntax is not supported currently and so half of the documentations are not generated at all when the codebase is using nullable return types? |
Please try the alpha version of v3. It is still work in progress but it will help you out. |
WHERE can i download a phar of v3 |
don't work at all meaning generates empty docs first it don't understand things like "--filename="/www/phpincludes/global*.php" any longer second the following call also leads in empty docs /usr/bin/time -f "%E" php -d "extension=tokenizer.so" "$CMS_UPDATE_SERVICE_LOCATION/phpDocumentor.phar" run --force --progressbar --cache-folder="/tmp" --encoding="ISO-8859-1" --directory="$CMS_UPDATE_SERVICE_LOCATION/package" --filename="/www/phpincludes/newsletter.php" --ignore="modules/blog/tagcloud.php" --target="$CMS_UPDATE_SERVICE_LOCATION/documentation/code-referenzen/contentlounge" --title="ContentLounge - Technische Referenz" --defaultpackagename="ContentLounge" --template="clean" ContentLounge - Technische Referenz |
I dont know , i did correct or not in php7.2 changed the function
get rid of warning but shows some message while doc generated in command prompt : Unable to find the |
@wilroydmello, the problem is not related to the twig_length_filter function itself but to not having GraphViz installed (or properly configured) on your machine. If you're running your site on Windows, the steps to resolve this error are:
If you're running a Linux server, you need to run the following command to install and configure GrapViz
After that, you should be able to run phpdoc using Graphviz |
Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Switch to normal PHPUnit instead of the Symfony bridge, for testing in CI. We'll return to the bridge after upgrading to Symfony 4. Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Switch to normal PHPUnit instead of the Symfony bridge, for testing in CI. We'll return to the bridge after upgrading to Symfony 4. Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Switch to normal PHPUnit instead of the Symfony bridge, for testing in CI. We'll return to the bridge after upgrading to Symfony 4. Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Switch to normal PHPUnit instead of the Symfony bridge, for testing in CI. We'll return to the bridge after upgrading to Symfony 4. Doctrine\ORM\EntityRepository::findOneBy() returns NULL if nothing is found, and as of PHP 7.2 this isn't countable. Also add PHP 7.2 to CI, for future bug-catching, and exclude phpdoc for now (pending resolution of phpDocumentor/phpDocumentor#1914 ).
Applied both patches. Now it works OK on PHP 7.2 (phar file in zip archive) |
see: phpDocumentor/phpDocumentor#1914 Graphviz is needed by phpdoc so should be in Dockerfile
see: phpDocumentor/phpDocumentor#1914 and previous commit.
I just want to give alpha.2 a try but I have no luck at all and I can't find any "breaking changes" document. It's so annoying - @LewisJohnson this is quiet useless patch: if ($value instanceof ValidationValueObject && $value instanceof Countable && count($value->argument) > 0) If $count = is_array($value->argument) || $value->argument instanceof \Countable ? count($value->argument) : 0;
if ($value instanceof ValidationValueObject && $count > 0) |
See phpDocumentor/phpDocumentor#1914 Using the phar to avoid having to depend of dev versions of phpDocumentor and it's dependencies in composer json
Thank you very much, resolved here. I saw this same problem on a 4 day open issue, it would be nice to update officially with the fix, thanks again for the help. |
I just should warn themes do not work in phar due to internal unfixable PHPDoc2 bug so if you want to use them you should use unpacked version. If you have ideas how to patch this just let me know |
Thanks for the info. |
The Dockerfile uses |
Actually, I think if ($value instanceof ValidationValueObject) {
$argument = $value->argument;
if ((\is_array($argument) || $argument instanceof \Countable) && \count($argument) > 0) {
/* @var $params \phpDocumentor\Descriptor\Collection */
// ...
}
} |
This issue is about the Validators in phpDocumentor 2.9. That system was removed in 3.0 and is not scheduled to be reintroduced soon. phpDocumentor 2.9 is also not scheduled to include support for PHP 7 or higher. As such, any issues in the validator mechanism should be resolved in the 2.9 branch and is not included in our work on 3.0. To resolve this item soon, assistance is needed from the community in the form of a PR on the 2.9 branch. |
Hi @JakeQZ, I'm glad that you are paying more attention than I was 😅 We'll need to do a release then! At this moment I am wrapped in another effort; after that is finished I'll check out that release (2.9 did not have a fully automated release cycle yet) |
Release is complete: https://github.com/phpDocumentor/phpDocumentor/releases/tag/v2.9.1 The phar is now downloadable from that location. I still need to build and release the PEAR archive but I am running into a couple issues there |
I downloaded the phar file from https://github.com/phpDocumentor/phpDocumentor/releases/tag/v2.9.1 and this gave me the exact same error, just this time it was twig acting up. The I have a suspicion, that it relates to how phpDoc uses twig, rather than a twig bug, but i only made it go away, by modifying the twig file, so no PR, unfortunately. |
If you are using phpdocumentor in a modern project you might want to check our latest beta release. But please don't reply on closed issues. They are not traceable. |
beside that it's time to support nullable return types of PHP 7.1 with PHP 7.2 you have tons of new runtime warnings:
Warning: count(): Parameter must be an array or an object that implements Countable in phar:///mnt/data/www/thelounge.net/contentlounge/updateservice/phpDocumentor.phar/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Constraints/Functions/IsArgumentInDocBlockValidator.php on line 33
The text was updated successfully, but these errors were encountered: