Skip to content

Commit 9ce292c

Browse files
authored
[ci] add typos workflow + fix existing ones (#7671)
* [ci] add typos workflow * fix resettable typo * lenght typo * destruct typo * fix neeeded typo
1 parent 1d87f5a commit 9ce292c

File tree

18 files changed

+62
-33
lines changed

18 files changed

+62
-33
lines changed

.github/typos.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[default.extend-words]
2+
Symplify = "Symplify"
3+
4+
# plurals
5+
Identicals = "Identicals"

.github/workflows/typos.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# see https://github.com/crate-ci/typos
2+
name: "Typos"
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- "main"
9+
10+
jobs:
11+
typos:
12+
name: "Check for typos"
13+
runs-on: "ubuntu-latest"
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
19+
20+
- name: "Check for typos"
21+
uses: "crate-ci/typos@v1.40.0"
22+
with:
23+
config: .github/typos.toml
24+
files: "README.md src rules tests"

rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,17 @@ public function refactor(Node $node): ?Node
9999

100100
private function hasObjectType(Type $type): bool
101101
{
102-
$hasObjecType = false;
103-
TypeTraverser::map($type, function (Type $type, callable $traverseCallback) use (&$hasObjecType): Type {
102+
$hasObjectType = false;
103+
TypeTraverser::map($type, function (Type $type, callable $traverseCallback) use (&$hasObjectType): Type {
104104
// maybe has object type? mark as object type
105105
if (! $type->isObject()->no()) {
106-
$hasObjecType = true;
106+
$hasObjectType = true;
107107
}
108108

109109
return $traverseCallback($type);
110110
});
111111

112-
return $hasObjecType;
112+
return $hasObjectType;
113113
}
114114

115115
private function normalizeScalarType(Type $type): Type

rules/CodeQuality/Rector/LogicalAnd/AndAssignsToSeparateLinesRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ final class AndAssignsToSeparateLinesRector extends AbstractRector
1919
{
2020
public function getRuleDefinition(): RuleDefinition
2121
{
22-
return new RuleDefinition('Split 2 assigns with ands to separate line', [
22+
return new RuleDefinition('Split 2 assigns with "and" to separate lines', [
2323
new CodeSample(
2424
<<<'CODE_SAMPLE'
2525
class SomeClass

rules/CodingStyle/ValueObject/ObjectMagicMethods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class ObjectMagicMethods
1717
MethodName::CLONE,
1818
MethodName::CONSTRUCT,
1919
'__debugInfo',
20-
MethodName::DESCTRUCT,
20+
MethodName::DESTRUCT,
2121
'__get',
2222
MethodName::INVOKE,
2323
'__isset',

rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* Taking the most generic use case to the account: https://wiki.php.net/rfc/numeric_literal_separator#should_it_be_the_role_of_an_ide_to_group_digits
2121
* The final check should be done manually
2222
*
23-
* @deprecated as opinionated and group size depends on context. Cannot be automated. Use manually where neeeded instead.
23+
* @deprecated as opinionated and group size depends on context. Cannot be automated. Use manually where needed instead.
2424
*/
2525
final class AddLiteralSeparatorToNumberRector extends AbstractRector implements MinPhpVersionInterface, ConfigurableRectorInterface, DeprecatedInterface
2626
{

rules/Privatization/TypeManipulator/TypeNormalizer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* @var int
3333
*/
34-
private const MAX_PRINTED_UNION_DOC_LENGHT = 77;
34+
private const MAX_PRINTED_UNION_DOC_LENGTH = 77;
3535

3636
public function __construct(
3737
private TypeFactory $typeFactory,
@@ -146,7 +146,7 @@ public function generalizeConstantTypes(Type $type): Type
146146
// too long
147147
if (strlen(
148148
(string) $unionedDocType
149-
) > self::MAX_PRINTED_UNION_DOC_LENGHT && $this->avoidPrintedDocblockTrimming(
149+
) > self::MAX_PRINTED_UNION_DOC_LENGTH && $this->avoidPrintedDocblockTrimming(
150150
$generalizedUnionType
151151
) === false) {
152152
$alwaysKnownArrayType = $this->narrowToAlwaysKnownArrayType($generalizedUnionType);

rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function refactor(Node $node): ?Node
9393
$hasChanged = false;
9494

9595
foreach ($node->getMethods() as $classMethod) {
96-
if ($this->isNames($classMethod, [MethodName::CONSTRUCT, MethodName::DESCTRUCT])) {
96+
if ($this->isNames($classMethod, [MethodName::CONSTRUCT, MethodName::DESTRUCT])) {
9797
continue;
9898
}
9999

src/Config/RectorConfig.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Rector\Configuration\Parameter\SimpleParameterProvider;
1111
use Rector\Configuration\RectorConfigBuilder;
1212
use Rector\Contract\DependencyInjection\RelatedConfigInterface;
13-
use Rector\Contract\DependencyInjection\ResetableInterface;
13+
use Rector\Contract\DependencyInjection\ResettableInterface;
1414
use Rector\Contract\Rector\ConfigurableRectorInterface;
1515
use Rector\Contract\Rector\RectorInterface;
1616
use Rector\DependencyInjection\Laravel\ContainerMemento;
@@ -38,7 +38,7 @@ final class RectorConfig extends Container
3838
/**
3939
* @var string[]
4040
*/
41-
private array $autotagInterfaces = [Command::class, ResetableInterface::class];
41+
private array $autotagInterfaces = [Command::class, ResettableInterface::class];
4242

4343
private static ?bool $recreated = null;
4444

src/Configuration/RenamedClassesDataCollector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace Rector\Configuration;
66

77
use PHPStan\Type\ObjectType;
8-
use Rector\Contract\DependencyInjection\ResetableInterface;
8+
use Rector\Contract\DependencyInjection\ResettableInterface;
99

10-
final class RenamedClassesDataCollector implements ResetableInterface
10+
final class RenamedClassesDataCollector implements ResettableInterface
1111
{
1212
/**
1313
* @var array<string, string>

0 commit comments

Comments
 (0)