Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Meta] Add PHP 7.3 integration test #4184

Closed
wants to merge 4 commits into from

Conversation

keradus
Copy link
Member

@keradus keradus commented Dec 31, 2018

We have PR's for all issues! :)

Please help with reviewing and testing

ref #3697
This PR shows how far we are to be compatible with 7.3.

I went over all our built-in fixers to create integration test of what shall work under 7.3.

I am not currently working on fixing all of them, we shall fix them one by one, same like @SpacePossum already started. If you are willing to help, write you are started working on given Fixer, so we won't end up with multiple ppl fixing same issue

Fixers that deserves extra work & utests:

- [ ] no_unset_cast on 2.14 #4213

Probably, we shall investigate how to do it smartly, rathen than manually patch every single Fixer.
Maybe we shall come back to manipulator concept, like FunctionCallManipulator to add/remove param, and keep logic about trailing comma in that one place, not in 10 Fixers


to be added on 2.14: done #4213

// https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes
// @TODO: on 2.14, enable rule: `heredoc_indentation` and change expected code for it
$a = <<<'EOD'
    abc
    def
    ghi
    EOD;

@keradus keradus added the WIP label Dec 31, 2018
@keradus
Copy link
Member Author

keradus commented Dec 31, 2018

When running the new integration test:
Errors reported during linting after fixing file "misc/PHP7_3.test": 3: /home/d.ruminski/github/PHP-CS-Fixer/tests/Fixtures/Integration/.tmp.php PHP Parse error: syntax error, unexpected ',' on line 25.

with some black magic:
SKIP_LINT_TEST_CASES=1 vendor/bin/phpunit tests/IntegrationTest.php --filter PHP7_3

--- Expected
+++ Actual
@@ @@
     $arg2,
 );
 __DIR__; // `dir_constant` rule
-dirname($path, 3); // `combine_nested_dirname` rule
-implode('', $pieces, ); // `implode_call` rule
-implode('', $pieces, ); // `implode_call` rule
-null === $var; // `is_null` rule
-$foo->__invoke(1, ); // `magic_method_casing` rule
+dirname(dirname(dirname($path, ), ), ); // `combine_nested_dirname` rule
+implode($pieces, '', ); // `implode_call` rule
+implode($pieces, ); // `implode_call` rule
+null === $var,; // `is_null` rule
+$foo->__INVOKE(1, ); // `magic_method_casing` rule
 mb_strpos($a, $b, ); // `mb_str_functions` rule
 sample('foo', 'foobarbaz', 'baz', ); // `method_argument_space` rule
 $user->setEmail('voff.web@gmail.com', ) // `method_chaining_indentation` rule
-     ->setPassword('233434', );
-$a = (int) $b; // `modernize_types_casting` rule
+               ->setPassword('233434', );
+$a = (int) ($b, ); // `modernize_types_casting` rule
 $this->method1() // `multiline_whitespace_before_semicolons` rule
-     ->method2(3, )
-;
-strlen($str, ); // `native_function_casing` rule
-$c = \get_class($d, ); // `native_function_invocation` rule
+     ->method2(3, );
+mb_strlen($str, ); // `native_function_casing` rule
+$c = get_class($d, ); // `native_function_invocation` rule
 $a = rtrim($b, ); // `no_alias_functions` rule
 $foo->bar($arg1, $arg2, ); // `no_spaces_inside_parenthesis` rule
 $this->assertTrue($a, ); // `php_unit_construct` rule
-$this->assertNan($a, ); // `php_unit_dedicate_assert` rule
+$this->assertTrue(is_nan($a, ), ); // `php_unit_dedicate_assert` rule
 final class MyTest extends \PHPUnit_Framework_TestCase
 {
     public function testFoo(): void
     {
-        $this->expectException("RuntimeException");
-        $this->expectExceptionMessage("Msg");
-        $this->expectExceptionCode(123); // `php_unit_expectation` rule
-        $this->createMock("Foo", ); // `php_unit_mock` rule
-        $this->assertSame(a(), b(), ); // `php_unit_strict` rule
+        $this->setExpectedException('RuntimeException', 'Msg', 123); // `php_unit_expectation` rule
+        $this->getMock('Foo', ); // `php_unit_mock` rule
+        $this->assertEquals(a(), b(), ); // `php_unit_strict` rule
         $this->assertSame(1, 2, ); // `php_unit_test_case_static_method_calls` rule
     }
 }
-$a** 1; // `pow_to_exponentiation` rule
-mt_rand($a, $b, ); // `random_api_migration` rule
-(int) $foo; // `set_type_to_cast` rule
-@trigger_error('Warning.', E_USER_DEPRECATED, ); // `silenced_deprecation_error` rule
-in_array($b, $c, true, ); // `strict_param` rule
+$a ** 1; // `pow_to_exponentiation` rule
+random_int($a, $b, ); // `random_api_migration` rule
+$foo = (int) $foo, ; // `set_type_to_cast` rule
+trigger_error('Warning.', E_USER_DEPRECATED, ); // `silenced_deprecation_error` rule
+in_array($b, $c, ); // `strict_param` rule
 foo(null === $a, ); // `yoda_style` rule
 
 // https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes

@keradus keradus mentioned this pull request Dec 31, 2018
7 tasks
@keradus keradus added the status/help wanted Author requests help label Dec 31, 2018
@keradus keradus changed the title [META] Add PHP 7.3 integration test [Meta] Add PHP 7.3 integration test Dec 31, 2018
@keradus keradus force-pushed the 2.12_7.3 branch 2 times, most recently from 5fd465c to ce0fb47 Compare December 31, 2018 16:50
@SpacePossum
Copy link
Contributor

I think no_unset_cast and no_unset_on_property both don't have any PHP7.3 issues?

@keradus
Copy link
Member Author

keradus commented Jan 2, 2019

no_unset_cast - true that
no_unset_on_property - eg unset($this->a, );, we shall at lest add test for that

# Conflicts:
#	tests/Fixtures/Integration/misc/PHP7_3.test
# Conflicts:
#	tests/Fixtures/Integration/misc/PHP7_3.test
keradus added a commit that referenced this pull request Jan 4, 2019
This PR was merged into the 2.14-dev branch.

Discussion
----------

Add official support for PHP 7.3

Closes #3697
Closes #4184

Commits
-------

e79a640 Add official support for PHP 7.3
@keradus keradus closed this Jan 4, 2019
@keradus keradus deleted the 2.12_7.3 branch January 4, 2019 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/help wanted Author requests help
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants