diff --git a/analyzer-baseline.toml b/analyzer-baseline.toml index 6a0f82f4..0e5464f9 100644 --- a/analyzer-baseline.toml +++ b/analyzer-baseline.toml @@ -1458,60 +1458,6 @@ code = "unhandled-thrown-type" message = 'Potentially unhandled exception `Psr\Container\NotFoundExceptionInterface` in `PhpDb\Container\AdapterInterfaceFactory::__invoke`.' count = 1 -[[issues]] -file = "src/Exception/ExceptionInterface.php" -code = "missing-api-or-internal" -message = 'Interface `PhpDb\Exception\ExceptionInterface` is missing an `@api` or `@internal` annotation.' -count = 1 - -[[issues]] -file = "src/Metadata/Exception/InvalidArgumentException.php" -code = "class-must-be-final" -message = 'Class `PhpDb\Metadata\Exception\InvalidArgumentException` should be declared `final`.' -count = 1 - -[[issues]] -file = "src/Metadata/Exception/RuntimeException.php" -code = "class-must-be-final" -message = 'Class `PhpDb\Metadata\Exception\RuntimeException` should be declared `final`.' -count = 1 - -[[issues]] -file = "src/Metadata/Object/ConstraintKeyObject.php" -code = "missing-constant-type" -message = "Class constant `FK_CASCADE` is missing a type hint." -count = 1 - -[[issues]] -file = "src/Metadata/Object/ConstraintKeyObject.php" -code = "missing-constant-type" -message = "Class constant `FK_NO_ACTION` is missing a type hint." -count = 1 - -[[issues]] -file = "src/Metadata/Object/ConstraintKeyObject.php" -code = "missing-constant-type" -message = "Class constant `FK_RESTRICT` is missing a type hint." -count = 1 - -[[issues]] -file = "src/Metadata/Object/ConstraintKeyObject.php" -code = "missing-constant-type" -message = "Class constant `FK_SET_DEFAULT` is missing a type hint." -count = 1 - -[[issues]] -file = "src/Metadata/Object/ConstraintKeyObject.php" -code = "missing-constant-type" -message = "Class constant `FK_SET_NULL` is missing a type hint." -count = 1 - -[[issues]] -file = "src/Metadata/Source/AbstractSource.php" -code = "missing-constant-type" -message = "Class constant `DEFAULT_SCHEMA` is missing a type hint." -count = 1 - [[issues]] file = "src/ResultSet/AbstractResultSet.php" code = "incompatible-return-type" diff --git a/lint-baseline.toml b/lint-baseline.toml index 82306798..3b2adff0 100644 --- a/lint-baseline.toml +++ b/lint-baseline.toml @@ -228,24 +228,6 @@ code = "no-isset" message = "Use of the `isset` construct." count = 1 -[[issues]] -file = "src/Exception/InvalidArgumentException.php" -code = "no-fully-qualified-global-class-like" -message = "Fully-qualified class-like reference detected." -count = 1 - -[[issues]] -file = "src/Exception/RuntimeException.php" -code = "no-fully-qualified-global-class-like" -message = "Fully-qualified class-like reference detected." -count = 1 - -[[issues]] -file = "src/Exception/UnexpectedValueException.php" -code = "no-fully-qualified-global-class-like" -message = "Fully-qualified class-like reference detected." -count = 1 - [[issues]] file = "src/ResultSet/AbstractResultSet.php" code = "cyclomatic-complexity" diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index 5aac64ea..c3376717 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -6,5 +6,9 @@ use Throwable; -/** Marker for every exception this package throws. */ +/** + * Marker for every exception this package throws. + * + * @api + */ interface ExceptionInterface extends Throwable {} diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index dfd9f705..f828615d 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -4,4 +4,6 @@ namespace PhpDb\Exception; -class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface {} +use InvalidArgumentException as BaseInvalidArgumentException; + +class InvalidArgumentException extends BaseInvalidArgumentException implements ExceptionInterface {} diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index 76060619..50cac487 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -4,4 +4,6 @@ namespace PhpDb\Exception; -class RuntimeException extends \RuntimeException implements ExceptionInterface {} +use RuntimeException as BaseRuntimeException; + +class RuntimeException extends BaseRuntimeException implements ExceptionInterface {} diff --git a/src/Exception/UnexpectedValueException.php b/src/Exception/UnexpectedValueException.php index c281897b..578534f8 100644 --- a/src/Exception/UnexpectedValueException.php +++ b/src/Exception/UnexpectedValueException.php @@ -4,4 +4,6 @@ namespace PhpDb\Exception; -class UnexpectedValueException extends \UnexpectedValueException implements ExceptionInterface {} +use UnexpectedValueException as BaseUnexpectedValueException; + +class UnexpectedValueException extends BaseUnexpectedValueException implements ExceptionInterface {} diff --git a/src/Metadata/Exception/InvalidArgumentException.php b/src/Metadata/Exception/InvalidArgumentException.php index 6fdac4db..4a97d1e8 100644 --- a/src/Metadata/Exception/InvalidArgumentException.php +++ b/src/Metadata/Exception/InvalidArgumentException.php @@ -6,4 +6,4 @@ use PhpDb\Exception; -class InvalidArgumentException extends Exception\InvalidArgumentException {} +final class InvalidArgumentException extends Exception\InvalidArgumentException {} diff --git a/src/Metadata/Exception/RuntimeException.php b/src/Metadata/Exception/RuntimeException.php index b814fb3e..b05595d8 100644 --- a/src/Metadata/Exception/RuntimeException.php +++ b/src/Metadata/Exception/RuntimeException.php @@ -8,7 +8,7 @@ use function sprintf; -class RuntimeException extends Exception\RuntimeException +final class RuntimeException extends Exception\RuntimeException { final public const string UNKNOWN_COLUMN = 'A column by that name was not found.'; diff --git a/src/Metadata/Object/ConstraintKeyObject.php b/src/Metadata/Object/ConstraintKeyObject.php index 973e3de3..191ad709 100644 --- a/src/Metadata/Object/ConstraintKeyObject.php +++ b/src/Metadata/Object/ConstraintKeyObject.php @@ -6,15 +6,15 @@ final class ConstraintKeyObject { - final public const FK_CASCADE = 'CASCADE'; + final public const string FK_CASCADE = 'CASCADE'; - final public const FK_SET_NULL = 'SET NULL'; + final public const string FK_SET_NULL = 'SET NULL'; - final public const FK_NO_ACTION = 'NO ACTION'; + final public const string FK_NO_ACTION = 'NO ACTION'; - final public const FK_RESTRICT = 'RESTRICT'; + final public const string FK_RESTRICT = 'RESTRICT'; - final public const FK_SET_DEFAULT = 'SET DEFAULT'; + final public const string FK_SET_DEFAULT = 'SET DEFAULT'; private ?int $ordinalPosition = null; diff --git a/src/Metadata/Source/AbstractSource.php b/src/Metadata/Source/AbstractSource.php index 6a994f90..3638d561 100644 --- a/src/Metadata/Source/AbstractSource.php +++ b/src/Metadata/Source/AbstractSource.php @@ -98,7 +98,7 @@ */ abstract class AbstractSource implements MetadataInterface { - public const DEFAULT_SCHEMA = '__DEFAULT_SCHEMA__'; + public const string DEFAULT_SCHEMA = '__DEFAULT_SCHEMA__'; protected string $defaultSchema;