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
Fix detecting magic static methods #10704
Fix detecting magic static methods #10704
Commits on Feb 13, 2024
-
Failed and regression tests for magic static methods
List failed tests: ``` 1) Psalm\Tests\MagicMethodAnnotationTest::testNoSealAllMethodsWithStatic Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. 2) Psalm\Tests\MagicMethodAnnotationTest::testSealAllMethodsWithoutFooWithStatic Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. 3) Psalm\Tests\MagicMethodAnnotationTest::testInvalidCode with data set "inheritSealedMethodsWithStatic" Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. ```
Configuration menu - View commit details
-
Copy full SHA for 6e361aa - Browse repository at this point
Copy the full SHA 6e361aaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 29b4c38 - Browse repository at this point
Copy the full SHA 29b4c38View commit details -
Configuration menu - View commit details
-
Copy full SHA for 083b8e2 - Browse repository at this point
Copy the full SHA 083b8e2View commit details -
Extract checking method "__callStatic" from block "if"
Appended problem by that commit: ``` 1) FileReferenceTest::testReferencedMethods with data set "getClassReferences" Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ 'foo\b::__construct' => true 'foo\c::foo' => true ) - 'foo\c::__construct' => Array &2 ( + 'foo\a::__callstatic' => Array &2 ( + 'foo\b::__construct' => true + ) + 'foo\c::__construct' => Array &3 ( 'foo\b::bar' => true ) ) ```
Configuration menu - View commit details
-
Copy full SHA for 2567a99 - Browse repository at this point
Copy the full SHA 2567a99View commit details -
Resolved problem: ``` FileReferenceTest::testReferencedMethods with data set "getClassReferences" Failed asserting that two arrays are identical. --- Expected +++ Actual @@ @@ 'foo\b::__construct' => true 'foo\c::foo' => true ) - 'foo\c::__construct' => Array &2 ( + 'foo\a::__callstatic' => Array &2 ( + 'foo\b::__construct' => true + ) + 'foo\c::__construct' => Array &3 ( 'foo\b::bar' => true ) ) ```
Configuration menu - View commit details
-
Copy full SHA for df2067d - Browse repository at this point
Copy the full SHA df2067dView commit details -
Delete code of replacing variable method_id
The main task for deleting: ``` $method_id = new MethodIdentifier( $fq_class_name, '__callstatic', ); ``` List of resolved problems: ``` 1) Psalm\Tests\MagicMethodAnnotationTest::testNoSealAllMethodsWithStatic Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. 2) Psalm\Tests\MagicMethodAnnotationTest::testSealAllMethodsWithoutFooWithStatic Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. 3) Psalm\Tests\MagicMethodAnnotationTest::testInvalidCode with data set "inheritSealedMethodsWithStatic" Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. ``` Appended problem by that fix: ``` 1) MagicMethodAnnotationTest::testSealAllMethodsSetToFalseWithStatic Psalm\Exception\CodeException: UndefinedMagicMethod - somefile.php:8:15 - Magic method B::foo does not exist ```
Configuration menu - View commit details
-
Copy full SHA for 0ba346c - Browse repository at this point
Copy the full SHA 0ba346cView commit details -
Resolved problem: ``` 1) MagicMethodAnnotationTest::testSealAllMethodsSetToFalseWithStatic Psalm\Exception\CodeException: UndefinedMagicMethod - somefile.php:8:15 - Magic method B::foo does not exist ```
Configuration menu - View commit details
-
Copy full SHA for 5f89fa1 - Browse repository at this point
Copy the full SHA 5f89fa1View commit details -
Failed and regression tests with usage config
Failed test: ``` 1) MagicMethodAnnotationTest::testAnnotationWithoutCallConfigWithExtendsWithStatic Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. ```
Configuration menu - View commit details
-
Copy full SHA for 4fce070 - Browse repository at this point
Copy the full SHA 4fce070View commit details -
Resolve testAnnotationWithoutCallConfigWithExtendsWithStatic
Resolved error: ``` MagicMethodAnnotationTest::testAnnotationWithoutCallConfigWithExtendsWithStatic Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. ``` Appended problem: ``` MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic" Psalm\Exception\CodeException: UndefinedMethod - src/somefile.php:9:32 - Method B::bar does not exist ```
Configuration menu - View commit details
-
Copy full SHA for 14316f5 - Browse repository at this point
Copy the full SHA 14316f5View commit details -
This test has been failed with an error "UndefinedMethod". This error is being issued correctly. But so that this error would not interfere with the test, it was suppressed. Fixed problem: ``` MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic" Psalm\Exception\CodeException: UndefinedMethod - src/somefile.php:9:32 - Method B::bar does not exist ```
Configuration menu - View commit details
-
Copy full SHA for 6009631 - Browse repository at this point
Copy the full SHA 6009631View commit details -
Failed tests for StaticInvocation and NonStaticSelfCall
Failed tests: ``` 1) MagicMethodAnnotationTest::testInvalidCode with data set "staticInvocationWithInstanceMethodFoo" Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. 2) MagicMethodAnnotationTest::testInvalidCode with data set "nonStaticSelfCallWithInstanceMethodFoo" Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. ```
Configuration menu - View commit details
-
Copy full SHA for 6f17469 - Browse repository at this point
Copy the full SHA 6f17469View commit details -
Resolve tests for StaticInvocation and NonStaticSelfCall
The code has been moved from down to up. Resolved problems: ``` 1) MagicMethodAnnotationTest::testInvalidCode with data set "staticInvocationWithInstanceMethodFoo" Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. 2) MagicMethodAnnotationTest::testInvalidCode with data set "nonStaticSelfCallWithInstanceMethodFoo" Failed asserting that exception of type "Psalm\Exception\CodeException" is thrown. ```
Configuration menu - View commit details
-
Copy full SHA for 4c645e1 - Browse repository at this point
Copy the full SHA 4c645e1View commit details -
Support for testing with the creation of a list of issues
Description of motivation. We currently have two different behaviors for the code related to "CodeException": ``` $codebase->config->throw_exception = true; // or false ``` If "throw_exception" is set to `true`, code execution stops. If "throw_exception" is set to `false`, the code may continue to execute, and an error may potentially occur. This commit allows testing for the second case, when the value of "throw_exception" will be "false".
Configuration menu - View commit details
-
Copy full SHA for d588b3d - Browse repository at this point
Copy the full SHA d588b3dView commit details -
Failed and regression tests with creation of a list of issues
Failed tests: ``` 1) Psalm\Tests\MagicMethodAnnotationTest::testInvalidCodeWithIssues with data set "staticInvocationWithMagicMethodFoo" UnexpectedValueException: Cannot get method params for A::foo 2) Psalm\Tests\MagicMethodAnnotationTest::testInvalidCodeWithIssues with data set "nonStaticSelfCallWithMagicMethodFoo" UnexpectedValueException: Cannot get method params for B::foo ```
Configuration menu - View commit details
-
Copy full SHA for 9b6ef8b - Browse repository at this point
Copy the full SHA 9b6ef8bView commit details -
Resolve tests with creation of a list of issues
Resolved problems: ``` 1) Psalm\Tests\MagicMethodAnnotationTest::testInvalidCodeWithIssues with data set "staticInvocationWithMagicMethodFoo" UnexpectedValueException: Cannot get method params for A::foo 2) Psalm\Tests\MagicMethodAnnotationTest::testInvalidCodeWithIssues with data set "nonStaticSelfCallWithMagicMethodFoo" UnexpectedValueException: Cannot get method params for B::foo ```
Configuration menu - View commit details
-
Copy full SHA for e940de5 - Browse repository at this point
Copy the full SHA e940de5View commit details
Commits on Feb 14, 2024
-
Fix message in TestCase::assertHasIssueType
Apply suggestions from code review. Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for db92991 - Browse repository at this point
Copy the full SHA db92991View commit details -
Configuration menu - View commit details
-
Copy full SHA for cfd0fd1 - Browse repository at this point
Copy the full SHA cfd0fd1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 08a479a - Browse repository at this point
Copy the full SHA 08a479aView commit details -
Configuration menu - View commit details
-
Copy full SHA for b7a2080 - Browse repository at this point
Copy the full SHA b7a2080View commit details -
Fix description InvalidCodeAnalysisWithIssuesTestTrait
Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 3724062 - Browse repository at this point
Copy the full SHA 3724062View commit details -
Failed and regression tests with suppression "UndefinedMethod"
Apply suggestions from code review. Failed tests: ``` 1) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic" Psalm\Exception\CodeException: UnusedPsalmSuppress - src/somefile.php:9:58 - This suppression is never used 2) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic_WithReturnAndManyArgs" Psalm\Exception\CodeException: TooManyArguments - src/somefile.php:9:6 - Too many arguments for B::bar - expecting 0 but saw 2 ``` Co-authored-by: Bruce Weirdan <weirdan@gmail.com>
Configuration menu - View commit details
-
Copy full SHA for 5a66742 - Browse repository at this point
Copy the full SHA 5a66742View commit details -
Resolve tests with suppression "UndefinedMethod"
Apply suggestions from code review. Resolved problems: ``` 1) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic" Psalm\Exception\CodeException: UnusedPsalmSuppress - src/somefile.php:9:58 - This suppression is never used 2) MagicMethodAnnotationTest::testValidCode with data set "magicStaticMethodInheritanceWithoutCallStatic_WithReturnAndManyArgs" Psalm\Exception\CodeException: TooManyArguments - src/somefile.php:9:6 - Too many arguments for B::bar - expecting 0 but saw 2 ```
Configuration menu - View commit details
-
Copy full SHA for 8a70bc2 - Browse repository at this point
Copy the full SHA 8a70bc2View commit details