Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 130 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in([
'./',
'app',
'config',
'tests',
])
->exclude([
'vendors',
'bootstrap',
]);

$rules = [
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => [
'syntax' => 'short',
],
'binary_operator_spaces' => [
'operators' => ['=>' => 'align', '=' => 'single_space'],
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => [
'return',
'throw',
],
],
'cast_spaces' => true,
'class_attributes_separation' => [
'elements' => [
'method' => 'one',
'property' => 'one',
],
],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => [
'spacing' => 'one',
],
'declare_equal_normalize' => true,
'elseif' => true,
'list_syntax' => [
'syntax' => 'short',
],
'lowercase_cast' => true,
'magic_constant_casing' => true,
'method_chaining_indentation' => true,
'native_function_casing' => true,
'native_function_type_declaration_casing' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'multiline_whitespace_before_semicolons' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_in_blank_line' => true,
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'ordered_imports' => true,
'ordered_interfaces' => true,
'php_unit_construct' => [
'assertions' => [
'assertEquals',
'assertNotEquals',
'assertNotSame',
'assertSame',
],
],
'php_unit_dedicate_assert' => [
'target' => 'newest',
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_annotation' => [
'style' => 'annotation',
],
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
],
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'return_assignment' => true,
'return_type_declaration' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
'single_blank_line_at_eof' => true,
'blank_lines_before_namespace' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'space_after_semicolon' => true,
'standardize_not_equals' => true,
'ternary_operator_spaces' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'void_return' => true,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false,
],
];

return (new Config())
->setFinder($finder)
->setRules(array_merge($rules, []))
->setRiskyAllowed(true);
130 changes: 0 additions & 130 deletions .php_cs.dist

This file was deleted.

3 changes: 2 additions & 1 deletion app/Commands/Auth/LoginCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function handle(AuthenticationContract $auth)
{
$status = $this->task('Authenticating', function () use ($auth) {
try {
if (!$auth->check()) {
if (! $auth->check()) {
if ($this->triggerNewLogin($auth)) {
$token = $auth->retrieveToken();

Expand All @@ -48,6 +48,7 @@ public function handle(AuthenticationContract $auth)
$this->info('Already authenticated');
} catch (HttpException $e) {
$this->error($e->getMessage());

return false;
}
});
Expand Down
1 change: 1 addition & 0 deletions app/Commands/Auth/LogoutCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function handle(AuthenticationContract $auth)
return true;
} catch (HttpException $e) {
$this->error($e->getMessage());

return false;
}
});
Expand Down
18 changes: 11 additions & 7 deletions app/Commands/Config/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\Facades\File;
use JsonException;
use function Laravel\Prompts\select;
use LaravelZero\Framework\Commands\Command;

class InitCommand extends Command
Expand Down Expand Up @@ -31,13 +32,16 @@ class InitCommand extends Command
*/
public function handle()
{
$template = $this->output->choice('Which notebook template will the project be identified as?', [
'Laravel Notebook' => 'laravel',
'Symfony' => 'symfony',
'Slim' => 'slim',
'Standard' => 'standard',
'ReactPHP' => 'react-php-http',
]);
$template = select(
label: 'Which notebook template will the project be identified as ?',
options: [
'Laravel Notebook' => 'laravel',
'Symfony' => 'symfony',
'Slim' => 'slim',
'Standard' => 'standard',
'ReactPHP' => 'react-php-http',
]
);

$this->info("You have selected $template");

Expand Down
5 changes: 3 additions & 2 deletions app/Commands/Export/ExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ public function handle(
try {
if (! $auth->check()) {
if ($this->confirm('Only authenticated users can export to PHPSandbox, do you want to log in now?', 'yes')) {
return ($this->call('login')) == Command::SUCCESS;
return $this->call('login') == Command::SUCCESS;
}

return false;
}

return true;
} catch (HttpException $e) {
$this->error($e->getMessage());

return false;
}
});


$this->tasks('Running notebook pre-compression validation', function () use ($validate) {
if (! $validate->validate(getcwd(), ['hasComposer','composerIsValid'])) {
$this->error(implode("\n", $validate->errors()));
Expand Down
1 change: 0 additions & 1 deletion app/Commands/Import/ImportNotebookCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use App\Traits\FormatHttpErrorResponse;
use App\Traits\Multitask;
use Closure;
use CurlHandle;
use Exception;
use LaravelZero\Framework\Commands\Command;

Expand Down
4 changes: 2 additions & 2 deletions app/Commands/UpdateSelfCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class UpdateSelfCommand extends SelfUpdateCommand
{
protected $name = "update-self";
protected $name = 'update-self';

protected $description = "Update PHPSandbox cli to a latest release";
protected $description = 'Update PHPSandbox cli to a latest release';
}
Loading