diff --git a/docs/annotating_code/type_syntax/top_bottom_types.md b/docs/annotating_code/type_syntax/top_bottom_types.md index ead9ffcfd4e..83a04e927c6 100644 --- a/docs/annotating_code/type_syntax/top_bottom_types.md +++ b/docs/annotating_code/type_syntax/top_bottom_types.md @@ -12,6 +12,6 @@ It can be aliased to `no-return` or `never-return` in docblocks. Note: it replac This is the _bottom type_ in PHP's type system. It's used to describe a type that has no possible value. It can happen in multiple cases: - the actual `never` type from PHP 8.1 (can be used in docblocks for older versions). This type can be used as a return type for functions that will never return, either because they always throw exceptions or always exit() -- an union type that have been stripped for all its possible types. (For example, if a variable is `string|int` and we perform a is_bool() check in a condition, the type of the variable in the condition will be `never` as the condition will never be entered) +- a union type that has been stripped of all its possible types. (For example, if a variable is `string|int` and we perform an is_bool() check in a condition, the type of the variable in the condition will be `never` as the condition will never be entered) - it can represent a placeholder for types yet to come — a good example is the type of the empty array `[]`, which Psalm types as `array`, the content of the array is void so it can accept any content - it can also happen in the same context as the line above for templates that have yet to be defined diff --git a/docs/running_psalm/configuration.md b/docs/running_psalm/configuration.md index d00baae88d3..ab66fb19a10 100644 --- a/docs/running_psalm/configuration.md +++ b/docs/running_psalm/configuration.md @@ -444,10 +444,10 @@ Allows you to hard-code the number of threads Psalm will use (similar to `--thre maxStringLength="1000" > ``` -This setting controls the maximum length of literal strings that will be transformed into a literal string type during Psalm analysis. -Strings longer than this value (by default 1000 bytes) will be transformed in a generic `non-empty-string` type, instead. +This setting controls the maximum length of literal strings that will be transformed into a literal string type during Psalm analysis. +Strings longer than this value (by default 1000 bytes) will be transformed in a generic `non-empty-string` type, instead. -Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs. +Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs. #### maxShapedArraySize ```xml @@ -455,10 +455,10 @@ Please note that changing this setting might introduce unwanted side effects and maxShapedArraySize="100" > ``` -This setting controls the maximum size of shaped arrays that will be transformed into a shaped `array{key1: "value", key2: T}` type during Psalm analysis. -Arrays bigger than this value (100 by default) will be transformed in a generic `non-empty-array` type, instead. +This setting controls the maximum size of shaped arrays that will be transformed into a shaped `array{key1: "value", key2: T}` type during Psalm analysis. +Arrays bigger than this value (100 by default) will be transformed in a generic `non-empty-array` type, instead. -Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs. +Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs. #### restrictReturnTypes @@ -474,20 +474,20 @@ the inferred return type. This code: ```php function getOne(): int // declared type: int -{ +{ return 1; // inferred type: 1 (int literal) } ``` Will give this error: `LessSpecificReturnType - The inferred return type '1' for -a is more specific than the declared return type 'int'` +getOne is more specific than the declared return type 'int'` To fix the error, you should specify the more specific type in the doc-block: ```php /** * @return 1 */ -function getOne(): int -{ +function getOne(): int +{ return 1; } ``` diff --git a/docs/running_psalm/issues/TaintedHeader.md b/docs/running_psalm/issues/TaintedHeader.md index f98e61977c1..767e8ba5e7c 100644 --- a/docs/running_psalm/issues/TaintedHeader.md +++ b/docs/running_psalm/issues/TaintedHeader.md @@ -1,6 +1,6 @@ # TaintedHeader -Potential header injection. This rule is emitted when user-controlled input can be passed into a HTTP header. +Potential header injection. This rule is emitted when user-controlled input can be passed into an HTTP header. ## Risk diff --git a/docs/running_psalm/issues/TaintedHtml.md b/docs/running_psalm/issues/TaintedHtml.md index ff8add010c3..8187338b9b7 100644 --- a/docs/running_psalm/issues/TaintedHtml.md +++ b/docs/running_psalm/issues/TaintedHtml.md @@ -4,7 +4,7 @@ Emitted when user-controlled input that can contain HTML can be passed into to a ## Risk -This could lead to a potential Cross Site Scripting (XSS) vulnerability. Using a XSS vulnerability, an attacker could inject malicious JavaScript and execute any action JavaScript could do. Examples include: +This could lead to a potential Cross Site Scripting (XSS) vulnerability. Using an XSS vulnerability, an attacker could inject malicious JavaScript and execute any action JavaScript could do. Examples include: - Stealing authentication material (e.g. cookies, JWT tokens) - Exfiltrate sensitive information by reading the DOM diff --git a/docs/running_psalm/issues/TaintedSSRF.md b/docs/running_psalm/issues/TaintedSSRF.md index 650655f65ca..a688a3d96af 100644 --- a/docs/running_psalm/issues/TaintedSSRF.md +++ b/docs/running_psalm/issues/TaintedSSRF.md @@ -4,9 +4,9 @@ Potential Server-Side Request Forgery vulnerability. This rule is emitted when u ## Risk -Passing untrusted user input to network requests could be dangerous. +Passing untrusted user input to network requests could be dangerous. -If an attacker can fully control a HTTP request they could connect to internal services. Depending on the nature of these, this can pose a security risk. (e.g. backend services, admin interfaces, AWS metadata, ...) +If an attacker can fully control an HTTP request they could connect to internal services. Depending on the nature of these, this can pose a security risk. (e.g. backend services, admin interfaces, AWS metadata, ...) ## Example diff --git a/docs/running_psalm/issues/TaintedSql.md b/docs/running_psalm/issues/TaintedSql.md index 6b6b1f2a449..c3c75f69794 100644 --- a/docs/running_psalm/issues/TaintedSql.md +++ b/docs/running_psalm/issues/TaintedSql.md @@ -1,6 +1,6 @@ # TaintedSql -Emitted when user-controlled input can be passed into to a SQL command. +Emitted when user-controlled input can be passed into to an SQL command. ```php diff --git a/src/Psalm/Context.php b/src/Psalm/Context.php index bf73229560a..972d9baba53 100644 --- a/src/Psalm/Context.php +++ b/src/Psalm/Context.php @@ -115,7 +115,7 @@ final class Context public $inside_unset = false; /** - * Whether or not we're inside an class_exists call, where + * Whether or not we're inside a class_exists call, where * we don't care about possibly undefined classes * * @var bool diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php index 8f35fee56b3..2ce4c97ad2f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php @@ -353,7 +353,7 @@ private static function analyzeNamedConstructor( if ($storage->abstract && !$can_extend) { if (IssueBuffer::accepts( new AbstractInstantiation( - 'Unable to instantiate a abstract class ' . $fq_class_name, + 'Unable to instantiate an abstract class ' . $fq_class_name, new CodeLocation($statements_analyzer->getSource(), $stmt), ), $statements_analyzer->getSuppressedIssues(), diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php index 9bc860de44d..22a8d40f996 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php @@ -1151,7 +1151,7 @@ private static function handleArrayAccessOnArray( $single_atomic = $key_values[0]; $from_mixed_array = $type->type_params[1]->isMixed(); - // ok, type becomes an TKeyedArray + // ok, type becomes a TKeyedArray $type = new TKeyedArray( [ $single_atomic->value => $from_mixed_array ? Type::getMixed() : Type::getNever(), diff --git a/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterUtils.php b/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterUtils.php index 5c32126de0e..48ce8c60d16 100644 --- a/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterUtils.php +++ b/src/Psalm/Internal/Provider/ReturnTypeProvider/FilterUtils.php @@ -234,8 +234,7 @@ public static function getOptionsArgValueOrError( // silently ignored by the function, but this usually indicates a bug IssueBuffer::maybeAdd( new InvalidArgument( - 'The "options" key in ' . $function_id - . ' must be a an array', + 'The "options" key in ' . $function_id . ' must be an array', $code_location, $function_id, ), diff --git a/src/Psalm/Type/Atomic.php b/src/Psalm/Type/Atomic.php index c6a247d769d..7add3b2675f 100644 --- a/src/Psalm/Type/Atomic.php +++ b/src/Psalm/Type/Atomic.php @@ -425,7 +425,7 @@ private static function createInner( /** * This is the string that will be used to represent the type in Union::$types. This means that two types sharing - * the same getKey value will override themselves in an Union + * the same getKey value will override themselves in a Union */ abstract public function getKey(bool $include_extra = true): string; diff --git a/src/Psalm/Type/UnionTrait.php b/src/Psalm/Type/UnionTrait.php index b471b795df3..7e397bf0923 100644 --- a/src/Psalm/Type/UnionTrait.php +++ b/src/Psalm/Type/UnionTrait.php @@ -61,7 +61,7 @@ trait UnionTrait { /** - * Constructs an Union instance + * Constructs a Union instance * * @psalm-external-mutation-free * @param non-empty-array $types @@ -1247,7 +1247,7 @@ public function hasLiteralInt(): bool /** * @psalm-mutation-free - * @return bool true if this is a int literal with only one possible value + * @return bool true if this is an int literal with only one possible value */ public function isSingleIntLiteral(): bool { diff --git a/stubs/CoreGenericClasses.phpstub b/stubs/CoreGenericClasses.phpstub index 93cb8cb42f0..74dbe1ddd2a 100644 --- a/stubs/CoreGenericClasses.phpstub +++ b/stubs/CoreGenericClasses.phpstub @@ -74,7 +74,7 @@ class Generator implements Traversable { interface ArrayAccess { /** - * Whether a offset exists + * Whether an offset exists * @link http://php.net/manual/en/arrayaccess.offsetexists.php * * @param TKey $offset An offset to check for.