File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1678,6 +1678,47 @@ abstract class AbstractController extends Controller
1678
1678
1679
1679
<br>
1680
1680
1681
+ # ## AlreadyRegisteredAutodiscoveryServiceRule
1682
+
1683
+ Remove service, as already registered via autodiscovery ->load(), no need to set it twice.
1684
+
1685
+ ` ` ` yaml
1686
+ rules:
1687
+ - Symplify\P HPStanRules\R ules\S ymfony\C onfigClosure\A lreadyRegisteredAutodiscoveryServiceRule
1688
+ ` ` `
1689
+
1690
+ ` ` ` php
1691
+ use Symfony\C omponent\D ependencyInjection\L oader\C onfigurator\C ontainerConfigurator;
1692
+
1693
+ return static function (ContainerConfigurator $containerConfigurator): void {
1694
+ $services = $containerConfigurator->services();
1695
+
1696
+ $services->load('App\\ ', __DIR__ . '/../src')
1697
+ ->exclude([__DIR__ . '/src/Services']);
1698
+
1699
+ $services->set(SomeService::class);
1700
+ };
1701
+ ` ` `
1702
+
1703
+ :x :
1704
+
1705
+ <br>
1706
+
1707
+ ` ` ` php
1708
+ use Symfony\C omponent\D ependencyInjection\L oader\C onfigurator\C ontainerConfigurator;
1709
+
1710
+ return static function (ContainerConfigurator $containerConfigurator): void {
1711
+ $services = $containerConfigurator->services();
1712
+
1713
+ $services->load('App\\ ', __DIR__ . '/../src')
1714
+ ->exclude([__DIR__ . '/src/Services']);
1715
+ };
1716
+ ` ` `
1717
+
1718
+ :+1 :
1719
+
1720
+ <br>
1721
+
1681
1722
# ## ServicesExcludedDirectoryMustExistRule
1682
1723
1683
1724
Services excluded path must exist. If not, remove it
You can’t perform that action at this time.
0 commit comments