Permalink
Browse files

Adopt php-cs-fixer with config used by Laravel project

  • Loading branch information...
lovett committed Nov 17, 2016
1 parent cb1a8dc commit 462447e49df91a8ca84854c8d8e5a3efc93b0d11
Showing with 497 additions and 426 deletions.
  1. +77 −0 .php_cs
  2. +9 −10 app/Client.php
  3. +1 −3 app/Console/Commands/Inspire.php
  4. +2 −6 app/Console/Kernel.php
  5. +1 −1 app/Events/Event.php
  6. +4 −6 app/Exceptions/Handler.php
  7. +7 −9 app/Helpers/AddressHelper.php
  8. +8 −10 app/Helpers/LinkHelper.php
  9. +13 −14 app/Helpers/TimeHelper.php
  10. +3 −6 app/Http/Controllers/Auth/AuthController.php
  11. +1 −4 app/Http/Controllers/Auth/PasswordController.php
  12. +30 −36 app/Http/Controllers/ClientController.php
  13. +10 −12 app/Http/Controllers/Controller.php
  14. +3 −9 app/Http/Controllers/DashboardController.php
  15. +24 −33 app/Http/Controllers/ProjectController.php
  16. +21 −30 app/Http/Controllers/TimeController.php
  17. +1 −2 app/Http/Kernel.php
  18. +6 −9 app/Http/Middleware/Authenticate.php
  19. +3 −5 app/Http/Middleware/BackTo.php
  20. +1 −2 app/Http/Middleware/EncryptCookies.php
  21. +4 −8 app/Http/Middleware/RedirectIfAuthenticated.php
  22. +4 −5 app/Http/Middleware/Returnable.php
  23. +1 −2 app/Http/Middleware/VerifyCsrfToken.php
  24. +5 −9 app/Http/Requests/ClientRequest.php
  25. +5 −13 app/Http/Requests/ProjectRequest.php
  26. +1 −1 app/Http/Requests/Request.php
  27. +7 −16 app/Http/Requests/TimeRequest.php
  28. +8 −8 app/Http/routes.php
  29. +1 −1 app/Jobs/Job.php
  30. +12 −19 app/Project.php
  31. +1 −8 app/Providers/AppServiceProvider.php
  32. +2 −6 app/Providers/AuthServiceProvider.php
  33. +1 −8 app/Providers/DatabaseServiceProvider.php
  34. +2 −6 app/Providers/EventServiceProvider.php
  35. +3 −10 app/Providers/RouteServiceProvider.php
  36. +29 −27 app/Time.php
  37. +3 −5 app/Traits/Search.php
  38. +15 −12 app/User.php
  39. +5 −0 build.xml
  40. +2 −1 composer.json
  41. +161 −54 composer.lock
