Update PHPDoc and comments

This commit is contained in:
Meritoo
2018-04-02 22:46:02 +02:00
parent 8d1df9ced8
commit ddbff1b557
7 changed files with 58 additions and 1 deletions

View File

@@ -159,6 +159,7 @@ trait BaseTestCaseTrait
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments
* of the verified method
* @throws UnknownOopVisibilityTypeException
* @throws ReflectionException
*
* Attention. 2nd argument, the $method, may be:
* - string - name of the method
@@ -215,6 +216,7 @@ trait BaseTestCaseTrait
* @param int $argumentsCount (optional) Expected count/amount of arguments of the verified method
* @param int $requiredArgumentsCount (optional) Expected count/amount of required arguments of the verified
* method
* @throws ReflectionException
* @throws UnknownOopVisibilityTypeException
*/
protected static function assertConstructorVisibilityAndArguments(
@@ -236,6 +238,7 @@ trait BaseTestCaseTrait
* Asserts that class with given namespace has no constructor
*
* @param string $classNamespace Namespace of class that contains constructor to verify
* @throws ReflectionException
*/
protected static function assertHasNoConstructor($classNamespace)
{

View File

@@ -530,6 +530,10 @@ class Arrays
*/
public static function removeElement(array $array, $item)
{
/*
* No elements or the element does not exist?
* Nothing to do
*/
if (empty($array) || !in_array($item, $array)) {
return false;
}
@@ -626,6 +630,10 @@ class Arrays
*/
public static function setKeysAsValues(array $array, $ignoreDuplicatedValues = true)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return [];
}
@@ -1083,6 +1091,10 @@ class Arrays
*/
public static function getAllValuesOfKey(array $array, $key)
{
/*
* No elements?
* Nothing to do
*/
if (empty($array)) {
return null;
}

View File

@@ -23,7 +23,7 @@ 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
* @param string $extension (optional) Extension of the view / template (default: "html.twig")
* @return string|null
*
* @throws IncorrectBundleNameException

View File

@@ -9,6 +9,8 @@
namespace Meritoo\Common\Utilities;
use Gedmo\Sluggable\Util\Urlizer;
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
use Symfony\Component\HttpFoundation\Cookie;
use Transliterator;
@@ -1433,6 +1435,9 @@ class Miscellaneous
*
* @param string $color Hexadecimal value of color to invert (with or without hash), e.g. "dd244c" or "#22a5fe"
* @return string
*
* @throws IncorrectColorHexLengthException
* @throws InvalidColorHexValueException
*/
public static function getInvertedColor($color)
{

View File

@@ -35,6 +35,8 @@ class Reflection
* @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
*/
public static function getMethods($class, $withoutInheritance = false)
{
@@ -65,6 +67,8 @@ class Reflection
*
* @param object|string $class The object or name of object's class
* @return array
*
* @throws ReflectionException
*/
public static function getConstants($class)
{
@@ -79,6 +83,8 @@ class Reflection
*
* @param object|string $class The object or name of object's class
* @return int|null
*
* @throws ReflectionException
*/
public static function getMaxNumberConstant($class)
{
@@ -105,6 +111,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
*/
public static function hasMethod($class, $method)
{
@@ -119,6 +127,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
*/
public static function hasProperty($class, $property)
{
@@ -133,6 +143,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
*/
public static function hasConstant($class, $constant)
{
@@ -147,6 +159,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
*/
public static function getConstantValue($class, $constant)
{
@@ -169,6 +183,8 @@ class Reflection
* @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
*/
public static function getPropertyValue($object, $property, $force = false)
{
@@ -285,6 +301,8 @@ class Reflection
* @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
*/
public static function getPropertyValues($objects, $property, $force = false)
{
@@ -444,6 +462,8 @@ class Reflection
* @param bool $includeParents (optional) If is set to true, properties of parent classes are
* included (recursively). Otherwise - not.
* @return array|ReflectionProperty
*
* @throws ReflectionException
*/
public static function getProperties($source, $filter = null, $includeParents = false)
{
@@ -477,6 +497,8 @@ class Reflection
*
* @param array|object|string $source An array of objects, namespaces, object or namespace
* @return ReflectionClass|bool
*
* @throws ReflectionException
*/
public static function getParentClass($source)
{
@@ -549,6 +571,7 @@ class Reflection
* namespaces, object or namespace.
* @return mixed
*
* @throws CannotResolveClassNameException
* @throws MissingChildClassesException
* @throws TooManyChildClassesException
*/
@@ -583,6 +606,8 @@ class Reflection
* @param int $filter (optional) Filter of properties. Uses ReflectionProperty class constants.
* By default all properties are allowed / processed.
* @return null|ReflectionProperty
*
* @throws ReflectionException
*/
public static function getProperty($class, $property, $filter = null)
{
@@ -609,7 +634,9 @@ class Reflection
* @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
*/
public static function usesTrait($class, $trait, $verifyParents = false)
{
@@ -652,6 +679,8 @@ class Reflection
*
* @param array|object|string $class An array of objects, namespaces, object or namespace
* @return string|null
*
* @throws ReflectionException
*/
public static function getParentClassName($class)
{

View File

@@ -730,6 +730,10 @@ class Regex
*/
public static function isValidMoneyValue($value)
{
/*
* Not a scalar value?
* Nothing to do
*/
if (!is_scalar($value)) {
return false;
}

View File

@@ -12,6 +12,7 @@ use Generator;
use Meritoo\Common\Exception\Regex\IncorrectColorHexLengthException;
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
use Meritoo\Common\Test\Base\BaseTestCase;
use ReflectionException;
/**
* Test case of the useful regular expressions methods
@@ -24,6 +25,9 @@ class RegexTest extends BaseTestCase
private $simpleText;
private $camelCaseText;
/**
* @throws ReflectionException
*/
public function testConstructor()
{
static::assertHasNoConstructor(Regex::class);