parsedown-extra
parsedown-extra copied to clipboard
ParsedownExtra.php and tests classes are declared as psr-0 in composer.json but are not compliant with psr-0
The psr-0 field in composer.json is wrong since the ParsedownExtra class (and also the classes in test files) are not PSR-0-compliant e.g. the classes are not even namespaced.
Maybe it is simpler and more correct to declare them under classmap?
With the latest versions of Composer, this problem generates some warnings like:
Deprecation Notice: Class ParsedownExtraTest located in ./vendor/erusev/parsedown-extra/test/ParsedownExtraTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/Cellar/composer/1.10.10/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
+1
+1
Until this is fixed, I have excluded the parsedown-extra tests from my composer.json file by appending the tests folder from this package in exclude-from-classmap:-
"autoload": {
"exclude-from-classmap": [
"vendor/erusev/parsedown-extra/test/"
]
}
I am hoping this can aid other people in getting rid of this warning until the package maintainer resolves the issue.
Edit: For further information on this see the composer documentation https://getcomposer.org/doc/04-schema.md#exclude-files-from-classmaps
With upcoming composer v2 this package will break on install, unless that workround keep working with composer v2.

@robsontenorio
I have tested this with the current preview build (2.0.0-RC2) and I did not see any problems with the autoloading. So I am pretty sure this should cover the release of v2.0. I will continue to relay any feedback/issues as I encounter them. At least this should let us use this package post 2.0 release (fingers crossed).
@lerouse the package maintainer would accept a PR? As I can see it is about just moving test file to the right folder.
Edit: declare files and test namespaces according standard.
I believe so, there is already a PR in https://github.com/erusev/parsedown-extra/pull/154 by @KentarouTakeda that would resolve this issue but the CI is failing on php v5.3 https://travis-ci.org/github/erusev/parsedown-extra/jobs/692841233
Which is using .gitattributes to ignore the test folder from the package (technically the better way to handle tests not being included in the package).
I am not sure if this will be fixed/merged at any point?
Deprecation Notice: Class ParsedownExtraTest located in ./vendor/erusev/parsedown-extra/test/ParsedownExtraTest.php does not comply with psr-0 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201
- Actually, what is the part that's non-compliant?
test/TestParsedown.phpwas not flagged by composer 1.x- Renaming
ParsedownExtraTest.phptoTestParsedownExtraTest.phpmade the error go away. Is this a possible fix?
@bilogic I don't think PSR-0 says anything about not-namespaced classes; yet the classes here are supposed to be loaded through PSR-0 but they're not namespaced. Correct me if wrong.
I made a MR to parsedown first, because parsedown suffers from a similar problem. If it were up to me, I would solve it first in parsedown, then in parsedown-extra.
https://github.com/erusev/parsedown/pull/794
However, my team and I were using this library only in a tiny use case, and now replaced it with different Commonmark parser.
I will leave this ticket open because it may be relevant for other people, but I might probably disengage from this conversation.
@bilogic I cannot answer your question (2) but I assume that Composer 1.x was loading the class anyway with something like a classmap (i.e. you'd have to run composer dump-autoload every time if there were new or changed files in the vendor directory--(off topic) you probably don't care if this is a third-party library that you won't change yourself, but it is an inconvenience if it is your application code.
About question (3) I don't know, but like I mentioned, my team isn't using this library anymore now, so I won't keep an eye on this ticket.