View
77 .php_cs
@@ -0,0 +1,77 @@
+<?php
+
+use Symfony\CS\Config\Config;
+use Symfony\CS\FixerInterface;
+use Symfony\CS\Finder\DefaultFinder;
+
+$fixers = [
+ 'blankline_after_open_tag',
+ 'braces',
+ 'concat_without_spaces',
+ 'double_arrow_multiline_whitespaces',
+ 'duplicate_semicolon',
+ 'elseif',
+ 'empty_return',
+ 'encoding',
+ 'eof_ending',
+ 'extra_empty_lines',
+ 'function_call_space',
+ 'function_declaration',
+ 'include',
+ 'indentation',
+ 'join_function',
+ 'line_after_namespace',
+ 'linefeed',
+ 'list_commas',
+ 'logical_not_operators_with_successor_space',
+ 'lowercase_constants',
+ 'lowercase_keywords',
+ 'method_argument_space',
+ 'multiline_array_trailing_comma',
+ 'multiline_spaces_before_semicolon',
+ 'multiple_use',
+ 'namespace_no_leading_whitespace',
+ 'no_blank_lines_after_class_opening',
+ 'no_empty_lines_after_phpdocs',
+ 'object_operator',
+ 'operators_spaces',
+ 'parenthesis',
+ 'phpdoc_indent',
+ 'phpdoc_inline_tag',
+ 'phpdoc_no_access',
+ 'phpdoc_no_package',
+ 'phpdoc_scalar',
+ 'phpdoc_short_description',
+ 'phpdoc_to_comment',
+ 'phpdoc_trim',
+ 'phpdoc_type_to_var',
+ 'phpdoc_var_without_name',
+ 'remove_leading_slash_use',
+ 'remove_lines_between_uses',
+ 'return',
+ 'self_accessor',
+ 'short_array_syntax',
+ 'short_echo_tag',
+ 'short_tag',
+ 'single_array_no_trailing_comma',
+ 'single_blank_line_before_namespace',
+ 'single_line_after_imports',
+ 'single_quote',
+ 'spaces_before_semicolon',
+ 'spaces_cast',
+ 'standardize_not_equal',
+ 'ternary_spaces',
+ 'trailing_spaces',
+ 'trim_array_spaces',
+ 'unalign_equals',
+ 'unary_operators_spaces',
+ 'unused_use',
+ 'visibility',
+ 'whitespacy_lines',
+];
+
+return Config::create()
+ ->finder(DefaultFinder::create()->in(__DIR__))
+ ->fixers($fixers)
+ ->level(FixerInterface::NONE_LEVEL)
+ ->setUsingCache(true);
View
@@ -8,12 +8,11 @@
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
-use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use App\Traits\Search;
/**
- * Eloquent model for the clients table
+ * Eloquent model for the clients table.
*/
class Client extends Model
{
@@ -61,17 +60,16 @@ class Client extends Model
protected $casts = ['totalTime' => 'integer'];
/**
- * The attributes that are datetimes
+ * The attributes that are datetimes.
*
* @var array
*/
protected $dates = ['deleted_at' => 'datetime'];
-
/**
- * Master query for getting a list of records
+ * Master query for getting a list of records.
*
- * @param Builder $builder The query to start with.
+ * @param Builder $builder The query to start with
*
* @return Relation
*/
@@ -108,7 +106,7 @@ function ($join) {
}
/**
- * Time entries associated with the client
+ * Time entries associated with the client.
*
* @return HasManyThrough
*/
@@ -118,7 +116,7 @@ public function times()
}
/**
- * Users associated with the client
+ * Users associated with the client.
*
* @return BelongsToMany
*/
@@ -128,7 +126,7 @@ public function users()
}
/**
- * Projects associated with the client
+ * Projects associated with the client.
*
* @return HasMany
*/
@@ -138,7 +136,7 @@ public function projects()
}
/**
- * Human readable string for the value of the active flag
+ * Human readable string for the value of the active flag.
*
* @return string
*/
@@ -147,6 +145,7 @@ public function status()
if ($this->active) {
return 'active';
}
+
return 'inactive';
}
}
@@ -6,11 +6,10 @@
use Illuminate\Foundation\Inspiring;
/**
- * Standard Laravel Inspire command
+ * Standard Laravel Inspire command.
*/
class Inspire extends Command
{
-
/**
* The name and signature of the console command.
*
@@ -25,7 +24,6 @@ class Inspire extends Command
*/
protected $description = 'Display an inspiring quote';
-
/**
* Execute the console command.
*
View
@@ -6,11 +6,10 @@
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
/**
- * Standard Laravel Kernel class
+ * Standard Laravel Kernel class.
*/
class Kernel extends ConsoleKernel
{
-
/**
* The Artisan commands provided by your application.
*
@@ -20,13 +19,10 @@ class Kernel extends ConsoleKernel
\App\Console\Commands\Inspire::class,
];
-
/**
* Define the application's command schedule.
*
- * @param Schedule $schedule The schedule instance.
- *
- * @return void
+ * @param Schedule $schedule The schedule instance
*/
protected function schedule(Schedule $schedule)
{
View
@@ -3,7 +3,7 @@
namespace App\Events;
/**
- * Standard Laravel Event abstract class
+ * Standard Laravel Event abstract class.
*/
abstract class Event
{
View
@@ -11,11 +11,10 @@
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
/**
- * Standard Laravel exception handler class
+ * Standard Laravel exception handler class.
*/
class Handler extends ExceptionHandler
{
-
/**
* A list of the exception types that should not be reported.
*
@@ -26,13 +25,12 @@ class Handler extends ExceptionHandler
ModelNotFoundException::class,
];
-
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
- * @param Exception $e The exception instance.
+ * @param Exception $e The exception instance
*
* @return Response
*/
@@ -44,8 +42,8 @@ public function report(Exception $e)
/**
* Render an exception into an HTTP response.
*
- * @param Request $request The incoming request.
- * @param Exception $e The exception.
+ * @param Request $request The incoming request
+ * @param Exception $e The exception
*
* @return Response
*/
@@ -5,16 +5,14 @@
use Exception;
/**
- * Helper functions for displaying addresses
+ * Helper functions for displaying addresses.
*/
class AddressHelper
{
-
-
/**
- * Display a mailing address, taking care to account for missing fields
+ * Display a mailing address, taking care to account for missing fields.
*
- * @param string $record An object containing address fields.
+ * @param string $record An object containing address fields
*
* @return string
*/
@@ -29,8 +27,9 @@ public static function mailingAddress($record)
$suffix = ''
) use ($record) {
if (empty($record->$key) === false) {
- $out .= $prefix . $record->$key . $suffix;
+ $out .= $prefix.$record->$key.$suffix;
}
+
return $out;
};
@@ -49,9 +48,9 @@ public static function mailingAddress($record)
}
/**
- * Display a phone number as a hyperlink with the tel protocol
+ * Display a phone number as a hyperlink with the tel protocol.
*
- * @param string $value The number to display.
+ * @param string $value The number to display
*
* @return string
*/
@@ -74,6 +73,5 @@ public static function phoneUrl($value)
$plainValue,
$formattedValue
);
-
}
}
View
@@ -3,20 +3,18 @@
namespace App\Helpers;
/**
- * Helper functions for displaying links
+ * Helper functions for displaying links.
*/
class LinkHelper
{
-
-
/**
- * Render a route link with active class
+ * Render a route link with active class.
*
- * @param string $section The current section declared by the controller.
- * @param string $route The route to link to.
- * @param string $label The text of the link.
- * @param array $params Querystring parameters to include with the link.
- * @param array $attribs Additional attributes for the link tag.
+ * @param string $section The current section declared by the controller
+ * @param string $route The route to link to
+ * @param string $label The text of the link
+ * @param array $params Querystring parameters to include with the link
+ * @param array $attribs Additional attributes for the link tag
*
* @return string
*/
@@ -39,7 +37,7 @@ public static function navLink(
$attribs['class'] = '';
}
- $attribs['class'] .= ' ' . $class;
+ $attribs['class'] .= ' '.$class;
return link_to_route($route, $label, $params, $attribs);
}
Oops, something went wrong.

0 comments on commit 462447e

Please sign in to comment.