From 0f37edfc9beece3c11f7475471236cc77c08cff4 Mon Sep 17 00:00:00 2001 From: Meritoo Date: Sat, 16 Jun 2018 14:31:04 +0200 Subject: [PATCH] Coding standard > fix automatically --- CHANGELOG.md | 1 + src/Utilities/Bundle.php | 6 +-- src/Utilities/Date.php | 13 ++--- src/Utilities/MimeTypes.php | 3 +- src/Utilities/Miscellaneous.php | 3 +- src/Utilities/QueryBuilderUtility.php | 2 +- src/Utilities/Reflection.php | 47 +++++++------------ src/Utilities/Regex.php | 3 +- .../Base/UnknownTypeExceptionTest.php | 3 +- tests/Utilities/RepositoryTest.php | 1 - 10 files changed, 29 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6658b2..919a155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/Utilities/Bundle.php b/src/Utilities/Bundle.php index af79c27..29c146c 100644 --- a/src/Utilities/Bundle.php +++ b/src/Utilities/Bundle.php @@ -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) { diff --git a/src/Utilities/Date.php b/src/Utilities/Date.php index c19c530..210b7f5 100644 --- a/src/Utilities/Date.php +++ b/src/Utilities/Date.php @@ -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') { diff --git a/src/Utilities/MimeTypes.php b/src/Utilities/MimeTypes.php index 9951d1a..0c15394 100644 --- a/src/Utilities/MimeTypes.php +++ b/src/Utilities/MimeTypes.php @@ -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) { diff --git a/src/Utilities/Miscellaneous.php b/src/Utilities/Miscellaneous.php index da612e4..b77222d 100644 --- a/src/Utilities/Miscellaneous.php +++ b/src/Utilities/Miscellaneous.php @@ -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) { diff --git a/src/Utilities/QueryBuilderUtility.php b/src/Utilities/QueryBuilderUtility.php index 037a9bd..8485b05 100644 --- a/src/Utilities/QueryBuilderUtility.php +++ b/src/Utilities/QueryBuilderUtility.php @@ -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) { diff --git a/src/Utilities/Reflection.php b/src/Utilities/Reflection.php index 849a879..7d969cf 100644 --- a/src/Utilities/Reflection.php +++ b/src/Utilities/Reflection.php @@ -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) { diff --git a/src/Utilities/Regex.php b/src/Utilities/Regex.php index 638552e..cdec276 100644 --- a/src/Utilities/Regex.php +++ b/src/Utilities/Regex.php @@ -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) { diff --git a/tests/Exception/Base/UnknownTypeExceptionTest.php b/tests/Exception/Base/UnknownTypeExceptionTest.php index 78b8120..07e2da1 100644 --- a/tests/Exception/Base/UnknownTypeExceptionTest.php +++ b/tests/Exception/Base/UnknownTypeExceptionTest.php @@ -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) { diff --git a/tests/Utilities/RepositoryTest.php b/tests/Utilities/RepositoryTest.php index 3739a30..4a942bf 100644 --- a/tests/Utilities/RepositoryTest.php +++ b/tests/Utilities/RepositoryTest.php @@ -353,7 +353,6 @@ class RepositoryTest extends BaseTestCase yield[ [ - [], [], [