Skip to content

Commit 20b9b42

Browse files
committed
Apply fixed Coderabbitai review.
1 parent d80918b commit 20b9b42

File tree

6 files changed

+117
-116
lines changed

6 files changed

+117
-116
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ permissions:
1717

1818
jobs:
1919
phpunit:
20-
uses: yii2-framework/actions/.github/workflows/phpunit.yml@main
20+
uses: yii2-framework/actions/.github/workflows/phpunit.yml@v1
2121
secrets:
2222
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/dependency-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ permissions:
1818

1919
jobs:
2020
composer-require-checker:
21-
uses: yii2-framework/actions/.github/workflows/composer-require-checker.yml@main
21+
uses: yii2-framework/actions/.github/workflows/composer-require-checker.yml@v1

.github/workflows/ecs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ permissions:
1818

1919
jobs:
2020
easy-coding-standard:
21-
uses: yii2-framework/actions/.github/workflows/ecs.yml@main
21+
uses: yii2-framework/actions/.github/workflows/ecs.yml@v1

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ permissions:
1818

1919
jobs:
2020
phpstan:
21-
uses: yii2-framework/actions/.github/workflows/phpstan.yml@main
21+
uses: yii2-framework/actions/.github/workflows/phpstan.yml@v1

.styleci.yml

Lines changed: 80 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,87 @@
11
preset: psr12
22
risky: true
33

4-
version: 8
4+
version: 8.1
55

66
finder:
7-
exclude:
8-
- docs
9-
- public
10-
- vendor
11-
- docker
12-
- vargant
7+
exclude:
8+
- docs
9+
- vendor
1310

1411
enabled:
15-
- alpha_ordered_traits
16-
- array_indentation
17-
- array_push
18-
- combine_consecutive_issets
19-
- combine_consecutive_unsets
20-
- combine_nested_dirname
21-
- declare_strict_types
22-
- dir_constant
23-
- fully_qualified_strict_types
24-
- function_to_constant
25-
- hash_to_slash_comment
26-
- is_null
27-
- logical_operators
28-
- magic_constant_casing
29-
- magic_method_casing
30-
- method_separation
31-
- modernize_types_casting
32-
- native_function_casing
33-
- native_function_type_declaration_casing
34-
- no_alias_functions
35-
- no_empty_comment
36-
- no_empty_phpdoc
37-
- no_empty_statement
38-
- no_extra_block_blank_lines
39-
- no_short_bool_cast
40-
- no_superfluous_elseif
41-
- no_unneeded_control_parentheses
42-
- no_unneeded_curly_braces
43-
- no_unneeded_final_method
44-
- no_unset_cast
45-
- no_unused_imports
46-
- no_unused_lambda_imports
47-
- no_useless_else
48-
- no_useless_return
49-
- normalize_index_brace
50-
- php_unit_dedicate_assert
51-
- php_unit_dedicate_assert_internal_type
52-
- php_unit_expectation
53-
- php_unit_mock
54-
- php_unit_mock_short_will_return
55-
- php_unit_namespaced
56-
- php_unit_no_expectation_annotation
57-
- phpdoc_no_empty_return
58-
- phpdoc_no_useless_inheritdoc
59-
- phpdoc_order
60-
- phpdoc_property
61-
- phpdoc_scalar
62-
- phpdoc_separation
63-
- phpdoc_singular_inheritdoc
64-
- phpdoc_trim
65-
- phpdoc_trim_consecutive_blank_line_separation
66-
- phpdoc_type_to_var
67-
- phpdoc_types
68-
- phpdoc_types_order
69-
- print_to_echo
70-
- regular_callable_call
71-
- return_assignment
72-
- self_accessor
73-
- self_static_accessor
74-
- set_type_to_cast
75-
- short_array_syntax
76-
- short_list_syntax
77-
- simplified_if_return
78-
- single_quote
79-
- standardize_not_equals
80-
- ternary_to_null_coalescing
81-
- trailing_comma_in_multiline_array
82-
- unalign_double_arrow
83-
- unalign_equals
84-
- empty_loop_body_braces
85-
- integer_literal_case
86-
- union_type_without_spaces
12+
- alpha_ordered_traits
13+
- array_indentation
14+
- array_push
15+
- combine_consecutive_issets
16+
- combine_consecutive_unsets
17+
- combine_nested_dirname
18+
- declare_strict_types
19+
- dir_constant
20+
- empty_loop_body_braces
21+
- function_to_constant
22+
- hash_to_slash_comment
23+
- integer_literal_case
24+
- is_null
25+
- logical_operators
26+
- magic_constant_casing
27+
- magic_method_casing
28+
- method_separation
29+
- modernize_types_casting
30+
- native_function_casing
31+
- native_function_type_declaration_casing
32+
- no_alias_functions
33+
- no_empty_comment
34+
- no_empty_phpdoc
35+
- no_empty_statement
36+
- no_extra_block_blank_lines
37+
- no_short_bool_cast
38+
- no_superfluous_elseif
39+
- no_unneeded_control_parentheses
40+
- no_unneeded_curly_braces
41+
- no_unneeded_final_method
42+
- no_unset_cast
43+
- no_unused_imports
44+
- no_unused_lambda_imports
45+
- no_useless_else
46+
- no_useless_return
47+
- normalize_index_brace
48+
- php_unit_dedicate_assert
49+
- php_unit_dedicate_assert_internal_type
50+
- php_unit_expectation
51+
- php_unit_mock
52+
- php_unit_mock_short_will_return
53+
- php_unit_namespaced
54+
- php_unit_no_expectation_annotation
55+
- phpdoc_no_empty_return
56+
- phpdoc_no_useless_inheritdoc
57+
- phpdoc_order
58+
- phpdoc_property
59+
- phpdoc_scalar
60+
- phpdoc_singular_inheritdoc
61+
- phpdoc_trim
62+
- phpdoc_trim_consecutive_blank_line_separation
63+
- phpdoc_type_to_var
64+
- phpdoc_types
65+
- phpdoc_types_order
66+
- print_to_echo
67+
- regular_callable_call
68+
- return_assignment
69+
- self_accessor
70+
- self_static_accessor
71+
- set_type_to_cast
72+
- short_array_syntax
73+
- short_list_syntax
74+
- simplified_if_return
75+
- single_quote
76+
- standardize_not_equals
77+
- ternary_to_null_coalescing
78+
- trailing_comma_in_multiline_array
79+
- unalign_double_arrow
80+
- unalign_equals
81+
- union_type_without_spaces
82+
83+
disabled:
84+
- function_declaration
85+
- new_with_parentheses
86+
- psr12_braces
87+
- psr12_class_definition

