Skip to content

Commit

Permalink
Merge pull request #255 from gsteel/v2/soft-final-everywhere
Browse files Browse the repository at this point in the history
Mark all classes as soft `@final` where possible
  • Loading branch information
gsteel authored Jun 13, 2024
2 parents dc3f260 + 889f53f commit 715e115
Show file tree
Hide file tree
Showing 87 changed files with 127 additions and 49 deletions.
38 changes: 5 additions & 33 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
</MixedArgument>
</file>
<file src="src/AbstractValidator.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this]]></code>
<code><![CDATA[$this]]></code>
<code><![CDATA[$this]]></code>
<code><![CDATA[$this]]></code>
<code><![CDATA[$this]]></code>
<code><![CDATA[$this]]></code>
</LessSpecificReturnStatement>
<MixedArgumentTypeCoercion>
<code><![CDATA[$value]]></code>
</MixedArgumentTypeCoercion>
Expand Down Expand Up @@ -367,15 +359,6 @@
</PossiblyUnusedMethod>
</file>
<file src="src/Bitwise.php">
<DocblockTypeContradiction>
<code><![CDATA[self::OP_AND === $this->operator]]></code>
<code><![CDATA[self::OP_AND === $this->operator]]></code>
<code><![CDATA[self::OP_XOR === $this->operator]]></code>
<code><![CDATA[self::OP_XOR === $this->operator]]></code>
</DocblockTypeContradiction>
<InvalidPropertyAssignmentValue>
<code><![CDATA[$operator]]></code>
</InvalidPropertyAssignmentValue>
<MixedAssignment>
<code><![CDATA[$temp['control']]]></code>
<code><![CDATA[$temp['operator']]]></code>
Expand Down Expand Up @@ -474,6 +457,9 @@
<code><![CDATA[is_array($options)]]></code>
<code><![CDATA[null === $this->session]]></code>
</DocblockTypeContradiction>
<ImpureByReferenceAssignment>
<code><![CDATA[$session->tokenList]]></code>
</ImpureByReferenceAssignment>
<MixedArgument>
<code><![CDATA[$key]]></code>
<code><![CDATA[$session->tokenList[$tokenId]]]></code>
Expand Down Expand Up @@ -1657,9 +1643,6 @@
</RedundantCastGivenDocblockType>
</file>
<file src="src/Ip.php">
<LessSpecificImplementedReturnType>
<code><![CDATA[AbstractValidator]]></code>
</LessSpecificImplementedReturnType>
<MixedArgument>
<code><![CDATA[$regex]]></code>
<code><![CDATA[$regex]]></code>
Expand Down Expand Up @@ -1803,25 +1786,14 @@
<DocblockTypeContradiction>
<code><![CDATA[is_array($options)]]></code>
</DocblockTypeContradiction>
<InvalidArgument>
<code><![CDATA[$value]]></code>
</InvalidArgument>
<MixedArgument>
<code><![CDATA[$this->baseValue]]></code>
<code><![CDATA[$this->step]]></code>
<code><![CDATA[$options['baseValue']]]></code>
<code><![CDATA[$options['step']]]></code>
</MixedArgument>
<MixedAssignment>
<code><![CDATA[$temp['baseValue']]]></code>
<code><![CDATA[$temp['step']]]></code>
</MixedAssignment>
<MixedInferredReturnType>
<code><![CDATA[string]]></code>
<code><![CDATA[string]]></code>
</MixedInferredReturnType>
<MixedReturnStatement>
<code><![CDATA[$this->baseValue]]></code>
<code><![CDATA[$this->step]]></code>
</MixedReturnStatement>
<PossiblyInvalidArgument>
<code><![CDATA[$options]]></code>
</PossiblyInvalidArgument>
Expand Down
2 changes: 1 addition & 1 deletion src/AbstractValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function getOptions()
* Sets one or multiple options
*
* @param array<string, mixed>|Traversable<string, mixed> $options Options to set
* @return $this Provides fluid interface
* @return self Provides fluid interface
* @throws Exception\InvalidArgumentException If $options is not an array or Traversable.
*/
public function setOptions($options = [])
Expand Down
1 change: 1 addition & 0 deletions src/Barcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use function substr;
use function ucfirst;

/** @final */
class Barcode extends AbstractValidator
{
public const INVALID = 'barcodeInvalid';
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Codabar.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use function strpbrk;
use function substr;

/** @final */
class Codabar extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code128.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use function is_string;
use function ord;

/** @final */
class Code128 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code25.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Code25 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code25interleaved.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Code25interleaved extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code39.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use function str_split;
use function substr;

/** @final */
class Code39 extends AbstractAdapter
{
/** @var array */
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code39ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Code39ext extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code93.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use function str_split;
use function substr;

/** @final */
class Code93 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Code93ext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Code93ext extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean12.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Ean12 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean13.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Ean13 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean14.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Ean14 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean18.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Ean18 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Ean2 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean5.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Ean5 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Ean8.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use function strlen;

/** @final */
class Ean8 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Gtin12.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Gtin12 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Gtin13.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Gtin13 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Gtin14.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Gtin14 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Identcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Identcode extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Intelligentmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Intelligentmail extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Issn.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use function strlen;
use function substr;

/** @final */
class Issn extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Itf14.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Itf14 extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Leitcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Leitcode extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Planet.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Planet extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Postnet.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Postnet extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Royalmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use function strlen;
use function substr;

/** @final */
class Royalmail extends AbstractAdapter
{
/** @var array<array-key, int> */
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Sscc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Sscc extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Upca.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator\Barcode;

/** @final */
class Upca extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Barcode/Upce.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use function strlen;

/** @final */
class Upce extends AbstractAdapter
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Between.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use const PHP_INT_MAX;

/** @final */
class Between extends AbstractValidator
{
public const NOT_BETWEEN = 'notBetween';
Expand Down
5 changes: 3 additions & 2 deletions src/Bitwise.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use function is_array;
use function iterator_to_array;

/** @final */
class Bitwise extends AbstractValidator
{
public const OP_AND = 'and';
Expand Down Expand Up @@ -43,7 +44,7 @@ class Bitwise extends AbstractValidator
'control' => 'control',
];

/** @var null|int */
/** @var null|string */
protected $operator;

/** @var bool */
Expand Down Expand Up @@ -96,7 +97,7 @@ public function getControl()
/**
* Returns the operator parameter.
*
* @return null|int
* @return null|string
*/
public function getOperator()
{
Expand Down
1 change: 1 addition & 0 deletions src/BusinessIdentifierCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use function preg_match;
use function strtoupper;

/** @final */
class BusinessIdentifierCode extends AbstractValidator
{
public const INVALID = 'valueNotBic';
Expand Down
1 change: 1 addition & 0 deletions src/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* throwExceptions?: bool,
* ...<string, mixed>
* }
* @final
*/
class Callback extends AbstractValidator
{
Expand Down
1 change: 1 addition & 0 deletions src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Laminas\Validator;

/** @final */
class ConfigProvider
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/CreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use function strlen;
use function strtoupper;

/** @final */
class CreditCard extends AbstractValidator
{
/**
Expand Down
Loading

0 comments on commit 715e115

Please sign in to comment.