Skip to content

Commit

Permalink
Merge pull request opencfp#847 from localheinz/feature/blank-line-bef…
Browse files Browse the repository at this point in the history
…ore-statement

Enhancement: Configure blank_line_before_statement fixer
  • Loading branch information
BackEndTea authored Dec 5, 2017
2 parents 93844aa + 3c6be90 commit 05f5504
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,27 @@ return PhpCsFixer\Config::create()
'default' => 'align_single_space_minimal',
],
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'declare',
'do',
'for',
'foreach',
'if',
'include',
'include_once',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
'while',
'yield',
],
],
'cast_spaces' => true,
'combine_consecutive_unsets' => true,
'concat_space' => [
Expand Down
1 change: 1 addition & 0 deletions classes/Domain/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function delete(): bool
throw new \Exception('Unable to delete talks of user');
}
});

if (!parent::delete()) {
throw new \Exception('Unable to delete User');
}
Expand Down
1 change: 1 addition & 0 deletions classes/Domain/Services/TalkRating/TalkRatingContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class TalkRatingContext
public static function getTalkStrategy(string $strategy, Authentication $auth): TalkRatingStrategy
{
$strategy = \strtolower($strategy);

switch ($strategy) {
case 'yesno':
return new YesNoRating(new TalkMeta(), $auth);
Expand Down
1 change: 1 addition & 0 deletions classes/Domain/Talk/TalkFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function getFilteredTalks(int $adminUserId, $filter = null)
if ($filter === null) {
return $this->talk;
}

switch (\strtolower($filter)) {
case 'selected':
return $this->talk->selected();
Expand Down
1 change: 1 addition & 0 deletions classes/Domain/Talk/TalkHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ private function clearFavoriteOfCurrentUser(): bool
->where('talk_id', $this->talk->id)
->where('admin_user_id', $this->userId)
->first();

if ($favorite instanceof Favorite) {
$favorite->delete();
}
Expand Down
1 change: 1 addition & 0 deletions classes/Http/Controller/Admin/SpeakersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public function promoteAction(Request $request)

try {
$user = $accounts->findById($id);

if ($user->hasAccess(\strtolower($role))) {
$session->set('flash', [
'type' => 'error',
Expand Down
1 change: 1 addition & 0 deletions classes/Http/Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function processAction(Request $request)

if ($isValid) {
$sanitizedData = $this->transformSanitizedData($form->getCleanData());

if (isset($formData['speaker_photo'])) {
/** @var ProfileImageProcessor $profileImageProcessor */
$profileImageProcessor = $this->service('profile_image_processor');
Expand Down
1 change: 1 addition & 0 deletions classes/Http/Form/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function getCleanData(array $keys = [])
}

$data = [];

foreach ($keys as $key) {
if (isset($this->cleanData[$key])) {
$data[$key] = $this->cleanData[$key];
Expand Down
1 change: 1 addition & 0 deletions classes/Infrastructure/Auth/RoleAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static function userHasAccess(Authentication $auth, string $role = 'admin
}

$user = $auth->user();

if (!$user->hasAccess($role)) {
return new RedirectResponse('/dashboard');
}
Expand Down
2 changes: 2 additions & 0 deletions classes/Infrastructure/Auth/SentinelAccountManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function findById(int $userId): UserInterface
public function findByLogin(string $email): UserInterface
{
$user = $this->sentinel->getUserRepository()->findByCredentials(['email' => $email]);

if ($user instanceof SentinelUserInterface) {
return new SentinelUser($user, $this->sentinel);
}
Expand Down Expand Up @@ -74,6 +75,7 @@ public function create(string $email, string $password, array $data = []): UserI
$user = $this->sentinel
->getUserRepository()
->create(\array_merge(['email' => $email, 'password' => $password], $data));

if ($user instanceof SentinelUserInterface) {
return new SentinelUser($user, $this->sentinel);
}
Expand Down
3 changes: 3 additions & 0 deletions classes/Infrastructure/Auth/SentinelAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ public function authenticate($username, $password)
try {
$success = false;
$user = $this->accountManagement->findByLogin($username);

if ($user->checkPassword($password)) {
$success = $this->sentinel->login($user->getUser());
}

if (!$success) {
throw AuthenticationException::loginFailure();
}
Expand All @@ -57,6 +59,7 @@ public function authenticate($username, $password)
public function user(): UserInterface
{
$user = $this->sentinel->getUser();

if ($user instanceof SentinelUserInterface) {
return new SentinelUser($user, $this->sentinel);
}
Expand Down
1 change: 1 addition & 0 deletions classes/Infrastructure/Auth/SentinelIdentityProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function __construct(Sentinel $sentinel, SpeakerRepository $repo)
public function getCurrentUser(): User
{
$user = $this->sentinel->getUser();

if (!$user instanceof SentinelUserInterface) {
throw new NotAuthenticatedException();
}
Expand Down
1 change: 1 addition & 0 deletions migrations/20150519122926_reset_photo_paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private function photosNotPartOfProfile()
// Crawl uploads directory.
// If filename is not registered, flag it for removal.
$iterator = new DirectoryIterator(__DIR__ . '/../web/uploads');

foreach ($iterator as $file) {
if ($file->isDot() || \in_array($file->getFilename(), ['dummyphoto.jpg'])) {
continue;
Expand Down
2 changes: 2 additions & 0 deletions migrations/20171120123411_user_roles_migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function down()
private function doPromotions($roleName)
{
$role = Sentinel::findRoleByName($roleName);

foreach ($this->getRoleIds($roleName) as $roleId) {
$role->users()->attach($roleId);
}
Expand All @@ -76,6 +77,7 @@ private function promoteSpeakers()
$users = \Cartalyst\Sentinel\Users\EloquentUser::all();
$users = $users->whereNotIn('id', $roleIds);
$role = Sentinel::findRoleByName('Speaker');

foreach ($users as $user) {
$role->users()->attach($user->id);
}
Expand Down
1 change: 1 addition & 0 deletions server.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
\define('WEB_PATH', __DIR__ . '/web/');

$path = WEB_PATH . $_SERVER['REQUEST_URI'];

if (\is_file($path)) {
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions tests/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ function factory()
$factory = Factory::construct($faker, __DIR__ . '/../factories');

$arguments = \func_get_args();

if (isset($arguments[1]) && \is_string($arguments[1])) {
return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);
}

if (isset($arguments[1])) {
return $factory->of($arguments[0])->times($arguments[1]);
}
Expand Down
1 change: 1 addition & 0 deletions web/index_dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

$filename = __DIR__ . \preg_replace('#(\?.*)$#', '', $_SERVER['REQUEST_URI']);

if (PHP_SAPI === 'cli-server' && \is_file($filename)) {
return false;
}
Expand Down

0 comments on commit 05f5504

Please sign in to comment.