Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DI] Add support for getter autowiring
- Loading branch information
1 parent
03b7cf7
commit c48c36b
Showing
5 changed files
with
160 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/Symfony/Component/DependencyInjection/Tests/Fixtures/GetterOverriding.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Fixtures; | ||
|
||
use Symfony\Component\DependencyInjection\Tests\Compiler\A; | ||
use Symfony\Component\DependencyInjection\Tests\Compiler\B; | ||
use Symfony\Component\DependencyInjection\Tests\Compiler\Bar; | ||
use Symfony\Component\DependencyInjection\Tests\Compiler\Foo; | ||
|
||
/** | ||
* To test getter autowiring with PHP >= 7.1. | ||
* | ||
* @author Kévin Dunglas <dunglas@gmail.com> | ||
*/ | ||
class GetterOverriding | ||
{ | ||
public function getFoo(): ?Foo | ||
{ | ||
// should be called | ||
} | ||
|
||
protected function getBar(): Bar | ||
{ | ||
// should be called | ||
} | ||
|
||
public function getNoTypeHint() | ||
{ | ||
// should not be called | ||
} | ||
|
||
public function getUnknown(): NotExist | ||
{ | ||
// should not be called | ||
} | ||
|
||
public function getExplicitlyDefined(): B | ||
{ | ||
// should be called but not autowired | ||
} | ||
|
||
public function getScalar(): string | ||
{ | ||
// should not be called | ||
} | ||
|
||
final public function getFinal(): A | ||
{ | ||
// should not be called | ||
} | ||
|
||
public function &getReference(): A | ||
{ | ||
// should not be called | ||
} | ||
} |