Skip to content

Commit bfbd53c

Browse files
authored
Merge pull request #11154 from MoonE/fix-grammar-an-a
2 parents 0f796f1 + 97dfc24 commit bfbd53c

File tree

16 files changed

+28
-29
lines changed

16 files changed

+28
-29
lines changed

docs/annotating_code/type_syntax/top_bottom_types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ It can be aliased to `no-return` or `never-return` in docblocks. Note: it replac
1212
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:
1313

1414
- 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()
15-
- 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)
15+
- 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)
1616
- 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<never, never>`, the content of the array is void so it can accept any content
1717
- it can also happen in the same context as the line above for templates that have yet to be defined

docs/running_psalm/configuration.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -444,21 +444,21 @@ Allows you to hard-code the number of threads Psalm will use (similar to `--thre
444444
maxStringLength="1000"
445445
>
446446
```
447-
This setting controls the maximum length of literal strings that will be transformed into a literal string type during Psalm analysis.
448-
Strings longer than this value (by default 1000 bytes) will be transformed in a generic `non-empty-string` type, instead.
447+
This setting controls the maximum length of literal strings that will be transformed into a literal string type during Psalm analysis.
448+
Strings longer than this value (by default 1000 bytes) will be transformed in a generic `non-empty-string` type, instead.
449449

450-
Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs.
450+
Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs.
451451

452452
#### maxShapedArraySize
453453
```xml
454454
<psalm
455455
maxShapedArraySize="100"
456456
>
457457
```
458-
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.
459-
Arrays bigger than this value (100 by default) will be transformed in a generic `non-empty-array` type, instead.
458+
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.
459+
Arrays bigger than this value (100 by default) will be transformed in a generic `non-empty-array` type, instead.
460460

461-
Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs.
461+
Please note that changing this setting might introduce unwanted side effects and those side effects won't be considered as bugs.
462462

463463
#### restrictReturnTypes
464464

@@ -474,20 +474,20 @@ the inferred return type.
474474
This code:
475475
```php
476476
function getOne(): int // declared type: int
477-
{
477+
{
478478
return 1; // inferred type: 1 (int literal)
479479
}
480480
```
481481
Will give this error: `LessSpecificReturnType - The inferred return type '1' for
482-
a is more specific than the declared return type 'int'`
482+
getOne is more specific than the declared return type 'int'`
483483

484484
To fix the error, you should specify the more specific type in the doc-block:
485485
```php
486486
/**
487487
* @return 1
488488
*/
489-
function getOne(): int
490-
{
489+
function getOne(): int
490+
{
491491
return 1;
492492
}
493493
```

docs/running_psalm/issues/TaintedHeader.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TaintedHeader
22

3-
Potential header injection. This rule is emitted when user-controlled input can be passed into a HTTP header.
3+
Potential header injection. This rule is emitted when user-controlled input can be passed into an HTTP header.
44

55
## Risk
66

docs/running_psalm/issues/TaintedHtml.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Emitted when user-controlled input that can contain HTML can be passed into to a
44

55
## Risk
66

7-
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:
7+
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:
88

99
- Stealing authentication material (e.g. cookies, JWT tokens)
1010
- Exfiltrate sensitive information by reading the DOM

docs/running_psalm/issues/TaintedSSRF.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Potential Server-Side Request Forgery vulnerability. This rule is emitted when u
44

55
## Risk
66

7-
Passing untrusted user input to network requests could be dangerous.
7+
Passing untrusted user input to network requests could be dangerous.
88

9-
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, ...)
9+
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, ...)
1010

1111
## Example
1212

docs/running_psalm/issues/TaintedSql.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# TaintedSql
22

3-
Emitted when user-controlled input can be passed into to a SQL command.
3+
Emitted when user-controlled input can be passed into to an SQL command.
44

