28 lines
756 B
PHP
28 lines
756 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace StubTests\Parsers;
|
|
|
|
use phpDocumentor\Reflection\DocBlock\Tags\Deprecated;
|
|
use phpDocumentor\Reflection\DocBlock\Tags\Since;
|
|
use RecursiveArrayIterator;
|
|
use RecursiveIteratorIterator;
|
|
use StubTests\Model\Tags\RemovedTag;
|
|
|
|
class Utils
|
|
{
|
|
public static function flattenArray(array $arr, bool $group): array
|
|
{
|
|
return iterator_to_array(new RecursiveIteratorIterator(new RecursiveArrayIterator($arr)), $group);
|
|
}
|
|
|
|
/**
|
|
* @param Since|Deprecated|RemovedTag $tag
|
|
* @return bool
|
|
*/
|
|
public static function tagDoesNotHaveZeroPatchVersion($tag): bool
|
|
{
|
|
return (bool)preg_match('/^[1-9]+\.\d+(\.[1-9]+\d*)*$/',$tag->getVersion()); //find version like any but 7.4.0
|
|
}
|
|
}
|