Skip to content

Commit 3da74c4

Browse files
committed
Merge branch 'master' into v2
2 parents 5f2993c + 0a1d2f7 commit 3da74c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+261
-222
lines changed

.php_cs

Lines changed: 36 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,61 @@
11
<?php
22

3-
$finder = Symfony\CS\Finder\DefaultFinder::create()
4-
->exclude('files')
5-
->exclude('vendor')
6-
->in(__DIR__);
3+
return PhpCsFixer\Config::create()
4+
->setRiskyAllowed(true)
5+
->setRules([
6+
'@PSR2' => true,
77

8-
return Symfony\CS\Config\Config::create()
9-
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
10-
->fixers([
118
/**
129
* symfony
1310
*/
1411
// Ensure there is no code on the same line as the PHP open tag and it is followed by a blankline.
15-
'blankline_after_open_tag',
12+
'blank_line_after_opening_tag' => true,
1613
// Remove duplicated semicolons.
17-
'duplicate_semicolon',
18-
// Removes extra empty lines.
19-
'extra_empty_lines',
14+
'no_empty_statement' => true,
2015
// PHP multi-line arrays should have a trailing comma.
21-
'multiline_array_trailing_comma',
16+
'trailing_comma_in_multiline_array' => true,
2217
// There should be no empty lines after class opening brace.
23-
'no_blank_lines_after_class_opening',
18+
'no_blank_lines_after_class_opening' => true,
2419
// There should not be blank lines between docblock and the documented element.
25-
'no_empty_lines_after_phpdocs',
20+
'no_blank_lines_after_phpdoc' => true,
2621
// Phpdocs short descriptions should end in either a full stop, exclamation mark, or question mark.
27-
'phpdoc_short_description',
22+
'phpdoc_summary' => true,
2823
// Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
29-
'phpdoc_trim',
24+
'phpdoc_trim' => true,
3025
// Removes line breaks between use statements.
31-
'remove_lines_between_uses',
26+
'no_extra_consecutive_blank_lines' => ['use'],
3227
// An empty line feed should precede a return statement.
33-
'return',
28+
'blank_line_before_return' => true,
3429
// There should be exactly one blank line before a namespace declaration.
35-
'single_blank_line_before_namespace',
30+
'single_blank_line_before_namespace' => true,
3631
// Convert double quotes to single quotes for simple strings.
37-
'single_quote',
32+
'single_quote' => true,
3833
// Unused use statements must be removed.
39-
'unused_use',
34+
'no_unused_imports' => true,
35+
// Methods must be separated with one blank line.
36+
'method_separation' => true,
37+
// Binary operators should be surrounded by at least one space.
38+
'binary_operator_spaces' => ['align_double_arrow' => false],
39+
// A single space should be between cast and variable.
40+
'cast_spaces' => true,
4041

4142
/**
4243
* contrib
4344
*/
4445
// Concatenation should be used with at least one whitespace around.
45-
'concat_with_spaces',
46-
// Ensure there is no code on the same line as the PHP open tag.
47-
'newline_after_open_tag',
46+
'concat_space' => ['spacing' => 'one'],
4847
// Ordering use statements.
49-
'ordered_use',
48+
'ordered_imports' => true,
49+
// PHP arrays should be declared using the configured syntax.
50+
'array_syntax' => ['syntax' => 'short']
5051
])
51-
->setUsingCache(true)
52-
->finder($finder);
52+
->setFinder(
53+
PhpCsFixer\Finder::create()
54+
->exclude('files')
55+
->exclude('vendor')
56+
->in(__DIR__)
57+
->name('*.php')
58+
->ignoreDotFiles(true)
59+
->ignoreVCS(true)
60+
)
61+
->setUsingCache(true);

.scrutinizer.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
filter:
22
excluded_paths:
33
- 'tests/*'
4-
- 'src/Cmgmyr/Messenger/examples/'
5-
- 'src/config/'
6-
- 'src/migrations/'
4+
- 'examples/*'
5+
- 'config/*'
6+
- 'migrations/*'
77

88
checks:
99
php:
@@ -24,4 +24,4 @@ checks:
2424
tools:
2525
external_code_coverage:
2626
timeout: 1800
27-
runs: 4
27+
runs: 3

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: php
22

33
php:
4-
- 5.5
54
- 5.6
65
- 7.0
76
- 7.1
@@ -17,6 +16,7 @@ cache:
1716

1817
before_script:
1918
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
19+
- composer dumpautoload -o
2020

2121
script:
2222
- vendor/bin/php-cs-fixer fix .

composer.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=5.4.0",
15+
"php": ">=5.5.0",
1616
"illuminate/config": "~5.0",
1717
"illuminate/support": "~5.0",
1818
"illuminate/database": "~5.0",
1919
"nesbot/carbon": "~1.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "4.*|5.*",
2322
"adamwathan/faktory": "0.3.*",
24-
"friendsofphp/php-cs-fixer": "^1.11",
25-
"orchestra/testbench": "~3.0"
23+
"friendsofphp/php-cs-fixer": "^2.5",
24+
"orchestra/testbench": "~3.0",
25+
"phpunit/phpunit": "4.*|5.*"
2626
},
2727
"autoload": {
28-
"psr-0": {
28+
"psr-4": {
2929
"Cmgmyr\\Messenger\\": "src/"
3030
}
3131
},
@@ -34,5 +34,15 @@
3434
"Cmgmyr\\Messenger\\Test\\": "tests/"
3535
}
3636
},
37+
"extra": {
38+
"laravel": {
39+
"providers": [
40+
"Cmgmyr\\Messenger\\MessengerServiceProvider"
41+
]
42+
}
43+
},
44+
"config": {
45+
"sort-packages": true
46+
},
3747
"minimum-stability": "stable"
3848
}
File renamed without changes.

