Fix "Array and string offset access syntax with curly braces is deprecated" error while running tests (using PHP 7.4)

This commit is contained in:
Meritoo
2021-02-26 15:09:02 +01:00
parent ab0c0e6e89
commit c6efc30872
3 changed files with 9 additions and 9 deletions

View File

@@ -18,7 +18,7 @@
"ext-pcre": "*", "ext-pcre": "*",
"ext-simplexml": "*", "ext-simplexml": "*",
"doctrine/orm": "^2.6", "doctrine/orm": "^2.6",
"gedmo/doctrine-extensions": "^2.4" "gedmo/doctrine-extensions": "^3.0"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "^2.14", "friendsofphp/php-cs-fixer": "^2.14",

View File

@@ -574,7 +574,7 @@ class Miscellaneous
if ($textLength > $maxLength) { if ($textLength > $maxLength) {
$effect = mb_substr($text, 0, $maxLength, 'utf-8'); $effect = mb_substr($text, 0, $maxLength, 'utf-8');
$lastSpacePosition = mb_strrpos($effect, ' ', 'utf-8'); $lastSpacePosition = mb_strrpos($effect, ' ', 0, 'utf-8');
if (false !== $lastSpacePosition) { if (false !== $lastSpacePosition) {
$effect = mb_substr($effect, 0, $lastSpacePosition, 'utf-8'); $effect = mb_substr($effect, 0, $lastSpacePosition, 'utf-8');

View File

@@ -8,8 +8,8 @@
namespace Meritoo\Common\Utilities; namespace Meritoo\Common\Utilities;
use Doctrine\Common\Inflector\Inflector; use Doctrine\Inflector\InflectorFactory;
use Doctrine\Common\Persistence\Proxy; use Doctrine\Persistence\Proxy;
use Meritoo\Common\Collection\BaseCollection; use Meritoo\Common\Collection\BaseCollection;
use Meritoo\Common\Exception\Reflection\CannotResolveClassNameException; use Meritoo\Common\Exception\Reflection\CannotResolveClassNameException;
use Meritoo\Common\Exception\Reflection\MissingChildClassesException; use Meritoo\Common\Exception\Reflection\MissingChildClassesException;
@@ -418,8 +418,8 @@ class Reflection
* *
* @param array|object|string $class Class who child classes should be returned. An array of objects, strings, * @param array|object|string $class Class who child classes should be returned. An array of objects, strings,
* object or string. * object or string.
* @throws CannotResolveClassNameException
* @return null|array * @return null|array
* @throws CannotResolveClassNameException
*/ */
public static function getChildClasses($class): ?array public static function getChildClasses($class): ?array
{ {
@@ -471,9 +471,8 @@ class Reflection
* *
* @param array|object|string $parentClass Class who child class should be returned. An array of objects, * @param array|object|string $parentClass Class who child class should be returned. An array of objects,
* namespaces, object or namespace. * namespaces, object or namespace.
* @throws MissingChildClassesException
* @throws TooManyChildClassesException
* @return mixed * @return mixed
* @throws TooManyChildClassesException|MissingChildClassesException|CannotResolveClassNameException
*/ */
public static function getOneChildClass($parentClass) public static function getOneChildClass($parentClass)
{ {
@@ -531,8 +530,8 @@ class Reflection
* @param array|string $trait An array of strings or string * @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 * @param bool $verifyParents If is set to true, parent classes are verified if they use given
* trait. Otherwise - not. * trait. Otherwise - not.
* @throws CannotResolveClassNameException
* @return null|bool * @return null|bool
* @throws CannotResolveClassNameException|ReflectionException
*/ */
public static function usesTrait($class, $trait, bool $verifyParents = false): ?bool public static function usesTrait($class, $trait, bool $verifyParents = false): ?bool
{ {
@@ -711,7 +710,8 @@ class Reflection
$valueFound = false; $valueFound = false;
$reflectionObject = new ReflectionObject($source); $reflectionObject = new ReflectionObject($source);
$property = Inflector::classify($property); $inflector = InflectorFactory::create()->build();
$property = $inflector->classify($property);
$gettersPrefixes = [ $gettersPrefixes = [
'get', 'get',