-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from bitExpert/enhancement/beanconfiguration
Check bean return type against return type annotation
- Loading branch information
Showing
3 changed files
with
127 additions
and
2 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
58 changes: 58 additions & 0 deletions
58
tests/bitExpert/Disco/Config/WrongReturnTypeConfiguration.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,58 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Disco package. | ||
* | ||
* (c) bitExpert AG | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
namespace bitExpert\Disco\Config; | ||
|
||
use bitExpert\Disco\Annotations\Bean; | ||
use bitExpert\Disco\Annotations\Configuration; | ||
use bitExpert\Disco\Helper\MasterService; | ||
use bitExpert\Disco\Helper\SampleService; | ||
|
||
/** | ||
* @Configuration | ||
*/ | ||
class WrongReturnTypeConfiguration | ||
{ | ||
/** | ||
* @Bean({"singleton"=false, "lazy"=false, "scope"="request"}) | ||
* @return SampleService | ||
*/ | ||
public function nonLazyBeanNotReturningAnything() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* @Bean({"singleton"=false, "lazy"=false, "scope"="request"}) | ||
* @return SampleService | ||
*/ | ||
public function nonLazyBeanReturningSomethingWrong() | ||
{ | ||
return new MasterService(new SampleService()); | ||
} | ||
|
||
/** | ||
* @Bean({"singleton"=false, "lazy"=true, "scope"="request"}) | ||
* @return SampleService | ||
*/ | ||
public function lazyBeanNotReturningAnything() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* @Bean({"singleton"=false, "lazy"=true, "scope"="request"}) | ||
* @return SampleService | ||
*/ | ||
public function lazyBeanReturningSomethingWrong() | ||
{ | ||
return new MasterService(new SampleService()); | ||
} | ||
} |