-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
PropertyInfo does not depend on phpdocumentor/reflection-docblock in require block #26259
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
Comments
Your message is controversial. If you don't use PhpDocExtractor, how could it become a problem? And what's the difference between dev and prod environments concerning dependency's dev dependencies? They are not installed in both cases. So you should have noticed the problem while development. |
I'll try to clarify, I see now my usecase is not fully reproducible from above: mkdir property-info-deps && cd property-info-deps
composer require symfony/property-info ^3
composer require --dev phpunit/phpunit ^6
composer why phpdocumentor/reflection-docblock
# phpspec/prophecy 1.7.5 requires phpdocumentor/reflection-docblock (^2.0|^3.0.2|^4.0)
composer why phpspec/prophecy
# phpunit/phpunit 6.5.6 requires phpspec/prophecy (^1.7)
{
"require": {
"symfony/property-info": "^3"
},
"require-dev": {
"phpunit/phpunit": "^6"
}
}
Then I could have code like the following: use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor;
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
$listExtractors = [new ReflectionExtractor()];
$phpDocExtractor = new PhpDocExtractor();
$typeExtractors = array_merge($listExtractors, [$phpDocExtractor]);
$descriptionExtractors = [$phpDocExtractor];
new PropertyInfoExtractor($listExtractors, $typeExtractors, $descriptionExtractors); In the above code, I don't use anything from the If the If I had PHP classes and interfaces in my |
So I use |
I see the problem you faced. But phpdocumentor/reflection-docblock is an optional dependency. Making it a requirement for everyone does not seem right either. |
@Tobion I understand that and I think the Optional dependencies should be injected as an instance and not created on the fly. At least a |
see #26265 |
…t exist (xabbuh) This PR was merged into the 3.4 branch. Discussion ---------- [PropertyInfo] throw exception if docblock factory does not exist | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26259 | License | MIT | Doc PR | Commits ------- 5cfceed throw exception if docblock factory does not exist
Uh oh!
There was an error while loading. Please reload this page.
The PropertyInfo component lists the
phpdocumentor/reflection-docblock
package as a developer dependency inrequire-dev
:symfony/src/Symfony/Component/PropertyInfo/composer.json
Lines 29 to 35 in 6651087
However, the
PhpDocExtractor
class depends on an interface and a class from that package without you using it directly.symfony/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php
Lines 54 to 56 in 6651087
The PropertyInfo component documentation states:
https://symfony.com/doc/current/components/property_info.html#phpdocextractor
I believe when the non-tests related code of the component has a dependency on a package, it should be in
require
instead ofrequire-dev
.This caused a problem for us in production when we had the documentor package installed in development, but not listed in neither our own
require
norrequire-dev
dependencies as we do not use it anywhere in our code.The text was updated successfully, but these errors were encountered: