Coding standard > fix automatically

This commit is contained in:
Meritoo
2018-06-16 14:31:04 +02:00
parent ae3e82e233
commit 0f37edfc9b
10 changed files with 29 additions and 53 deletions

View File

@@ -8,3 +8,4 @@ Common and useful classes, methods, exceptions etc.
3. Docker: use project-related binaries globally
4. StyleCI & PHP Coding Standards Fixer: update configuration
5. Documentation > Docker > add paragraph for PHP Coding Standards Fixer
6. Coding standard > fix automatically

View File

@@ -24,9 +24,8 @@ class Bundle
* @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template"
* @param string $bundleName Full name of the bundle, e.g. "MyExtraBundle"
* @param string $extension (optional) Extension of the view / template (default: "html.twig")
* @return string|null
*
* @throws IncorrectBundleNameException
* @return string|null
*/
public static function getBundleViewPath($viewPath, $bundleName, $extension = 'html.twig')
{
@@ -65,9 +64,8 @@ class Bundle
* Returns short name of bundle (without "Bundle")
*
* @param string $fullBundleName Full name of the bundle, e.g. "MyExtraBundle"
* @return string|null
*
* @throws IncorrectBundleNameException
* @return string|null
*/
public static function getShortBundleName($fullBundleName)
{

View File

@@ -68,9 +68,8 @@ class Date
* The dates are returned in an array with indexes 'start' and 'end'.
*
* @param int $period The period, type of period. One of DatePeriod class constants, e.g. DatePeriod::LAST_WEEK.
* @return null|DatePeriod
*
* @throws Exception
* @return null|DatePeriod
*/
public static function getDatesForPeriod($period)
{
@@ -221,8 +220,8 @@ class Date
/**
* Returns current day of week
*
* @return int
* @throws UnknownDatePartTypeException
* @return int
*/
public static function getCurrentDayOfWeek()
{
@@ -243,8 +242,8 @@ class Date
* @param int $month The month value
* @param int $day The day value
*
* @return int
* @throws UnknownDatePartTypeException
* @return int
*/
public static function getDayOfWeek($year, $month, $day)
{
@@ -488,9 +487,8 @@ class Date
* @param string $intervalTemplate (optional) Template used to build date interval. It should contain "%d" as the
* placeholder which is replaced with a number that represents each iteration.
* Default: interval for days.
* @return array
*
* @throws Exception
* @return array
*/
public static function getDatesCollection(DateTime $startDate, $datesCount, $intervalTemplate = 'P%dD')
{
@@ -535,9 +533,8 @@ class Date
* @param int $end (optional) End of random partition
* @param string $intervalTemplate (optional) Template used to build date interval. The placeholder is replaced
* with next, iterated value.
* @return DateTime
*
* @throws Exception
* @return DateTime
*/
public static function getRandomDate(DateTime $startDate = null, $start = 1, $end = 100, $intervalTemplate = 'P%sD')
{

View File

@@ -759,9 +759,8 @@ class MimeTypes
* Returns mime type of given file
*
* @param string $filePath Path of the file to check
* @return string
*
* @throws \RuntimeException
* @return string
*/
public static function getMimeType($filePath)
{

View File

@@ -1312,10 +1312,9 @@ class Miscellaneous
* Returns inverted value of color for given color
*
* @param string $color Hexadecimal value of color to invert (with or without hash), e.g. "dd244c" or "#22a5fe"
* @return string
*
* @throws IncorrectColorHexLengthException
* @throws InvalidColorHexValueException
* @return string
*/
public static function getInvertedColor($color)
{

View File

@@ -158,8 +158,8 @@ class QueryBuilderUtility
* @param array|ArrayCollection $entities The entities to delete
* @param bool $flushDeleted (optional) If is set to true, flushes the deleted objects (default
* behaviour). Otherwise - not.
* @return bool
* @throws OptimisticLockException
* @return bool
*/
public static function deleteEntities(EntityManager $entityManager, $entities, $flushDeleted = true)
{

View File

@@ -34,9 +34,8 @@ class Reflection
* @param object|string $class The object or name of object's class
* @param bool $withoutInheritance (optional) If is set to true, only methods for given class are returned.
* Otherwise - all methods, with inherited methods too.
* @return array
*
* @throws ReflectionException
* @return array
*/
public static function getMethods($class, $withoutInheritance = false)
{
@@ -66,9 +65,8 @@ class Reflection
* Returns constants of given class / object
*
* @param object|string $class The object or name of object's class
* @return array
*
* @throws ReflectionException
* @return array
*/
public static function getConstants($class)
{
@@ -82,9 +80,8 @@ class Reflection
* Constants whose values are integers are considered only.
*
* @param object|string $class The object or name of object's class
* @return int|null
*
* @throws ReflectionException
* @return int|null
*/
public static function getMaxNumberConstant($class)
{
@@ -110,9 +107,8 @@ class Reflection
*
* @param object|string $class The object or name of object's class
* @param string $method Name of the method to find
* @return bool
*
* @throws ReflectionException
* @return bool
*/
public static function hasMethod($class, $method)
{
@@ -126,9 +122,8 @@ class Reflection
*
* @param object|string $class The object or name of object's class
* @param string $property Name of the property to find
* @return bool
*
* @throws ReflectionException
* @return bool
*/
public static function hasProperty($class, $property)
{
@@ -142,9 +137,8 @@ class Reflection
*
* @param object|string $class The object or name of object's class
* @param string $constant Name of the constant to find
* @return bool
*
* @throws ReflectionException
* @return bool
*/
public static function hasConstant($class, $constant)
{
@@ -158,9 +152,8 @@ class Reflection
*
* @param object|string $class The object or name of object's class
* @param string $constant Name of the constant that contains a value
* @return mixed
*
* @throws ReflectionException
* @return mixed
*/
public static function getConstantValue($class, $constant)
{
@@ -182,9 +175,8 @@ class Reflection
* dot-separated, e.g. "invoice.user.email".
* @param bool $force (optional) If is set to true, try to retrieve value even if the object doesn't have
* property. Otherwise - not.
* @return mixed
*
* @throws ReflectionException
* @return mixed
*/
public static function getPropertyValue($object, $property, $force = false)
{
@@ -300,9 +292,8 @@ class Reflection
* @param string $property Name of the property that contains a value
* @param bool $force (optional) If is set to true, try to retrieve value even if the
* object does not have property. Otherwise - not.
* @return array
*
* @throws ReflectionException
* @return array
*/
public static function getPropertyValues($objects, $property, $force = false)
{
@@ -461,9 +452,8 @@ class Reflection
* constants. By default all properties are returned.
* @param bool $includeParents (optional) If is set to true, properties of parent classes are
* included (recursively). Otherwise - not.
* @return array|ReflectionProperty
*
* @throws ReflectionException
* @return array|ReflectionProperty
*/
public static function getProperties($source, $filter = null, $includeParents = false)
{
@@ -496,9 +486,8 @@ class Reflection
* Returns a parent class or false if there is no parent class
*
* @param array|object|string $source An array of objects, namespaces, object or namespace
* @return ReflectionClass|bool
*
* @throws ReflectionException
* @return ReflectionClass|bool
*/
public static function getParentClass($source)
{
@@ -514,8 +503,8 @@ class Reflection
*
* @param array|object|string $class Class who child classes should be returned. An array of objects, strings,
* object or string.
* @return array|null
* @throws CannotResolveClassNameException
* @return array|null
*/
public static function getChildClasses($class)
{
@@ -569,11 +558,10 @@ class Reflection
*
* @param array|object|string $parentClass Class who child class should be returned. An array of objects,
* namespaces, object or namespace.
* @return mixed
*
* @throws CannotResolveClassNameException
* @throws MissingChildClassesException
* @throws TooManyChildClassesException
* @return mixed
*/
public static function getOneChildClass($parentClass)
{
@@ -605,9 +593,8 @@ class Reflection
* @param string $property Name of the property
* @param int $filter (optional) Filter of properties. Uses ReflectionProperty class constants.
* By default all properties are allowed / processed.
* @return null|ReflectionProperty
*
* @throws ReflectionException
* @return null|ReflectionProperty
*/
public static function getProperty($class, $property, $filter = null)
{
@@ -633,10 +620,9 @@ class Reflection
* @param array|string $trait An array of strings or string
* @param bool $verifyParents If is set to true, parent classes are verified if they use given
* trait. Otherwise - not.
* @return bool|null
*
* @throws CannotResolveClassNameException
* @throws ReflectionException
* @return bool|null
*/
public static function usesTrait($class, $trait, $verifyParents = false)
{
@@ -678,9 +664,8 @@ class Reflection
* If given class does not extend another, returns null.
*
* @param array|object|string $class An array of objects, namespaces, object or namespace
* @return string|null
*
* @throws ReflectionException
* @return string|null
*/
public static function getParentClassName($class)
{

View File

@@ -766,10 +766,9 @@ class Regex
* @param string $color Color to verify
* @param bool $throwException (optional) If is set to true, throws an exception if given color is invalid
* (default behaviour). Otherwise - not.
* @return string|bool
*
* @throws IncorrectColorHexLengthException
* @throws InvalidColorHexValueException
* @return string|bool
*/
public static function getValidColorHexValue($color, $throwException = true)
{

View File

@@ -82,9 +82,8 @@ class TestService
* Returns translated type (for testing purposes)
*
* @param string $type Type of something (for testing purposes)
* @return string
*
* @throws UnknownTestTypeException
* @return string
*/
public function getTranslatedType($type)
{

View File

@@ -353,7 +353,6 @@ class RepositoryTest extends BaseTestCase
yield[
[
[],
[],
[