diff --git a/Markup/Sniffs/Symfony/PreventRequestStackInConstructorSniff.php b/Markup/Sniffs/Symfony/PreventRequestStackInConstructorSniff.php new file mode 100644 index 0000000..0f7b26e --- /dev/null +++ b/Markup/Sniffs/Symfony/PreventRequestStackInConstructorSniff.php @@ -0,0 +1,50 @@ +getMethodParameters($openTagPointer) as $parameter) { + if (isset($parameter['type_hint']) && $parameter['type_hint'] === 'RequestStack') { + $phpcsFile->addError( + sprintf( + 'Using RequestStack as a constructor argument ties the implementation to Reqest only which is not useful, see alteratives or context pass the Request from the HTTP Transport Layer', + $name + ), + $openTagPointer, + 'PreventRequestStackInConstructor' + ); + } + } + } + +}