Skip to content

Commit

Permalink
fix type issue
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Dec 12, 2022
1 parent 2035fc4 commit ce28328
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 3 deletions.
105 changes: 105 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<?php

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude([
'src/Core/Bridge/Symfony/Maker/Resources/skeleton',
'tests/Fixtures/app/var',
'tests/Fixtures/Symfony/Maker',
])
->notPath('src/Symfony/Bundle/DependencyInjection/Configuration.php')
->notPath('src/Annotation/ApiFilter.php') // temporary
->notPath('src/Annotation/ApiProperty.php') // temporary
->notPath('src/Annotation/ApiResource.php') // temporary
->notPath('src/Annotation/ApiSubresource.php') // temporary
->notPath('tests/Fixtures/TestBundle/Entity/DummyPhp8.php') // temporary
->append([
'tests/Fixtures/app/console',
]);

return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'@PHPUnit60Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'align_multiline_comment' => [
'comment_type' => 'phpdocs_like',
],
'array_indentation' => true,
'compact_nullable_typehint' => true,
'doctrine_annotation_array_assignment' => [
'operator' => '=',
],
'doctrine_annotation_spaces' => [
'after_array_assignments_equals' => false,
'before_array_assignments_equals' => false,
],
'explicit_indirect_variable' => true,
'fully_qualified_strict_types' => true,
'logical_operators' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_alternative_syntax' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
'continue',
'curly_brace_block',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'throw',
'use',
],
],
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => false,
],
'no_unset_cast' => true,
'no_unset_on_property' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => [
'imports_order' => [
'class',
'function',
'const',
],
'sort_algorithm' => 'alpha',
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_annotation' => [
'style' => 'prefix',
],
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => true,
],
'phpdoc_no_alias_tag' => true,
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_var_annotation_correct_order' => true,
'return_assignment' => true,
'strict_param' => true,
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
])
->setFinder($finder);

4 changes: 2 additions & 2 deletions src/Context/JsonContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,8 @@ private function checkSchemaFile($filename): void
}
}

public static function reespaceSpecialGherkinValue(string $value): string
public static function reespaceSpecialGherkinValue(mixed $value): string
{
return str_replace('\\n', "\n", $value);
return str_replace('\\n', "\n", (string) $value);
}
}
2 changes: 1 addition & 1 deletion src/Context/RestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function iSendARequestToWithBody($method, $url, PyStringNode $body)
*/
public function theResponseShouldBeEqualTo(PyStringNode $expected): void
{
$expected = str_replace('\\"', '"', $expected);
$expected = str_replace('\\"', '"', (string) $expected);
$actual = $this->request->getContent();
$message = "Actual response is '$actual', but expected '$expected'";
$this->assertEquals($expected, $actual, $message);
Expand Down

0 comments on commit ce28328

Please sign in to comment.