mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Apply "@PSR12" in php-cs-fixer (#1150)
* Apply "@PSR12" in php-cs-fixer * Run fix-style
This commit is contained in:
+2
-4
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
// Share common rules between non-test and test files
|
// Share common rules between non-test and test files
|
||||||
return [
|
return [
|
||||||
// PSR12 from https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4943
|
'@PSR12' => true,
|
||||||
'@PSR2' => true,
|
|
||||||
'blank_line_after_opening_tag' => true,
|
'blank_line_after_opening_tag' => true,
|
||||||
'braces' => [
|
'braces' => [
|
||||||
// Not-yet-implemented
|
'allow_single_line_anonymous_class_with_empty_body' => true,
|
||||||
// 'allow_single_line_anonymous_class_with_empty_body' => true,
|
|
||||||
],
|
],
|
||||||
'compact_nullable_typehint' => true,
|
'compact_nullable_typehint' => true,
|
||||||
'declare_equal_normalize' => true,
|
'declare_equal_normalize' => true,
|
||||||
|
|||||||
@@ -344,7 +344,6 @@ class Alias
|
|||||||
*/
|
*/
|
||||||
protected function detectMethods()
|
protected function detectMethods()
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach ($this->classes as $class) {
|
foreach ($this->classes as $class) {
|
||||||
$reflection = new \ReflectionClass($class);
|
$reflection = new \ReflectionClass($class);
|
||||||
|
|
||||||
|
|||||||
@@ -212,8 +212,6 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
protected function generateDocs($loadModels, $ignore = '')
|
protected function generateDocs($loadModels, $ignore = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
$output = "<?php
|
$output = "<?php
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@@ -313,7 +311,6 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$dirs = glob($dir, GLOB_ONLYDIR);
|
$dirs = glob($dir, GLOB_ONLYDIR);
|
||||||
foreach ($dirs as $dir) {
|
foreach ($dirs as $dir) {
|
||||||
|
|
||||||
if (!is_dir($dir)) {
|
if (!is_dir($dir)) {
|
||||||
$this->error("Cannot locate directory '{'$dir}'");
|
$this->error("Cannot locate directory '{'$dir}'");
|
||||||
continue;
|
continue;
|
||||||
@@ -757,7 +754,6 @@ class ModelsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function createPhpDocs($class)
|
protected function createPhpDocs($class)
|
||||||
{
|
{
|
||||||
|
|
||||||
$reflection = new ReflectionClass($class);
|
$reflection = new ReflectionClass($class);
|
||||||
$namespace = $reflection->getNamespaceName();
|
$namespace = $reflection->getNamespaceName();
|
||||||
$classname = $reflection->getShortName();
|
$classname = $reflection->getShortName();
|
||||||
@@ -1019,7 +1015,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$type = implode('|', $types);
|
$type = implode('|', $types);
|
||||||
|
|
||||||
if($returnType->allowsNull()){
|
if ($returnType->allowsNull()) {
|
||||||
$type .='|null';
|
$type .='|null';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1050,7 +1046,7 @@ class ModelsCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function getFactoryMethods($model)
|
protected function getFactoryMethods($model)
|
||||||
{
|
{
|
||||||
if(!class_exists(Factory::class)) {
|
if (!class_exists(Factory::class)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1128,7 +1124,7 @@ class ModelsCommand extends Command
|
|||||||
$reflectionType = $this->getReturnTypeFromDocBlock($methodReflection);
|
$reflectionType = $this->getReturnTypeFromDocBlock($methodReflection);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($reflectionType === 'static' || $reflectionType === '$this') {
|
if ($reflectionType === 'static' || $reflectionType === '$this') {
|
||||||
$reflectionType = $type;
|
$reflectionType = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1217,10 +1213,10 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$type = implode('|', $types);
|
$type = implode('|', $types);
|
||||||
|
|
||||||
if($paramType->allowsNull()){
|
if ($paramType->allowsNull()) {
|
||||||
if(count($types)==1){
|
if (count($types)==1) {
|
||||||
$type = '?' . $type;
|
$type = '?' . $type;
|
||||||
}else{
|
} else {
|
||||||
$type .='|null';
|
$type .='|null';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1293,12 +1289,12 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
protected function extractReflectionTypes(ReflectionType $reflection_type)
|
protected function extractReflectionTypes(ReflectionType $reflection_type)
|
||||||
{
|
{
|
||||||
if($reflection_type instanceof ReflectionNamedType){
|
if ($reflection_type instanceof ReflectionNamedType) {
|
||||||
$types[] = $this->getReflectionNamedType($reflection_type);
|
$types[] = $this->getReflectionNamedType($reflection_type);
|
||||||
}else{
|
} else {
|
||||||
$types = [];
|
$types = [];
|
||||||
foreach ($reflection_type->getTypes() as $named_type){
|
foreach ($reflection_type->getTypes() as $named_type) {
|
||||||
if($named_type->getName()==='null'){
|
if ($named_type->getName()==='null') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user