Permalink
Browse files

Prevent conflict between php-cs-fixer and phpcs

  • Loading branch information...
lovett committed Nov 17, 2016
1 parent 462447e commit 15182ed066eb13c717a3298f66cc976b6d78c231
View
@@ -6,3 +6,4 @@ node_modules
public/css
storage/debugbar
reports
+.php_cs.cache
View
@@ -11,7 +11,6 @@ $fixers = [
'double_arrow_multiline_whitespaces',
'duplicate_semicolon',
'elseif',
- 'empty_return',
'encoding',
'eof_ending',
'extra_empty_lines',
@@ -63,7 +62,7 @@ $fixers = [
'ternary_spaces',
'trailing_spaces',
'trim_array_spaces',
- 'unalign_equals',
+ 'align_equals',
'unary_operators_spaces',
'unused_use',
'visibility',
@@ -94,16 +94,16 @@ public function store(ClientRequest $request)
{
$client = new Client();
- $client->active = (int) $request->active;
- $client->name = $request->name;
- $client->contactName = $request->contactName;
+ $client->active = (int) $request->active;
+ $client->name = $request->name;
+ $client->contactName = $request->contactName;
$client->contactEmail = $request->contactEmail;
- $client->address1 = $request->address1;
- $client->address2 = $request->address2;
- $client->city = $request->city;
- $client->locality = $request->locality;
- $client->postalCode = $request->postalCode;
- $client->phone = $request->phone;
+ $client->address1 = $request->address1;
+ $client->address2 = $request->address2;
+ $client->city = $request->city;
+ $client->locality = $request->locality;
+ $client->postalCode = $request->postalCode;
+ $client->phone = $request->phone;
$client->user()->associate($request->user());
$client->save();
@@ -111,9 +111,9 @@ public function store(ProjectRequest $request)
$client = $request->user()->clients()->findOrFail($clientId);
- $project->name = $request->input('name');
- $project->active = $request->input('active', 0);
- $project->billable = $request->input('billable', 0);
+ $project->name = $request->input('name');
+ $project->active = $request->input('active', 0);
+ $project->billable = $request->input('billable', 0);
$project->taxDeducted = $request->input('taxDeducted', 0);
$project->user()->associate($request->user());
@@ -156,19 +156,19 @@ public function create(Request $request)
/**
* Save a new time entry to the database.
*
- * @param Request $request The incoming request
+ * @param TimeRequest $request The incoming request
*
* @return Response
*/
public function store(TimeRequest $request)
{
$time = new Time();
- $time->project_id = (int) $request->project_id;
+ $time->project_id = (int) $request->project_id;
$time->estimatedDuration = (int) $request->estimatedDuration;
- $time->start = $request->start;
- $time->minutes = $request->minutes;
- $time->summary = $request->summary;
+ $time->start = $request->start;
+ $time->minutes = $request->minutes;
+ $time->summary = $request->summary;
$time->user()->associate($request->user());
$time->save();
@@ -18,7 +18,7 @@ class ProjectRequest extends Request
public function authorize()
{
$projectId = $this->route('project');
- $clientId = $this->input('client_id', 0);
+ $clientId = $this->input('client_id', 0);
$this->user()->clients()->findOrFail($clientId);
@@ -88,7 +88,7 @@ function ($field) {
if ($field === 'minutes') {
$value = 0;
$start = $this->input('startTime', 0);
- $end = $this->input('endTime', 0);
+ $end = $this->input('endTime', 0);
if ($start && $end) {
$value = (strtotime($end) - strtotime($start)) / 60;
View
@@ -59,9 +59,7 @@ class Project extends Model
*
* @var array
*/
- protected $dates = [
- 'deleted_at' => 'datetime',
- ];
+ protected $dates = ['deleted_at' => 'datetime'];
/**
* Master query for getting a list of records.
View
@@ -62,9 +62,7 @@ class Time extends Model
*
* @var array
*/
- protected $dates = [
- 'deleted_at' => 'datetime',
- ];
+ protected $dates = ['deleted_at' => 'datetime'];
/**
* Master query for getting a list of records.
@@ -136,7 +134,7 @@ public function getMinutesAttribute($value)
/**
* Custom accessor to calculate end time from start and duration.
*
- * @return Carbon;
+ * @return Carbon|null;
*/
public function getEndAttribute()
{
View
@@ -125,7 +125,7 @@ public function projectsForMenu()
* @param Builder $query Determines the list being returned
* @param string $key The field name in query to use as the key
* @param string|string[] $value The field name in query to use as the value
- * @param separator $separator The separator in a value comprised of multiple fields
+ * @param string $separator The separator in a multi-field value comprised of multiple fields
*
* @return array
*/
@@ -134,15 +134,15 @@ protected function asMenu(Builder $query, $key = 'id', $value = 'name', $separat
$items = $query->get()->reduce(
function ($acc, $item) use ($key, $value, $separator) {
if (is_string($value)) {
- // Value refers to a single field on $item
+ // Value refers to a single field on $item.
$acc[$item->$key] = $item->$value;
return $acc;
}
- // Value refers to multiple fields
+ // Value refers to multiple fields.
$itemArray = $item->toArray();
- $multiVal = array_map(function ($field) use ($itemArray) {
+ $multiVal = array_map(function ($field) use ($itemArray) {
return array_get($itemArray, $field);
}, $value);
View
@@ -3,7 +3,7 @@
<project name="toils" basedir="." default="default" description="Automation tasks for toils">
<target name="phpcs" description="Lint application files via phpcs against PSR2">
- <phpcodesniffer standard="phpcs.xml" format="summary">
+ <phpcodesniffer standard="phpcs.xml" format="checkstyle">
<fileset dir=".">
<include name="app/**/*.php" />
<include name="database/**/*.php" />
@@ -22,7 +22,7 @@
<target name="php-cs-fixer" description="Lint with autocorrect via php-cs-fixer">
<property name="dir" value="app"/>
- <exec command="./vendor/bin/php-cs-fixer -v fix app" />
+ <exec passthru="true" command="./vendor/bin/php-cs-fixer -v --config-file=.php_cs fix app" />
</target>
</project>
View
@@ -146,7 +146,6 @@
App\Providers\RouteServiceProvider::class,
App\Providers\DatabaseServiceProvider::class,
-
/*
* Third party Service Providers
*/
View
@@ -1,6 +1,6 @@
<?php
-return array(
+return [
/*
|--------------------------------------------------------------------------
@@ -26,13 +26,13 @@
| can also be used. For PDO, run the package migrations first.
|
*/
- 'storage' => array(
+ 'storage' => [
'enabled' => true,
'driver' => 'file', // redis, file, pdo, custom
'path' => storage_path('debugbar'), // For file driver
'connection' => null, // Leave null for default connection (Redis/PDO)
- 'provider' => '' // Instance of StorageInterface for custom driver
- ),
+ 'provider' => '', // Instance of StorageInterface for custom driver
+ ],
/*
|--------------------------------------------------------------------------
@@ -82,7 +82,7 @@
|
*/
- 'collectors' => array(
+ 'collectors' => [
'phpinfo' => true, // Php version
'messages' => true, // Messages
'time' => true, // Time Datalogger
@@ -103,7 +103,7 @@
'auth' => false, // Display Laravel authentication status
'gate' => false, // Display Laravel Gate checks
'session' => true, // Display session data
- ),
+ ],
/*
|--------------------------------------------------------------------------
@@ -114,33 +114,33 @@
|
*/
- 'options' => array(
- 'auth' => array(
+ 'options' => [
+ 'auth' => [
'show_name' => false, // Also show the users name/email in the debugbar
- ),
- 'db' => array(
+ ],
+ 'db' => [
'with_params' => true, // Render SQL with the parameters substituted
'timeline' => false, // Add the queries to the timeline
'backtrace' => false, // EXPERIMENTAL: Use a backtrace to find the origin of the query in your files.
- 'explain' => array( // EXPERIMENTAL: Show EXPLAIN output on queries
+ 'explain' => [ // EXPERIMENTAL: Show EXPLAIN output on queries
'enabled' => false,
- 'types' => array('SELECT'), // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
- ),
+ 'types' => ['SELECT'], // array('SELECT', 'INSERT', 'UPDATE', 'DELETE'); for MySQL 5.6.3+
+ ],
'hints' => true, // Show hints for common mistakes
- ),
- 'mail' => array(
- 'full_log' => false
- ),
- 'views' => array(
+ ],
+ 'mail' => [
+ 'full_log' => false,
+ ],
+ 'views' => [
'data' => false, //Note: Can slow down the application, because the data can be quite large..
- ),
- 'route' => array(
- 'label' => true // show complete route on bar
- ),
- 'logs' => array(
- 'file' => null
- ),
- ),
+ ],
+ 'route' => [
+ 'label' => true, // show complete route on bar
+ ],
+ 'logs' => [
+ 'file' => null,
+ ],
+ ],
/*
|--------------------------------------------------------------------------
@@ -167,4 +167,4 @@
*/
'route_prefix' => '_debugbar',
-);
+];
@@ -4,12 +4,10 @@
use Illuminate\Database\Migrations\Migration;
/**
- * Standard Laravel migration for the users table
+ * Standard Laravel migration for the users table.
*/
class CreateUsersTable extends Migration
{
-
-
/**
* Run the migrations.
*
@@ -4,12 +4,10 @@
use Illuminate\Database\Migrations\Migration;
/**
- * Standard Laravel class for password reset management
+ * Standard Laravel class for password reset management.
*/
class CreatePasswordResetsTable extends Migration
{
-
-
/**
* Run the migrations.
*
@@ -4,14 +4,12 @@
use Illuminate\Database\Migrations\Migration;
/**
- * The initial database schema
+ * The initial database schema.
*/
class CreateBaseSchema extends Migration
{
-
-
/**
- * Create the base application schema
+ * Create the base application schema.
*
* @return void
*/
@@ -131,7 +129,6 @@ function (Blueprint $table) {
}
);
-
Schema::create(
'times',
function (Blueprint $table) {
@@ -153,7 +150,7 @@ function (Blueprint $table) {
}
/**
- * Drop all application tables
+ * Drop all application tables.
*
* Tables are dropped in the reverse order they were created to
* avoid foreign key constraint violations.
@@ -4,12 +4,10 @@
use Illuminate\Database\Eloquent\Model;
/**
- * Populate the database with real data
+ * Populate the database with real data.
*/
class DatabaseSeeder extends Seeder
{
-
-
/**
* Run the database seeds.
*
Oops, something went wrong.

0 comments on commit 15182ed

Please sign in to comment.