Skip to content

Add remaining native return types #502

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint">
<severity>4</severity>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingNativeTypeHint">
<severity>4</severity>
</rule>
<rule ref="Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps">
<severity>4</severity>
</rule>
Expand Down
6 changes: 0 additions & 6 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -857,9 +857,6 @@
<code>$built[$field]</code>
<code><![CDATA[$parsedClauses[$token->value]]]></code>
</InvalidArgument>
<MethodSignatureMustProvideReturnType>
<code>__toString</code>
</MethodSignatureMustProvideReturnType>
<MixedArrayOffset>
<code><![CDATA[$parsedClauses[$token->value]]]></code>
<code><![CDATA[$parsedClauses[$token->value]]]></code>
Expand Down Expand Up @@ -1206,9 +1203,6 @@
</RedundantConditionGivenDocblockType>
</file>
<file src="src/UtfString.php">
<MethodSignatureMustProvideReturnType>
<code>__toString</code>
</MethodSignatureMustProvideReturnType>
<PossiblyUnusedProperty>
<code>$byteLen</code>
</PossiblyUnusedProperty>
Expand Down
4 changes: 1 addition & 3 deletions src/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ interface Component extends Stringable
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return mixed
*/
public static function parse(Parser $parser, TokensList $list, array $options = []);
public static function parse(Parser $parser, TokensList $list, array $options = []): mixed;

/**
* Builds the string representation of a component of this type.
Expand Down
4 changes: 1 addition & 3 deletions src/Components/AlterOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,8 @@ public function __construct(
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return AlterOperation
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): AlterOperation
{
$ret = new static();

Expand Down
2 changes: 1 addition & 1 deletion src/Components/ArrayObj.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(array $raw = [], array $values = [])
*
* @return ArrayObj|Component[]
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): ArrayObj|array
{
$ret = empty($options['type']) ? new static() : [];

Expand Down
4 changes: 1 addition & 3 deletions src/Components/CaseExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,8 @@ final class CaseExpression implements Component
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return CaseExpression
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): CaseExpression
{
$ret = new static();

Expand Down
2 changes: 1 addition & 1 deletion src/Components/CreateDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function __construct(
*
* @return CreateDefinition[]
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): array
{
$ret = [];

Expand Down
4 changes: 1 addition & 3 deletions src/Components/DataType.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ public function __construct(
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return DataType|null
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): DataType|null
{
$ret = new static();

Expand Down
4 changes: 1 addition & 3 deletions src/Components/FunctionCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ public function __construct($name = null, $parameters = null)
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return FunctionCall
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): FunctionCall
{
$ret = new static();

Expand Down
4 changes: 1 addition & 3 deletions src/Components/IntoKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,8 @@ public function __construct(
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return IntoKeyword
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): IntoKeyword
{
$ret = new static();

Expand Down
4 changes: 1 addition & 3 deletions src/Components/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,8 @@ public function __construct(
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return Key
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): Key
{
$ret = new static();

Expand Down
4 changes: 1 addition & 3 deletions src/Components/Limit.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ public function __construct($rowCount = 0, $offset = 0)
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return Limit
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): Limit
{
$ret = new static();

Expand Down
9 changes: 2 additions & 7 deletions src/Components/LockExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ final class LockExpression implements Component
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return LockExpression
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): LockExpression
{
$ret = new static();

Expand Down Expand Up @@ -109,10 +107,7 @@ public static function buildAll(array $component): string
return implode(', ', $component);
}

/**
* @return string
*/
private static function parseLockType(Parser $parser, TokensList $list)
private static function parseLockType(Parser $parser, TokensList $list): string
{
$lockType = '';

Expand Down
8 changes: 2 additions & 6 deletions src/Components/OptionsArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ public function __construct(public array $options = [])
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return OptionsArray
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): OptionsArray
{
$ret = new static();

Expand Down Expand Up @@ -295,10 +293,8 @@ public static function build($component): string
* @param string $key the key to be checked
* @param bool $getExpr Gets the expression instead of the value.
* The value is the processed form of the expression.
*
* @return mixed
*/
public function has($key, $getExpr = false)
public function has($key, $getExpr = false): mixed
{
foreach ($this->options as $option) {
if (is_array($option)) {
Expand Down
4 changes: 1 addition & 3 deletions src/Components/PartitionDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ final class PartitionDefinition implements Component
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return PartitionDefinition
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): PartitionDefinition
{
$ret = new static();

Expand Down
4 changes: 1 addition & 3 deletions src/Components/Reference.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ public function __construct($table = null, array $columns = [], $options = null)
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return Reference
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): Reference
{
$ret = new static();

Expand Down
4 changes: 1 addition & 3 deletions src/Components/UnionKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ final class UnionKeyword implements Component
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return mixed
*
* @throws RuntimeException not implemented yet.
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): mixed
{
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}
Expand Down
4 changes: 1 addition & 3 deletions src/Components/WithKeyword.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ public function __construct(string $name)
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return mixed
*
* @throws RuntimeException not implemented yet.
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
public static function parse(Parser $parser, TokensList $list, array $options = []): mixed
{
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}
Expand Down
4 changes: 1 addition & 3 deletions src/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,8 @@ private static function getModeFromString(string $mode): int
*
* @param string $str the string to be escaped
* @param string $quote quote to be used when escaping
*
* @return string
*/
public static function escape(string $str, string $quote = '`')
public static function escape(string $str, string $quote = '`'): string
{
if ((static::$mode & self::SQL_MODE_NO_ENCLOSING_QUOTES) && (! static::isKeyword($str, true))) {
return $str;
Expand Down
4 changes: 1 addition & 3 deletions src/Core.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ public function __construct()
*
* @param Exception $error the error exception
*
* @return void
*
* @throws Exception throws the exception, if strict mode is enabled.
*/
public function error($error)
public function error($error): void
{
if ($this->strict) {
throw $error;
Expand Down
Loading