assume service as public if public attribute is missing (#15)

This commit is contained in:
Farhad Safarov 2020-03-15 13:38:16 +03:00 committed by GitHub
parent 007d3c6511
commit c2b2dd4ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View File

@ -33,7 +33,7 @@ class ContainerMeta
if (isset($serviceAttributes->alias)) {
$service->setAlias((string) $serviceAttributes->alias);
}
$service->setIsPublic('true' === (string) $serviceAttributes->public);
$service->setIsPublic('false' !== (string) $serviceAttributes->public);
$this->add($service);
}

View File

@ -16,5 +16,6 @@
<service id="Symfony\Component\HttpKernel\HttpKernelInterface" alias="http_kernel" public="true"/>
<service id="Foo\Bar" class="Foo\Bar" public="false"/>
<service id="private_service" class="Foo\Bar" public="false"/>
<service id="public_service_wo_public_attr" class="Foo\Bar"/>
</services>
</container>

View File

@ -57,6 +57,11 @@ class ContainerMetaTest extends TestCase
'className' => 'Symfony\Component\HttpKernel\HttpKernel',
'isPublic' => true,
],
[
'id' => 'public_service_wo_public_attr',
'className' => 'Foo\Bar',
'isPublic' => true,
],
];
}