tests/TestSupportTest.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -70,39 +70,39 @@ public function testNormalizeLineEndingsWhenStringsAreIdenticalWithLineEndings()
7070

7171
public function testRemoveFilesFromDirectoryRemovesAllFiles(): void
7272
{
73-
$dir = __DIR__ . '/Support/runtime';
74-
75-
if (is_dir($dir)) {
76-
unlink("{$dir}/.gitignore");
77-
unlink("{$dir}/.gitkeep");
78-
rmdir($dir);
73+
$dir = sys_get_temp_dir() . '/php-forge-support-' . bin2hex(random_bytes(8));
74+
mkdir($dir);
75+
76+
try {
77+
mkdir("{$dir}/subdir");
78+
touch("{$dir}/test.txt");
79+
touch("{$dir}/subdir/test.txt");
80+
touch("{$dir}/.gitignore");
81+
touch("{$dir}/.gitkeep");
82+
83+
self::removeFilesFromDirectory($dir);
84+
85+
self::assertFileDoesNotExist(
86+
"{$dir}/test.txt",
87+
"File 'test.txt' should not exist after 'removeFilesFromDirectory' method is called.",
88+
);
89+
self::assertFileDoesNotExist(
90+
"{$dir}/subdir/test.txt",
91+
"File 'subdir/test.txt' should not exist after 'removeFilesFromDirectory' method is called.",
92+
);
93+
self::assertFileExists(
94+
"{$dir}/.gitignore",
95+
"File '.gitignore' should remain after 'removeFilesFromDirectory' method is called.",
96+
);
97+
self::assertFileExists(
98+
"{$dir}/.gitkeep",
99+
"File '.gitkeep' should remain after 'removeFilesFromDirectory' method is called.",
100+
);
101+
} finally {
102+
@unlink("{$dir}/.gitignore");
103+
@unlink("{$dir}/.gitkeep");
104+
@rmdir($dir);
79105
}
80-
81-
mkdir($dir, 0777, true);
82-
mkdir("{$dir}/subdir");
83-
touch("{$dir}/test.txt");
84-
touch("{$dir}/subdir/test.txt");
85-
touch("{$dir}/.gitignore");
86-
touch("{$dir}/.gitkeep");
87-
88-
self::removeFilesFromDirectory($dir);
89-
90-
self::assertFileDoesNotExist(
91-
"{$dir}/test.txt",
92-
"File 'test.txt' should not exist after 'removeFilesFromDirectory' method is called.",
93-
);
94-
self::assertFileDoesNotExist(
95-
"{$dir}/subdir/test.txt",
96-
"File 'subdir/test.txt' should not exist after 'removeFilesFromDirectory' method is called.",
97-
);
98-
self::assertFileExists(
99-
"{$dir}/.gitignore",
100-
"File '.gitignore' should remain after 'removeFilesFromDirectory' method is called.",
101-
);
102-
self::assertFileExists(
103-
"{$dir}/.gitkeep",
104-
"File '.gitkeep' should remain after 'removeFilesFromDirectory' method is called.",
105-
);
106106
}
107107

108108
/**
@@ -159,7 +159,7 @@ public function testSetInaccessibleParentProperty(): void
159159
self::assertSame(
160160
'foo',
161161
self::inaccessibleParentProperty($object, TestBaseClass::class, 'propertyParent'),
162-
"Should return 'foo' after setting the parent property 'propertyParent' via "
162+
"Should return 'value' when invoking the inaccessible method 'inaccessibleMethod' on 'TestClass' "
163163
. "'setInaccessibleParentProperty' method.",
164164
);
165165
}

0 commit comments

Comments
 (0)