File tree Expand file tree Collapse file tree 11 files changed +26975
-54
lines changed
Expand file tree Collapse file tree 11 files changed +26975
-54
lines changed Original file line number Diff line number Diff line change 1111 fail-fast : false
1212 matrix :
1313 php :
14- - ' 7.3'
1514 - ' 7.4'
1615 - ' 8.0'
1716 - ' 8.1'
Original file line number Diff line number Diff line change 55use Bref \Runtime \LambdaRuntime ;
66use Dayspring \LambdaBundle \Service \LambdaHandlerServiceInterface ;
77use Symfony \Component \Console \Output \BufferedOutput ;
8- use Symfony \Component \Debug \Debug ;
8+ use Symfony \Component \ErrorHandler \Debug ;
99use Symfony \Component \Dotenv \Dotenv ;
1010
1111// memory to save for system overhead (in MB)
5151/** @var LambdaHandlerServiceInterface $service */
5252$ service = null ;
5353try {
54- $ kernel = new AppKernel ($ env , $ debug );
54+ $ kernelClass = getenv ('KERNEL_CLASS ' ) ?: 'AppKernel ' ;
55+ $ kernel = new $ kernelClass ($ env , $ debug );
5556 $ kernel ->boot ();
5657
5758 $ service = $ kernel ->getContainer ()->get ($ handlerService );
Original file line number Diff line number Diff line change @@ -15,10 +15,9 @@ class Configuration implements ConfigurationInterface
1515 /**
1616 * {@inheritdoc}
1717 */
18- public function getConfigTreeBuilder ()
18+ public function getConfigTreeBuilder (): TreeBuilder
1919 {
20- $ treeBuilder = new TreeBuilder ();
21- $ rootNode = $ treeBuilder ->root ('dayspring_lambda ' );
20+ $ treeBuilder = new TreeBuilder ('dayspring_lambda ' );
2221
2322 // Here you should define the parameters that are allowed to
2423 // configure your bundle. See the documentation linked above for
Original file line number Diff line number Diff line change 22
33namespace Dayspring \LambdaBundle \DependencyInjection ;
44
5+ use Exception ;
56use Symfony \Component \DependencyInjection \ContainerBuilder ;
67use Symfony \Component \Config \FileLocator ;
78use Symfony \Component \HttpKernel \DependencyInjection \Extension ;
@@ -16,8 +17,9 @@ class DayspringLambdaExtension extends Extension
1617{
1718 /**
1819 * {@inheritdoc}
20+ * @throws Exception
1921 */
20- public function load (array $ configs , ContainerBuilder $ container )
22+ public function load (array $ configs , ContainerBuilder $ container ): void
2123 {
2224 $ configuration = new Configuration ();
2325 $ config = $ this ->processConfiguration ($ configuration , $ configs );
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class EchoLambdaHandlerService implements LambdaHandlerServiceInterface
1010{
1111
1212 /** @var LoggerInterface $logger */
13- protected $ logger ;
13+ protected LoggerInterface $ logger ;
1414
1515 /**
1616 * @param LoggerInterface $logger
Original file line number Diff line number Diff line change 33namespace Dayspring \LambdaBundle \Service ;
44
55use Bref \Context \Context ;
6- use Dayspring \LambdaBundle \Service \LambdaHandlerServiceInterface ;
76use Psr \Log \LoggerInterface ;
87use Symfony \Component \Console \Output \OutputInterface ;
98use Symfony \Component \DependencyInjection \ContainerInterface ;
10- use function json_decode ;
11- use function json_encode ;
12- use function var_dump ;
13- use function var_export ;
149
1510class ServiceFunctionHandlerService implements LambdaHandlerServiceInterface
1611{
1712
1813 /** @var LoggerInterface $logger */
19- protected $ logger ;
14+ protected LoggerInterface $ logger ;
2015
2116 /** @var ContainerInterface $container */
22- protected $ container ;
17+ protected ContainerInterface $ container ;
2318
2419
2520 /**
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class SqsLambdaHandlerService implements LambdaHandlerServiceInterface
1010{
1111
1212 /** @var LoggerInterface $logger */
13- protected $ logger ;
13+ protected LoggerInterface $ logger ;
1414
1515 /**
1616 * @param LoggerInterface $logger
Original file line number Diff line number Diff line change 33namespace Dayspring \LambdaBundle \Service ;
44
55use Bref \Context \Context ;
6- use Dayspring \LambdaBundle \Service \LambdaHandlerServiceInterface ;
7- use Psr \Log \LoggerInterface ;
86use Symfony \Component \Console \Output \OutputInterface ;
9- use Symfony \Component \DependencyInjection \ContainerInterface ;
10- use function is_a ;
11- use function is_array ;
12- use function json_decode ;
13- use function json_encode ;
14- use function var_dump ;
15- use function var_export ;
167
178class SqsServiceFunctionHandlerService extends ServiceFunctionHandlerService
189{
19-
20- /** @var LoggerInterface $logger */
21- protected $ logger ;
22-
23- /** @var ContainerInterface $container */
24- protected $ container ;
25-
26-
27- /**
28- * @param LoggerInterface $logger
29- * @param ContainerInterface $container
30- */
31- public function __construct (
32- LoggerInterface $ logger ,
33- ContainerInterface $ container
34- ) {
35- $ this ->logger = $ logger ;
36- $ this ->container = $ container ;
37- }
38-
3910 public function init ()
4011 {
4112 // nothing to init
Original file line number Diff line number Diff line change 22
33namespace Dayspring \LambdaBundle \Tests \Service ;
44
5- class EchoLambdaHandlerServiceTest extends \PHPUnit \Framework \TestCase
5+ use Bref \Context \Context ;
6+ use Dayspring \LambdaBundle \Service \EchoLambdaHandlerService ;
7+ use PHPUnit \Framework \TestCase ;
8+ use Psr \Log \LoggerInterface ;
9+ use Symfony \Component \Console \Output \BufferedOutput ;
10+
11+ class EchoLambdaHandlerServiceTest extends TestCase
612{
713
814 public function testHandle ()
915 {
10- $ logger = $ this ->createMock (\ Psr \ Log \ LoggerInterface::class);
16+ $ logger = $ this ->createMock (LoggerInterface::class);
1117
12- /** @var \Dayspring\LambdaBundle\Service\EchoLambdaHandlerService $service */
13- $ service = new \Dayspring \LambdaBundle \Service \EchoLambdaHandlerService ($ logger );
18+ $ service = new EchoLambdaHandlerService ($ logger );
1419
15- $ context = new \ Bref \ Context \ Context (
20+ $ context = new Context (
1621 'request-id-1 ' ,
1722 30 *1000 ,
1823 'my-function-arn ' ,
1924 'trace-id-1 '
2025 );
21- $ output = new \ Symfony \ Component \ Console \ Output \ BufferedOutput ();
26+ $ output = new BufferedOutput ();
2227
2328 $ event = [
2429 'body ' => 'hello world '
Original file line number Diff line number Diff line change 2121 }
2222 ],
2323 "require" : {
24- "php" : " >=7.0" ,
25- "symfony/framework-bundle" : " ^3.4.31|^4.0|^5.0" ,
24+ "php" : " >=7.4" ,
25+ "ext-json" : " *" ,
26+ "symfony/dotenv" : " ^4.4|^5.0" ,
27+ "symfony/framework-bundle" : " ^4.4|^5.0" ,
28+ "symfony/yaml" : " ^4.4|^5.0" ,
2629 "sensio/framework-extra-bundle" : " ^5.0.1" ,
27- "symfony/yaml" : " ^3.4.31|^4.0|^5.0" ,
2830 "bref/bref" : " ^1.7"
2931 },
3032 "require-dev" : {
You can’t perform that action at this time.
0 commit comments