[php] Add PSR-12 rule set (#12302)

* Upgrade PHPCS-Fixer to 3.5 version

This version requires PHP 7.4 or 8.0 which perfectly meets our supported
PHP right now.

* Rename config file to .php-cs-fixer.dist.php

This way it can be overwritten with local file(same name without "dist"
part). Also it's recommended filename from the package doc.

* Add PSR12 rule set to config

I've changed config file a bit to look like example from the doc.
Ref: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/HEAD/doc/config.rst

* Ignore new cache format

* Remove blank line after class opening

* Set constants in models public

* Refresh samples
This commit is contained in:
Yuriy Belenko
2022-05-09 19:34:38 +03:00
committed by GitHub
parent 8d4c9e2472
commit e639dad66a
26 changed files with 105 additions and 72 deletions

View File

@@ -167,10 +167,10 @@ class EnumArrays implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIModelName;
}
const JUST_SYMBOL_GREATER_THAN_OR_EQUAL_TO = '>=';
const JUST_SYMBOL_DOLLAR = '$';
const ARRAY_ENUM_FISH = 'fish';
const ARRAY_ENUM_CRAB = 'crab';
public const JUST_SYMBOL_GREATER_THAN_OR_EQUAL_TO = '>=';
public const JUST_SYMBOL_DOLLAR = '$';
public const ARRAY_ENUM_FISH = 'fish';
public const ARRAY_ENUM_CRAB = 'crab';
/**
* Gets allowable values of the enum

View File

@@ -42,11 +42,11 @@ class EnumClass
/**
* Possible values of this enum
*/
const ABC = '_abc';
public const ABC = '_abc';
const EFG = '-efg';
public const EFG = '-efg';
const XYZ = '(xyz)';
public const XYZ = '(xyz)';
/**
* Gets allowable values of the enum

View File

@@ -197,16 +197,16 @@ class EnumTest implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIModelName;
}
const ENUM_STRING_UPPER = 'UPPER';
const ENUM_STRING_LOWER = 'lower';
const ENUM_STRING_EMPTY = '';
const ENUM_STRING_REQUIRED_UPPER = 'UPPER';
const ENUM_STRING_REQUIRED_LOWER = 'lower';
const ENUM_STRING_REQUIRED_EMPTY = '';
const ENUM_INTEGER_1 = 1;
const ENUM_INTEGER_MINUS_1 = -1;
const ENUM_NUMBER_1_DOT_1 = 1.1;
const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
public const ENUM_STRING_UPPER = 'UPPER';
public const ENUM_STRING_LOWER = 'lower';
public const ENUM_STRING_EMPTY = '';
public const ENUM_STRING_REQUIRED_UPPER = 'UPPER';
public const ENUM_STRING_REQUIRED_LOWER = 'lower';
public const ENUM_STRING_REQUIRED_EMPTY = '';
public const ENUM_INTEGER_1 = 1;
public const ENUM_INTEGER_MINUS_1 = -1;
public const ENUM_NUMBER_1_DOT_1 = 1.1;
public const ENUM_NUMBER_MINUS_1_DOT_2 = -1.2;
/**
* Gets allowable values of the enum

View File

@@ -177,8 +177,8 @@ class MapTest implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIModelName;
}
const MAP_OF_ENUM_STRING_UPPER = 'UPPER';
const MAP_OF_ENUM_STRING_LOWER = 'lower';
public const MAP_OF_ENUM_STRING_UPPER = 'UPPER';
public const MAP_OF_ENUM_STRING_LOWER = 'lower';
/**
* Gets allowable values of the enum

View File

@@ -187,9 +187,9 @@ class Order implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIModelName;
}
const STATUS_PLACED = 'placed';
const STATUS_APPROVED = 'approved';
const STATUS_DELIVERED = 'delivered';
public const STATUS_PLACED = 'placed';
public const STATUS_APPROVED = 'approved';
public const STATUS_DELIVERED = 'delivered';
/**
* Gets allowable values of the enum

View File

@@ -42,11 +42,11 @@ class OuterEnum
/**
* Possible values of this enum
*/
const PLACED = 'placed';
public const PLACED = 'placed';
const APPROVED = 'approved';
public const APPROVED = 'approved';
const DELIVERED = 'delivered';
public const DELIVERED = 'delivered';
/**
* Gets allowable values of the enum

View File

@@ -42,11 +42,11 @@ class OuterEnumDefaultValue
/**
* Possible values of this enum
*/
const PLACED = 'placed';
public const PLACED = 'placed';
const APPROVED = 'approved';
public const APPROVED = 'approved';
const DELIVERED = 'delivered';
public const DELIVERED = 'delivered';
/**
* Gets allowable values of the enum

View File

@@ -42,11 +42,11 @@ class OuterEnumInteger
/**
* Possible values of this enum
*/
const NUMBER_0 = 0;
public const NUMBER_0 = 0;
const NUMBER_1 = 1;
public const NUMBER_1 = 1;
const NUMBER_2 = 2;
public const NUMBER_2 = 2;
/**
* Gets allowable values of the enum

View File

@@ -42,11 +42,11 @@ class OuterEnumIntegerDefaultValue
/**
* Possible values of this enum
*/
const NUMBER_0 = 0;
public const NUMBER_0 = 0;
const NUMBER_1 = 1;
public const NUMBER_1 = 1;
const NUMBER_2 = 2;
public const NUMBER_2 = 2;
/**
* Gets allowable values of the enum

View File

@@ -187,9 +187,9 @@ class Pet implements ModelInterface, ArrayAccess, \JsonSerializable
return self::$openAPIModelName;
}
const STATUS_AVAILABLE = 'available';
const STATUS_PENDING = 'pending';
const STATUS_SOLD = 'sold';
public const STATUS_AVAILABLE = 'available';
public const STATUS_PENDING = 'pending';
public const STATUS_SOLD = 'sold';
/**
* Gets allowable values of the enum

View File

@@ -42,9 +42,9 @@ class SingleRefType
/**
* Possible values of this enum
*/
const ADMIN = 'admin';
public const ADMIN = 'admin';
const USER = 'user';
public const USER = 'user';
/**
* Gets allowable values of the enum