Skip to content

Commit

Permalink
Merge pull request #99 from JBlond/php-diff-92
Browse files Browse the repository at this point in the history
Use coalesce for $avail[$char]
  • Loading branch information
JBlond authored Jun 8, 2021
2 parents c09edb2 + 3c05022 commit 012effa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Composer ###
composer.phar
/vendor/
/composer.lock
/.phpunit.result.cache


# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
Expand Down Expand Up @@ -72,4 +75,3 @@ local.properties


# End of https://www.gitignore.io/api/windows,eclipse,composer
/composer.lock
2 changes: 1 addition & 1 deletion lib/jblond/Diff/Similarity.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private function getRatioFast(): float
$aLength = count($this->old);
for ($iterator = 0; $iterator < $aLength; ++$iterator) {
$char = $this->old[$iterator];
$numb = isset($avail[$char]) ? $avail[$char] : $this->uniqueCount2[$char] ?? 0;
$numb = $avail[$char] ?? ($this->uniqueCount2[$char] ?? 0);
$avail[$char] = $numb - 1;
if ($numb > 0) {
++$matches;
Expand Down

0 comments on commit 012effa

Please sign in to comment.