Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"php": ">=8.1"
},
"require-dev": {
"digitalrevolution/accessorpair-constraint": "^2.1.18",
"digitalrevolution/phpunit-file-coverage-inspection": "^2.1",
"digitalrevolution/accessorpair-constraint": "^2.5",
"digitalrevolution/phpunit-file-coverage-inspection": "^2.2",
"roave/security-advisories": "dev-latest",
"squizlabs/php_codesniffer": "^3.8",
"squizlabs/php_codesniffer": "^3.11",
"phpmd/phpmd": "^2.15",
"phpunit/phpunit": "^10.5",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/extension-installer": "^1.3"
"phpunit/phpunit": "^10.5 || ^11.5",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpstan/extension-installer": "^1.4"
},
"scripts": {
"check": ["@check:phpstan", "@check:phpmd", "@check:phpcs"],
Expand Down
2 changes: 1 addition & 1 deletion src/Diff/ByWordRt.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function compareAndSplit(CharSequence $text1, CharSequence $text2,
}

/**
* @return InlineChunk[]
* @return list<InlineChunk>
*/
public static function getInlineChunks(CharSequence $text): array
{
Expand Down
5 changes: 3 additions & 2 deletions src/Diff/Comparison/AbstractChunkOptimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use DR\JBDiff\Entity\Range;
use DR\JBDiff\Entity\Side;
use DR\JBDiff\Util\TrimUtil;

use function count;

/**
Expand All @@ -21,8 +22,8 @@ abstract class AbstractChunkOptimizer
private array $ranges = [];

/**
* @param T[] $data1
* @param T[] $data2
* @param list<T> $data1
* @param list<T> $data2
* @param FairDiffIterableInterface $iterable
*/
public function __construct(
Expand Down
4 changes: 2 additions & 2 deletions src/Diff/Comparison/WordChunkOptimizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
class WordChunkOptimizer extends AbstractChunkOptimizer
{
/**
* @param InlineChunk[] $words1
* @param InlineChunk[] $words2
* @param list<InlineChunk> $words1
* @param list<InlineChunk> $words2
*/
public function __construct(
array $words1,
Expand Down
1 change: 1 addition & 0 deletions src/Entity/Pair.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public static function create(mixed $first, mixed $second): Pair
*/
public static function empty(): Pair
{
/** @var ?Pair<null, null> $pair */
static $pair = null;
$pair ??= new Pair(null, null);

Expand Down
2 changes: 2 additions & 0 deletions src/Entity/Side.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ public function select(mixed $left, mixed $right): mixed

private static function left(): Side
{
/** @var ?Side $left */
static $left = null;

return $left ??= new Side(self::LEFT);
}

private static function right(): Side
{
/** @var ?Side $right */
static $right = null;

return $right ??= new Side(self::RIGHT);
Expand Down
1 change: 1 addition & 0 deletions src/Util/BitSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public static function fromBinaryString(string $data): BitSet
return $bitSet;
}

/** @var list<int>|false $words */
$words = unpack(PHP_INT_SIZE === 4 ? 'N*' : 'J*', $data);
if ($words === false || count($words) === 0) {
throw new InvalidArgumentException('Unable to unpack from binary string: ' . base64_encode($data));
Expand Down
1 change: 1 addition & 0 deletions src/Util/Character.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public static function isContinuousScript(int $codePoint): bool
}

static $table = null;
/** @var array<int, false> $table */
$table ??= require dirname(__DIR__, 2) . '/resources/NonContinuousScriptLookupTable.php';

return $table[$codePoint] ?? true;
Expand Down
Loading