55
```php
66
<?php

docs/running_psalm/issues/TaintedTextWithQuotes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Emitted when user-controlled input that can contain quotation marks can be passe
44

55
## Risk
66

7-
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:
7+
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:
88

99
- Stealing authentication material (e.g. cookies, JWT tokens)
1010
- Exfiltrate sensitive information by reading the DOM

docs/running_psalm/plugins/authoring_plugins.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class SomePlugin implements \Psalm\Plugin\EventHandler\AfterStatementAnalysisInt
8080
- `AfterFunctionCallAnalysisInterface` - called after Psalm evaluates a function call to any function defined within the project itself. Can alter the return type or perform modifications of the call.
8181
- `AfterFunctionLikeAnalysisInterface` - called after Psalm has completed its analysis of a given function-like.
8282
- `AfterMethodCallAnalysisInterface` - called after Psalm analyzes a method call.
83-
- `BeforeStatementAnalysisInterface` - called before Psalm evaluates an statement.
84-
- `AfterStatementAnalysisInterface` - called after Psalm evaluates an statement.
83+
- `BeforeStatementAnalysisInterface` - called before Psalm evaluates a statement.
84+
- `AfterStatementAnalysisInterface` - called after Psalm evaluates a statement.
8585
- `BeforeAddIssueInterface` - called before Psalm adds an item to it's internal `IssueBuffer`, allows handling code issues individually
8686
- `BeforeFileAnalysisInterface` - called before Psalm analyzes a file.
8787
- `FunctionExistenceProviderInterface` - can be used to override Psalm's builtin function existence checks for one or more functions.

phpcs.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
</rule>
197197

198198
<!--
199-
Requires using a underscore separator for long numbers.
199+
Requires using an underscore separator for long numbers.
200200
https://github.com/slevomat/coding-standard/#slevomatcodingstandardnumbersrequirenumericliteralseparator
201201
-->
202202
<rule ref="SlevomatCodingStandard.Numbers.RequireNumericLiteralSeparator">

src/Psalm/Context.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ final class Context
115115
public $inside_unset = false;
116116

117117
/**
118-
* Whether or not we're inside an class_exists call, where
118+
* Whether or not we're inside a class_exists call, where
119119
* we don't care about possibly undefined classes
120120
*
121121
* @var bool

src/Psalm/Internal/Analyzer/Statements/Expression/Call/NewAnalyzer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ private static function analyzeNamedConstructor(
353353
if ($storage->abstract && !$can_extend) {
354354
if (IssueBuffer::accepts(
355355
new AbstractInstantiation(
356-
'Unable to instantiate a abstract class ' . $fq_class_name,
356+
'Unable to instantiate an abstract class ' . $fq_class_name,
357357
new CodeLocation($statements_analyzer->getSource(), $stmt),
358358
),
359359
$statements_analyzer->getSuppressedIssues(),

src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/ArrayFetchAnalyzer.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ private static function handleArrayAccessOnArray(
11511151
$single_atomic = $key_values[0];
11521152
$from_mixed_array = $type->type_params[1]->isMixed();
11531153

1154-
// ok, type becomes an TKeyedArray
1154+
// ok, type becomes a TKeyedArray
11551155
$type = new TKeyedArray(
11561156
[
11571157
$single_atomic->value => $from_mixed_array ? Type::getMixed() : Type::getNever(),

src/Psalm/Internal/Provider/ReturnTypeProvider/FilterUtils.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,7 @@ public static function getOptionsArgValueOrError(
234234
// silently ignored by the function, but this usually indicates a bug
235235
IssueBuffer::maybeAdd(
236236
new InvalidArgument(
237-
'The "options" key in ' . $function_id
238-
. ' must be a an array',
237+
'The "options" key in ' . $function_id . ' must be an array',
239238
$code_location,
240239
$function_id,
241240
),

src/Psalm/Type/Atomic.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ private static function createInner(
425425

426426
/**
427427
* This is the string that will be used to represent the type in Union::$types. This means that two types sharing
428-
* the same getKey value will override themselves in an Union
428+
* the same getKey value will override themselves in a Union
429429
*/
430430
abstract public function getKey(bool $include_extra = true): string;
431431

src/Psalm/Type/UnionTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
trait UnionTrait
6262
{
6363
/**
64-
* Constructs an Union instance
64+
* Constructs a Union instance
6565
*
6666
* @psalm-external-mutation-free
6767
* @param non-empty-array<Atomic> $types
@@ -1247,7 +1247,7 @@ public function hasLiteralInt(): bool
12471247

12481248
/**
12491249
* @psalm-mutation-free
1250-
* @return bool true if this is a int literal with only one possible value
1250+
* @return bool true if this is an int literal with only one possible value
12511251
*/
12521252
public function isSingleIntLiteral(): bool
12531253
{

stubs/CoreGenericClasses.phpstub

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Generator implements Traversable {
7474
interface ArrayAccess {
7575

7676
/**
77-
* Whether a offset exists
77+
* Whether an offset exists
7878
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
7979
*
8080
* @param TKey $offset An offset to check for.

0 commit comments

Comments
 (0)