From 50ecd8b8151f6a9124d495d290597ec6b181c766 Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Mon, 7 May 2018 11:38:57 +0200 Subject: [PATCH] Update CS, typo --- composer.json | 8 +++++--- grumphp.yml | 15 +++++++++++++++ src/Alias.php | 10 ++++++++-- src/Console/ModelsCommand.php | 2 +- 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 grumphp.yml diff --git a/composer.json b/composer.json index ed7f329..ceab9f4 100644 --- a/composer.json +++ b/composer.json @@ -20,9 +20,10 @@ "require-dev": { "illuminate/config": "^5.0,<5.7", "illuminate/view": "^5.0,<5.7", + "phpro/grumphp": "^0.14", "phpunit/phpunit" : "4.*", "scrutinizer/ocular": "~1.1", - "squizlabs/php_codesniffer": "~2.3", + "squizlabs/php_codesniffer": "^3", "doctrine/dbal": "~2.3" }, "suggest": { @@ -35,12 +36,13 @@ }, "autoload-dev": { "psr-4": { - ":vendor\\:package_name\\": "tests" + "Barryvdh\\LaravelIdeHelper\\": "tests" } }, "scripts": { "test": "phpunit", - "cs": "phpcs --standard=psr2 src/" + "check-style": "phpcs -p --standard=PSR2 src/", + "fix-style": "phpcbf -p --standard=PSR2 src/" }, "extra": { "branch-alias": { diff --git a/grumphp.yml b/grumphp.yml new file mode 100644 index 0000000..4b767a0 --- /dev/null +++ b/grumphp.yml @@ -0,0 +1,15 @@ +parameters: + git_dir: . + bin_dir: vendor/bin + tasks: + phpunit: + config_file: ~ + testsuite: ~ + group: [] + always_execute: false + phpcs: + standard: PSR2 + warning_severity: ~ + ignore_patterns: + - tests/ + triggered_by: [php] \ No newline at end of file diff --git a/src/Alias.php b/src/Alias.php index 3c6be30..a7c5b70 100644 --- a/src/Alias.php +++ b/src/Alias.php @@ -383,7 +383,8 @@ class Alias return new \ReflectionFunction($macro_func); } - + + /* * Get the docblock for this alias * * @param string $prefix @@ -392,7 +393,12 @@ class Alias public function getDocComment($prefix = "\t\t") { $serializer = new DocBlockSerializer(1, $prefix); - return ($this->phpdoc) ? $serializer->getDocComment($this->phpdoc) : ''; + + if ($this->phpdoc) { + return $serializer->getDocComment($this->phpdoc); + } + + return ''; } /** diff --git a/src/Console/ModelsCommand.php b/src/Console/ModelsCommand.php index c5c1f70..7edc282 100644 --- a/src/Console/ModelsCommand.php +++ b/src/Console/ModelsCommand.php @@ -300,7 +300,7 @@ class ModelsCommand extends Command if (isset($this->nullableColumns[$name])) { $this->properties[$name]['type'] .= '|null'; - } + } } } }