Skip to content

Commit

Permalink
Replace @final with final keyword
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Nov 6, 2023
1 parent fd23598 commit 5a9b126
Show file tree
Hide file tree
Showing 45 changed files with 49 additions and 88 deletions.
6 changes: 6 additions & 0 deletions docs/book/v3/migration/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ $filtered = $filter->filter('A String');

## Removed Features

### Final by default

Nearly all the shipped filters now have the final keyword applied to the class. Individual filters were not designed for inheritance, so if you have filters that do extend from any of the shipped filters, you will likely have to re-consider your design.

### Removal of supported compression formats

`Laminas\Filter\Compress` no longer supports the compression formats `Lzf`, `Rar` and `Snappy`.
Support for these formats has been removed so the following classes are no longer available:

Expand Down
3 changes: 1 addition & 2 deletions src/AllowList.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* ...
* }
* @extends AbstractFilter<Options>
* @final
*/
class AllowList extends AbstractFilter
final class AllowList extends AbstractFilter
{
/** @var bool */
protected $strict = false;
Expand Down
3 changes: 1 addition & 2 deletions src/BaseName.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
/**
* @psalm-type Options = array{}
* @extends AbstractFilter<Options>
* @final
*/
class BaseName extends AbstractFilter
final class BaseName extends AbstractFilter
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/Boolean.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
* translations?: array,
* }
* @extends AbstractFilter<Options>
* @final
*/
class Boolean extends AbstractFilter
final class Boolean extends AbstractFilter
{
public const TYPE_BOOLEAN = 1;
public const TYPE_INTEGER = 2;
Expand Down
3 changes: 1 addition & 2 deletions src/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
* ...
* }
* @extends AbstractFilter<Options>
* @final
*/
class Callback extends AbstractFilter
final class Callback extends AbstractFilter
{
/** @var array */
protected $options = [
Expand Down
3 changes: 1 addition & 2 deletions src/Compress/Bz2.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
* archive?: string|null,
* }
* @extends AbstractCompressionAlgorithm<Options>
* @final
*/
class Bz2 extends AbstractCompressionAlgorithm
final class Bz2 extends AbstractCompressionAlgorithm
{
/**
* Compression Options
Expand Down
3 changes: 1 addition & 2 deletions src/Compress/Gz.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
* archive?: string|null,
* }
* @extends AbstractCompressionAlgorithm<Options>
* @final
*/
class Gz extends AbstractCompressionAlgorithm
final class Gz extends AbstractCompressionAlgorithm
{
/**
* Compression Options
Expand Down
3 changes: 1 addition & 2 deletions src/Compress/Tar.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
* mode?: 'gz'|'bz2'|null,
* }
* @extends AbstractCompressionAlgorithm<Options>
* @final
*/
class Tar extends AbstractCompressionAlgorithm
final class Tar extends AbstractCompressionAlgorithm
{
/**
* Compression Options
Expand Down
3 changes: 1 addition & 2 deletions src/Compress/Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
* target?: string|null,
* }
* @extends AbstractCompressionAlgorithm<Options>
* @final
*/
class Zip extends AbstractCompressionAlgorithm
final class Zip extends AbstractCompressionAlgorithm
{
/**
* Compression Options
Expand Down
1 change: 0 additions & 1 deletion src/DataUnitFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* prefixes?: list<string>,
* }
* @extends AbstractFilter<Options>
* @final
*/
final class DataUnitFormatter extends AbstractFilter
{
Expand Down
3 changes: 1 addition & 2 deletions src/DateSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* }
* @template TOptions of Options
* @template-extends AbstractDateDropdown<TOptions, InputArray>
* @final
*/
class DateSelect extends AbstractDateDropdown
final class DateSelect extends AbstractDateDropdown
{
/**
* Year-Month-Day
Expand Down
3 changes: 1 addition & 2 deletions src/DateTimeFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* ...
* }
* @extends AbstractFilter<Options>
* @final
*/
class DateTimeFormatter extends AbstractFilter
final class DateTimeFormatter extends AbstractFilter
{
/**
* A valid format string accepted by date()
Expand Down
3 changes: 1 addition & 2 deletions src/DateTimeSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
* }
* @template TOptions of Options
* @template-extends AbstractDateDropdown<TOptions, InputArray>
* @final
*/
class DateTimeSelect extends AbstractDateDropdown
final class DateTimeSelect extends AbstractDateDropdown
{
/**
* Year-Month-Day Hour:Min:Sec
Expand Down
4 changes: 1 addition & 3 deletions src/Decompress.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@

/**
* Decompresses a given string
*
* @final
*/
class Decompress extends Compress
final class Decompress extends Compress
{
/**
* Use filter as functor
Expand Down
3 changes: 1 addition & 2 deletions src/DenyList.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
* ...
* }
* @extends AbstractFilter<Options>
* @final
*/
class DenyList extends AbstractFilter
final class DenyList extends AbstractFilter
{
/** @var bool */
protected $strict = false;
Expand Down
3 changes: 1 addition & 2 deletions src/Digits.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
/**
* @psalm-type Options = array{}
* @extends AbstractFilter<Options>
* @final
*/
class Digits extends AbstractFilter
final class Digits extends AbstractFilter
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/Dir.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
/**
* @psalm-type Options = array{}
* @extends AbstractFilter<Options>
* @final
*/
class Dir extends AbstractFilter
final class Dir extends AbstractFilter
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/File/LowerCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
use function is_string;
use function is_writable;

/** @final */
class LowerCase extends StringToLower
final class LowerCase extends StringToLower
{
/**
* Defined by Laminas\Filter\Filter
Expand Down
3 changes: 1 addition & 2 deletions src/File/Rename.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
* }
* @template TOptions of Options
* @template-extends Filter\AbstractFilter<TOptions>
* @final
*/
class Rename extends Filter\AbstractFilter
final class Rename extends Filter\AbstractFilter
{
/**
* Internal array of array(source, target, overwrite)
Expand Down
3 changes: 1 addition & 2 deletions src/File/UpperCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
use function is_scalar;
use function is_writable;

/** @final */
class UpperCase extends StringToUpper
final class UpperCase extends StringToUpper
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/FilterChain.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use function strtolower;

/**
* @final
* @psalm-type FilterChainConfiguration = array{
* filters?: list<array{
* name: string|class-string<FilterInterface>,
Expand All @@ -35,7 +34,7 @@
* @extends AbstractFilter<FilterChainConfiguration>
* @implements IteratorAggregate<array-key, FilterInterface|callable(mixed): mixed>
*/
class FilterChain extends AbstractFilter implements Countable, IteratorAggregate
final class FilterChain extends AbstractFilter implements Countable, IteratorAggregate
{
/**
* Default priority at which filters are added
Expand Down
3 changes: 1 addition & 2 deletions src/FilterPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
* FilterInterface. Additionally, it registers a number of default filters
* available, as well as aliases for them.
*
* @final
* @extends AbstractPluginManager<FilterInterface|callable(mixed): mixed>
*/
class FilterPluginManager extends AbstractPluginManager
final class FilterPluginManager extends AbstractPluginManager
{
protected $aliases = [
// @codingStandardsIgnoreStart
Expand Down
3 changes: 1 addition & 2 deletions src/HtmlEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
* ...
* }
* @extends AbstractFilter<Options>
* @final
*/
class HtmlEntities extends AbstractFilter
final class HtmlEntities extends AbstractFilter
{
/**
* Corresponds to the second htmlentities() argument
Expand Down
3 changes: 1 addition & 2 deletions src/Inflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@
* pluginManager?: FilterPluginManager,
* }
* @extends AbstractFilter<Options>
* @final
*/
class Inflector extends AbstractFilter
final class Inflector extends AbstractFilter
{
/** @var FilterPluginManager */
protected $pluginManager;
Expand Down
3 changes: 1 addition & 2 deletions src/MonthSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
* }
* @template TOptions of Options
* @template-extends AbstractDateDropdown<TOptions, InputArray>
* @final
*/
class MonthSelect extends AbstractDateDropdown
final class MonthSelect extends AbstractDateDropdown
{
/**
* Year-Month
Expand Down
3 changes: 1 addition & 2 deletions src/PregReplace.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
* replacement?: string|list<string>,
* }
* @extends AbstractFilter<Options>
* @final
*/
class PregReplace extends AbstractFilter
final class PregReplace extends AbstractFilter
{
/** @var Options */
protected $options = [
Expand Down
3 changes: 1 addition & 2 deletions src/RealPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
* }
* @template TOptions of Options
* @extends AbstractFilter<TOptions>
* @final
*/
class RealPath extends AbstractFilter
final class RealPath extends AbstractFilter
{
/** @var TOptions $options */
protected $options = [
Expand Down
3 changes: 1 addition & 2 deletions src/StringPrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* prefix?: null|string,
* }
* @extends AbstractFilter<Options>
* @final
*/
class StringPrefix extends AbstractFilter
final class StringPrefix extends AbstractFilter
{
/** @var Options */
protected $options = [
Expand Down
3 changes: 1 addition & 2 deletions src/StringSuffix.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
* suffix?: null|string,
* }
* @extends AbstractFilter<Options>
* @final
*/
class StringSuffix extends AbstractFilter
final class StringSuffix extends AbstractFilter
{
/** @var Options */
protected $options = [
Expand Down
3 changes: 1 addition & 2 deletions src/StringTrim.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
* charlist?: string|null,
* }
* @extends AbstractFilter<Options>
* @final
*/
class StringTrim extends AbstractFilter
final class StringTrim extends AbstractFilter
{
/** @var Options */
protected $options = [
Expand Down
3 changes: 1 addition & 2 deletions src/StripNewlines.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
/**
* @psalm-type Options = array{}
* @extends AbstractFilter<Options>
* @final
*/
class StripNewlines extends AbstractFilter
final class StripNewlines extends AbstractFilter
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/StripTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
* ...
* }
* @extends AbstractFilter<Options>
* @final
*/
class StripTags extends AbstractFilter
final class StripTags extends AbstractFilter
{
/**
* Unique ID prefix used for allowing comments
Expand Down
3 changes: 1 addition & 2 deletions src/ToFloat.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
/**
* @psalm-type Options = array{}
* @extends AbstractFilter<Options>
* @final
*/
class ToFloat extends AbstractFilter
final class ToFloat extends AbstractFilter
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/ToInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
/**
* @psalm-type Options = array{}
* @extends AbstractFilter<Options>
* @final
*/
class ToInt extends AbstractFilter
final class ToInt extends AbstractFilter
{
/**
* Defined by Laminas\Filter\FilterInterface
Expand Down
3 changes: 1 addition & 2 deletions src/ToNull.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
* type?: int-mask-of<self::TYPE_*>,
* }
* @extends AbstractFilter<Options>
* @final
*/
class ToNull extends AbstractFilter
final class ToNull extends AbstractFilter
{
public const TYPE_BOOLEAN = 1;
public const TYPE_INTEGER = 2;
Expand Down
Loading

0 comments on commit 5a9b126

Please sign in to comment.