From 01ec661c3fb1012c91738ffabe95efff739a17d0 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Sun, 5 Jul 2015 21:46:57 +0930 Subject: [PATCH] PSR-2 fixes --- src/Api/ApiServiceProvider.php | 3 ++- src/Api/Commands/GenerateAccessToken.php | 2 +- src/Api/Commands/GenerateAccessTokenHandler.php | 6 +++++- src/Assets/RevisionCompiler.php | 4 +--- src/Console/GenerateExtensionCommand.php | 3 +-- src/Core/Application.php | 5 ++--- src/Core/DatabaseServiceProvider.php | 2 +- src/Core/Search/AppliesParametersToSearch.php | 2 +- src/Core/Support/ValidatesBeforeSave.php | 2 +- src/Http/RouterMiddleware.php | 2 +- src/Support/Action.php | 6 ++---- 11 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/Api/ApiServiceProvider.php b/src/Api/ApiServiceProvider.php index 77d7eb75d..737892f3d 100644 --- a/src/Api/ApiServiceProvider.php +++ b/src/Api/ApiServiceProvider.php @@ -163,7 +163,8 @@ class ApiServiceProvider extends ServiceProvider $routes->post( '/discussions', 'flarum.api.discussions.create', - $this->action('Flarum\Api\Actions\Discussions\CreateAction')); + $this->action('Flarum\Api\Actions\Discussions\CreateAction') + ); // Show a single discussion $routes->get( diff --git a/src/Api/Commands/GenerateAccessToken.php b/src/Api/Commands/GenerateAccessToken.php index cef67a819..839e9d370 100644 --- a/src/Api/Commands/GenerateAccessToken.php +++ b/src/Api/Commands/GenerateAccessToken.php @@ -16,4 +16,4 @@ class GenerateAccessToken { $this->userId = $userId; } -} \ No newline at end of file +} diff --git a/src/Api/Commands/GenerateAccessTokenHandler.php b/src/Api/Commands/GenerateAccessTokenHandler.php index 160c9a830..21447afd3 100644 --- a/src/Api/Commands/GenerateAccessTokenHandler.php +++ b/src/Api/Commands/GenerateAccessTokenHandler.php @@ -4,6 +4,10 @@ use Flarum\Api\AccessToken; class GenerateAccessTokenHandler { + /** + * @param GenerateAccessToken $command + * @return AccessToken + */ public function handle(GenerateAccessToken $command) { $token = AccessToken::generate($command->userId); @@ -12,4 +16,4 @@ class GenerateAccessTokenHandler return $token; } -} \ No newline at end of file +} diff --git a/src/Assets/RevisionCompiler.php b/src/Assets/RevisionCompiler.php index 1a92176a3..6d01b6e69 100644 --- a/src/Assets/RevisionCompiler.php +++ b/src/Assets/RevisionCompiler.php @@ -36,9 +36,7 @@ class RevisionCompiler implements Compiler $ext = pathinfo($this->filename, PATHINFO_EXTENSION); $file = $this->path.'/'.substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0); - if (! ($exists = file_exists($file)) - || filemtime($file) < $lastModTime) { - + if (! ($exists = file_exists($file)) || filemtime($file) < $lastModTime) { if ($exists) { unlink($file); } diff --git a/src/Console/GenerateExtensionCommand.php b/src/Console/GenerateExtensionCommand.php index bae61038f..db4680644 100644 --- a/src/Console/GenerateExtensionCommand.php +++ b/src/Console/GenerateExtensionCommand.php @@ -112,8 +112,7 @@ class GenerateExtensionCommand extends Command if ($file != '.' && $file != '..') { if (is_dir($src.'/'.$file)) { $this->recursiveCopy($src.'/'.$file, $dst.'/'.$file, $replacements); - } - else { + } else { $contents = file_get_contents($src.'/'.$file); $contents = str_replace(array_keys($replacements), array_values($replacements), $contents); diff --git a/src/Core/Application.php b/src/Core/Application.php index b9a40dca4..3c6827c1c 100644 --- a/src/Core/Application.php +++ b/src/Core/Application.php @@ -161,9 +161,8 @@ class Application extends Container implements LaravelApplication */ protected function fireListeners(array $listeners) { - foreach ($listeners as $listener) - { + foreach ($listeners as $listener) { $listener($this); } } -} \ No newline at end of file +} diff --git a/src/Core/DatabaseServiceProvider.php b/src/Core/DatabaseServiceProvider.php index c02ec9b9b..64cacc201 100644 --- a/src/Core/DatabaseServiceProvider.php +++ b/src/Core/DatabaseServiceProvider.php @@ -37,7 +37,7 @@ class DatabaseServiceProvider extends ServiceProvider $this->app->alias('Illuminate\Database\ConnectionResolverInterface', 'db'); if (Core::isInstalled()) { - $this->app->booting(function() { + $this->app->booting(function () { $resolver = $this->app->make('Illuminate\Database\ConnectionResolverInterface'); Model::setConnectionResolver($resolver); diff --git a/src/Core/Search/AppliesParametersToSearch.php b/src/Core/Search/AppliesParametersToSearch.php index 398e95afa..14026b143 100644 --- a/src/Core/Search/AppliesParametersToSearch.php +++ b/src/Core/Search/AppliesParametersToSearch.php @@ -44,4 +44,4 @@ trait AppliesParametersToSearch $search->getQuery()->take($limit); } } -} \ No newline at end of file +} diff --git a/src/Core/Support/ValidatesBeforeSave.php b/src/Core/Support/ValidatesBeforeSave.php index 8a816437c..1beebc5c9 100644 --- a/src/Core/Support/ValidatesBeforeSave.php +++ b/src/Core/Support/ValidatesBeforeSave.php @@ -140,4 +140,4 @@ trait ValidatesBeforeSave return $rule; } -} \ No newline at end of file +} diff --git a/src/Http/RouterMiddleware.php b/src/Http/RouterMiddleware.php index 4305622b5..0e76744df 100644 --- a/src/Http/RouterMiddleware.php +++ b/src/Http/RouterMiddleware.php @@ -65,4 +65,4 @@ class RouterMiddleware return $this->dispatcher; } -} \ No newline at end of file +} diff --git a/src/Support/Action.php b/src/Support/Action.php index 385d0d65c..bab852e97 100644 --- a/src/Support/Action.php +++ b/src/Support/Action.php @@ -27,7 +27,7 @@ abstract class Action */ protected function redirectTo($url) { - $content = sprintf(<<<'HTML' + $content = sprintf(' @@ -39,9 +39,7 @@ abstract class Action Redirecting to %1$s. - -HTML -, htmlspecialchars($url, ENT_QUOTES, 'UTF-8')); +', htmlspecialchars($url, ENT_QUOTES, 'UTF-8')); $response = new RedirectResponse($url); $response->getBody()->write($content);