Skip to content

Commit

Permalink
Use static functions
Browse files Browse the repository at this point in the history
  • Loading branch information
tattali committed Jan 16, 2024
1 parent 7f40039 commit 3e7a6cd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 0 additions & 4 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
'array_syntax' => [
'syntax' => 'short',
],
'braces' => [
'allow_single_line_closure' => true,
],
'compact_nullable_typehint' => true,
'doctrine_annotation_array_assignment' => [
'operator' => '=',
],
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/RequestResponseListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected function getRedirectResponse(Request $request, string $view): ?Redirec
*/
protected function prepareResponseModification(string $view): void
{
$this->modifyResponseClosure = function (DeviceView $deviceView, ResponseEvent $event) use ($view) {
$this->modifyResponseClosure = static function (DeviceView $deviceView, ResponseEvent $event) use ($view) {
return $deviceView->modifyResponse($view, $event->getResponse());
};
}
Expand Down
12 changes: 6 additions & 6 deletions tests/DataCollector/DeviceDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ public function testCollectCurrentViewMobileCanUseTablet(): void
$this->request->expects(self::any())->method('getBaseUrl')->willReturn('/base-url');
$this->request->expects(self::any())->method('getPathInfo')->willReturn('/path-info');
$test = $this;
$this->request->expects(self::any())->method('getQueryString')->willReturnCallback(function () use ($test) {
$this->request->expects(self::any())->method('getQueryString')->willReturnCallback(static function () use ($test) {
$qs = Request::normalizeQueryString($test->request->server->get('QUERY_STRING'));

return '' === $qs ? null : $qs;
});
$this->request->expects(self::any())->method('getUri')->willReturnCallback(function () use ($test) {
$this->request->expects(self::any())->method('getUri')->willReturnCallback(static function () use ($test) {
if (null !== $qs = $test->request->getQueryString()) {
$qs = '?'.$qs;
}
Expand Down Expand Up @@ -177,12 +177,12 @@ public function testCollectCurrentViewFullCanUseMobile(): void
$this->request->expects(self::any())->method('getBaseUrl')->willReturn('/base-url');
$this->request->expects(self::any())->method('getPathInfo')->willReturn('/path-info');
$test = $this;
$this->request->expects(self::any())->method('getQueryString')->willReturnCallback(function () use ($test) {
$this->request->expects(self::any())->method('getQueryString')->willReturnCallback(static function () use ($test) {
$qs = Request::normalizeQueryString($test->request->server->get('QUERY_STRING'));

return '' === $qs ? null : $qs;
});
$this->request->expects(self::any())->method('getUri')->willReturnCallback(function () use ($test) {
$this->request->expects(self::any())->method('getUri')->willReturnCallback(static function () use ($test) {
if (null !== $qs = $test->request->getQueryString()) {
$qs = '?'.$qs;
}
Expand Down Expand Up @@ -240,12 +240,12 @@ public function testCollectCurrentViewFullCantUseMobile(): void
$this->request->expects(self::any())->method('getBaseUrl')->willReturn('/base-url');
$this->request->expects(self::any())->method('getPathInfo')->willReturn('/path-info');
$test = $this;
$this->request->expects(self::any())->method('getQueryString')->willReturnCallback(function () use ($test) {
$this->request->expects(self::any())->method('getQueryString')->willReturnCallback(static function () use ($test) {
$qs = Request::normalizeQueryString($test->request->server->get('QUERY_STRING'));

return '' === $qs ? null : $qs;
});
$this->request->expects(self::any())->method('getUri')->willReturnCallback(function () use ($test) {
$this->request->expects(self::any())->method('getUri')->willReturnCallback(static function () use ($test) {
if (null !== $qs = $test->request->getQueryString()) {
$qs = '?'.$qs;
}
Expand Down

0 comments on commit 3e7a6cd

Please sign in to comment.