Skip to content

Commit

Permalink
assume service as public if public attribute is missing (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov committed Mar 15, 2020
1 parent 007d3c6 commit c2b2dd4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Symfony/ContainerMeta.php
Expand Up @@ -33,7 +33,7 @@ public function __construct(string $containerXmlPath)
if (isset($serviceAttributes->alias)) {
$service->setAlias((string) $serviceAttributes->alias);
}
$service->setIsPublic('true' === (string) $serviceAttributes->public);
$service->setIsPublic('false' !== (string) $serviceAttributes->public);

$this->add($service);
}
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/container.xml
Expand Up @@ -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>
5 changes: 5 additions & 0 deletions tests/unit/Symfony/ContainerMetaTest.php
Expand Up @@ -57,6 +57,11 @@ public function publicServices()
'className' => 'Symfony\Component\HttpKernel\HttpKernel',
'isPublic' => true,
],
[
'id' => 'public_service_wo_public_attr',
'className' => 'Foo\Bar',
'isPublic' => true,
],
];
}

Expand Down

0 comments on commit c2b2dd4

Please sign in to comment.