src/Cmgmyr/Messenger/examples/MessagesController.php renamed to examples/MessagesController.php

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ public function show($id)
4646
} catch (ModelNotFoundException $e) {
4747
Session::flash('error_message', 'The thread with ID: ' . $id . ' was not found.');
4848

49-
return redirect('messages');
49+
return redirect()->route('messages');
5050
}
5151

5252
// show current user in list if not a current participant
5353
// $users = User::whereNotIn('id', $thread->participantsUserIds())->get();
5454

5555
// don't show the current user in list
56-
$userId = Auth::user()->id;
56+
$userId = Auth::id();
5757
$users = User::whereNotIn('id', $thread->participantsUserIds($userId))->get();
5858

5959
$thread->markAsRead($userId);
@@ -82,36 +82,30 @@ public function store()
8282
{
8383
$input = Input::all();
8484

85-
$thread = Thread::create(
86-
[
87-
'subject' => $input['subject'],
88-
]
89-
);
85+
$thread = Thread::create([
86+
'subject' => $input['subject'],
87+
]);
9088

9189
// Message
92-
Message::create(
93-
[
94-
'thread_id' => $thread->id,
95-
'user_id' => Auth::user()->id,
96-
'body' => $input['message'],
97-
]
98-
);
90+
Message::create([
91+
'thread_id' => $thread->id,
92+
'user_id' => Auth::id(),
93+
'body' => $input['message'],
94+
]);
9995

10096
// Sender
101-
Participant::create(
102-
[
103-
'thread_id' => $thread->id,
104-
'user_id' => Auth::user()->id,
105-
'last_read' => new Carbon,
106-
]
107-
);
97+
Participant::create([
98+
'thread_id' => $thread->id,
99+
'user_id' => Auth::id(),
100+
'last_read' => new Carbon,
101+
]);
108102

109103
// Recipients
110104
if (Input::has('recipients')) {
111105
$thread->addParticipant($input['recipients']);
112106
}
113107

114-
return redirect('messages');
108+
return redirect()->route('messages');
115109
}
116110

117111
/**
@@ -127,27 +121,23 @@ public function update($id)
127121
} catch (ModelNotFoundException $e) {
128122
Session::flash('error_message', 'The thread with ID: ' . $id . ' was not found.');
129123

130-
return redirect('messages');
124+
return redirect()->route('messages');
131125
}
132126

133127
$thread->activateAllParticipants();
134128

135129
// Message
136-
Message::create(
137-
[
138-
'thread_id' => $thread->id,
139-
'user_id' => Auth::id(),
140-
'body' => Input::get('message'),
141-
]
142-
);
130+
Message::create([
131+
'thread_id' => $thread->id,
132+
'user_id' => Auth::id(),
133+
'body' => Input::get('message'),
134+
]);
143135

144136
// Add replier as a participant
145-
$participant = Participant::firstOrCreate(
146-
[
147-
'thread_id' => $thread->id,
148-
'user_id' => Auth::user()->id,
149-
]
150-
);
137+
$participant = Participant::firstOrCreate([
138+
'thread_id' => $thread->id,
139+
'user_id' => Auth::id(),
140+
]);
151141
$participant->last_read = new Carbon;
152142
$participant->save();
153143

@@ -156,6 +146,6 @@ public function update($id)
156146
$thread->addParticipant(Input::get('recipients'));
157147
}
158148

159-
return redirect('messages/' . $id);
149+
return redirect()->route('messages.show', $id);
160150
}
161151
}
File renamed without changes.

src/Cmgmyr/Messenger/examples/views/layouts/master.blade.php renamed to examples/views/layouts/master.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<span class="icon-bar"></span>
3535
<span class="icon-bar"></span>
3636
</button>
37-
<a class="navbar-brand" href="#">Messenger (L5.3)</a>
37+
<a class="navbar-brand" href="#">Messenger</a>
3838
</div>
3939
<div id="navbar" class="collapse navbar-collapse">
4040
<ul class="nav navbar-nav">
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)