Skip to content

Commit

Permalink
Fix all phpcs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Maksims Sļotovs committed Jul 19, 2021
1 parent 8822c7b commit 4058322
Show file tree
Hide file tree
Showing 52 changed files with 227 additions and 217 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 7.2
- 7.3
- 7.4
- 8.0
Expand All @@ -13,7 +12,7 @@ install: travis_retry composer install --prefer-source
script: composer ci

after_success:
- if [[ "`phpenv version-name`" != "7.4" ]]; then exit 0; fi
- if [[ "`phpenv version-name`" != "8.0" ]]; then exit 0; fi
- vendor/bin/phpunit --coverage-clover coverage.clover
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"irc": "irc:https://irc.freenode.net/wikimedia-de-tech"
},
"require": {
"php": ">=7.2"
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "~8.5.0",
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
interface ArrayComparer {
interface ArrayComparerInterface {

/**
* Returns an array containing all the entries from arrayOne that are not present in arrayTwo.
Expand Down
4 changes: 2 additions & 2 deletions src/ArrayComparer/NativeArrayComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class NativeArrayComparer implements ArrayComparer {
class NativeArrayComparer implements ArrayComparerInterface {

/**
* @see ArrayComparer::diffArrays
* @see ArrayComparerInterface::diffArrays
*
* Uses @see array_diff.
*
Expand Down
8 changes: 4 additions & 4 deletions src/ArrayComparer/OrderedArrayComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Diff\ArrayComparer;

use Diff\Comparer\ValueComparer;
use Diff\Comparer\ValueComparerInterface;

/**
* Computes the difference between two ordered arrays by comparing elements with
Expand All @@ -19,16 +19,16 @@
* @author Jeroen De Dauw < [email protected] >
* @author Tobias Gritschacher < [email protected] >
*/
class OrderedArrayComparer implements ArrayComparer {
class OrderedArrayComparer implements ArrayComparerInterface {

private $valueComparer;

public function __construct( ValueComparer $valueComparer ) {
public function __construct( ValueComparerInterface $valueComparer ) {
$this->valueComparer = $valueComparer;
}

/**
* @see ArrayComparer::diffArrays
* @see ArrayComparerInterface::diffArrays
*
* @since 0.9
*
Expand Down
8 changes: 4 additions & 4 deletions src/ArrayComparer/StrategicArrayComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Diff\ArrayComparer;

use Diff\Comparer\ValueComparer;
use Diff\Comparer\ValueComparerInterface;

/**
* Computes the difference between two arrays by comparing elements with
Expand All @@ -17,16 +17,16 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class StrategicArrayComparer implements ArrayComparer {
class StrategicArrayComparer implements ArrayComparerInterface {

private $valueComparer;

public function __construct( ValueComparer $valueComparer ) {
public function __construct( ValueComparerInterface $valueComparer ) {
$this->valueComparer = $valueComparer;
}

/**
* @see ArrayComparer::diffArrays
* @see ArrayComparerInterface::diffArrays
*
* @since 0.8
*
Expand Down
4 changes: 2 additions & 2 deletions src/ArrayComparer/StrictArrayComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class StrictArrayComparer implements ArrayComparer {
class StrictArrayComparer implements ArrayComparerInterface {

/**
* @see ArrayComparer::diffArrays
* @see ArrayComparerInterface::diffArrays
*
* @since 0.8
*
Expand Down
2 changes: 1 addition & 1 deletion src/Comparer/CallbackComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class CallbackComparer implements ValueComparer {
class CallbackComparer implements ValueComparerInterface {

private $callback;

Expand Down
2 changes: 1 addition & 1 deletion src/Comparer/ComparableComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class ComparableComparer implements ValueComparer {
class ComparableComparer implements ValueComparerInterface {

public function valuesAreEqual( $firstValue, $secondValue ): bool {
if ( $firstValue && method_exists( $firstValue, 'equals' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/Comparer/StrictComparer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class StrictComparer implements ValueComparer {
class StrictComparer implements ValueComparerInterface {

/**
* @param mixed $firstValue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
interface ValueComparer {
interface ValueComparerInterface {

/**
* @since 0.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @author Jeroen De Dauw < [email protected] >
* @author Daniel Kinzler
*/
abstract class AtomicDiffOp implements DiffOp {
abstract class AbstractAtomicDiffOp implements DiffOpInterface {

/**
* @see Countable::count
Expand All @@ -28,7 +28,7 @@ public function count(): int {
}

/**
* @see DiffOp::isAtomic
* @see DiffOpInterface::isAtomic
*
* @since 0.1
*
Expand Down
30 changes: 15 additions & 15 deletions src/DiffOp/Diff/Diff.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Diff\DiffOp\Diff;

use ArrayObject;
use Diff\DiffOp\DiffOp;
use Diff\DiffOp\DiffOpInterface;
use Diff\DiffOp\DiffOpAdd;
use Diff\DiffOp\DiffOpChange;
use Diff\DiffOp\DiffOpRemove;
Expand All @@ -22,7 +22,7 @@
* @author Daniel Kinzler
* @author Thiemo Kreuz
*/
class Diff extends ArrayObject implements DiffOp {
class Diff extends ArrayObject implements DiffOpInterface {

/**
* @var bool|null
Expand Down Expand Up @@ -51,7 +51,7 @@ class Diff extends ArrayObject implements DiffOp {
/**
* @since 0.1
*
* @param DiffOp[] $operations
* @param DiffOpInterface[] $operations
* @param bool|null $isAssociative
*
* @throws InvalidArgumentException
Expand All @@ -64,7 +64,7 @@ public function __construct( array $operations = [], $isAssociative = null ) {
parent::__construct( [] );

foreach ( $operations as $offset => $operation ) {
if ( !( $operation instanceof DiffOp ) ) {
if ( !( $operation instanceof DiffOpInterface) ) {
throw new InvalidArgumentException( 'All elements fed to the Diff constructor should be of type DiffOp' );
}

Expand All @@ -77,7 +77,7 @@ public function __construct( array $operations = [], $isAssociative = null ) {
/**
* @since 0.1
*
* @return DiffOp[]
* @return DiffOpInterface[]
*/
public function getOperations(): array {
return $this->getArrayCopy();
Expand All @@ -88,7 +88,7 @@ public function getOperations(): array {
*
* @param string $type
*
* @return DiffOp[]
* @return DiffOpInterface[]
*/
public function getTypeOperations( string $type ): array {
return array_intersect_key(
Expand All @@ -100,7 +100,7 @@ public function getTypeOperations( string $type ): array {
/**
* @since 0.1
*
* @param DiffOp[] $operations
* @param DiffOpInterface[] $operations
*/
public function addOperations( array $operations ) {
foreach ( $operations as $operation ) {
Expand All @@ -118,12 +118,12 @@ public function addOperations( array $operations ) {
* does not get added to the ArrayObject.
*
* @param int|string $index
* @param DiffOp $value
* @param DiffOpInterface $value
*
* @return bool
* @throws InvalidArgumentException
*/
private function preSetElement( $index, DiffOp $value ): bool {
private function preSetElement( $index, DiffOpInterface $value ): bool {
if ( $this->isAssociative === false && ( $value->getType() !== 'add' && $value->getType() !== 'remove' ) ) {
throw new InvalidArgumentException( 'Diff operation with invalid type "' . $value->getType() . '" provided.' );
}
Expand Down Expand Up @@ -219,7 +219,7 @@ function( DiffOpRemove $addition ) {
}

/**
* @see DiffOp::isAtomic
* @see DiffOpInterface::isAtomic
*
* @since 0.1
*
Expand All @@ -230,7 +230,7 @@ public function isAtomic(): bool {
}

/**
* @see DiffOp::getType
* @see DiffOpInterface::getType
*
* @since 0.1
*
Expand All @@ -256,7 +256,7 @@ public function count(): int {
$count = 0;

/**
* @var DiffOp $diffOp
* @var DiffOpInterface $diffOp
*/
foreach ( $this as $diffOp ) {
$count += $diffOp->count();
Expand Down Expand Up @@ -318,7 +318,7 @@ public function hasAssociativeOperations(): bool {
/**
* Returns the Diff in array form where nested DiffOps are also turned into their array form.
*
* @see DiffOp::toArray
* @see DiffOpInterface::toArray
*
* @since 0.5
*
Expand Down Expand Up @@ -414,7 +414,7 @@ public function offsetSet( $index, $value ) {
* @throws InvalidArgumentException
*/
private function setElement( $index, $value ) {
if ( !( $value instanceof DiffOp ) ) {
if ( !( $value instanceof DiffOpInterface)) {
throw new InvalidArgumentException(
'Can only add DiffOp implementing objects to ' . get_called_class() . '.'
);
Expand Down Expand Up @@ -455,7 +455,7 @@ public function serialize() {
* @return bool
*/
public function isEmpty(): bool {
/** @var DiffOp $diffOp */
/** @var DiffOpInterface $diffOp */
foreach ( $this as $diffOp ) {
if ( $diffOp->count() > 0 ) {
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/DiffOp/DiffOpAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class DiffOpAdd extends AtomicDiffOp {
class DiffOpAdd extends AbstractAtomicDiffOp {

private $newValue;

/**
* @see DiffOp::getType
* @see DiffOpInterface::getType
*
* @since 0.1
*
Expand Down Expand Up @@ -69,7 +69,7 @@ public function unserialize( $serialization ) {
}

/**
* @see DiffOp::toArray
* @see DiffOpInterface::toArray
*
* @since 0.5
*
Expand Down
6 changes: 3 additions & 3 deletions src/DiffOp/DiffOpChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
class DiffOpChange extends AtomicDiffOp {
class DiffOpChange extends AbstractAtomicDiffOp {

private $newValue;
private $oldValue;

/**
* @see DiffOp::getType
* @see DiffOpInterface::getType
*
* @since 0.1
*
Expand Down Expand Up @@ -81,7 +81,7 @@ public function unserialize( $serialization ) {
}

/**
* @see DiffOp::toArray
* @see DiffOpInterface::toArray
*
* @since 0.5
*
Expand Down
2 changes: 1 addition & 1 deletion src/DiffOp/DiffOp.php → src/DiffOp/DiffOpInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license BSD-3-Clause
* @author Jeroen De Dauw < [email protected] >
*/
interface DiffOp extends Serializable, Countable {
interface DiffOpInterface extends Serializable, Countable {

/**
* Returns a string identifier for the operation type.
Expand Down
Loading

0 comments on commit 4058322

Please sign in to comment.