troizet opened a new pull request, #6065:
URL: https://github.com/apache/netbeans/pull/6065

   What was done in this PR:
   - Changed the way `null` is parsed similar to true and false
   - Fixed displaying `null` value for constant in navigator and in autocomplete
   
   
   for example:
   
   ```php
   define('TEST_CONST', null);
   ```
   in navigator:
   before:
   
![const_value_null_nav_before](https://github.com/apache/netbeans/assets/9607501/7bc59cb4-73a8-44a8-9aeb-7b95ce17c06e)
   
   
   after:
   
![const_value_null_nav_after](https://github.com/apache/netbeans/assets/9607501/1b4f76bb-43e0-4657-b240-92c8446334be)
   
   
   in autocompletion and documentation:
   before:
   
![const_value_null_completion_before](https://github.com/apache/netbeans/assets/9607501/fa77ccdd-8ef6-458c-86f4-42bf83251f2d)
   
   
   after:
   
![const_value_null_completion_after](https://github.com/apache/netbeans/assets/9607501/14f4188c-4fcc-494b-bc92-ebbd092b3fbd)
   
   
   Similarly for class constants.
   
   - Fixed guessing the returned `null` type in documentation, in the navigator 
and during phpDoc comment generation
   
   for example:
   
   ```php
   function test()
   {
       if ($z) {
           return 'str';
       }
   
       return null;
   }
   
   test();
   ```
   
   in navigator:
   before:
   
![return_null_nav_before](https://github.com/apache/netbeans/assets/9607501/6457c98d-e7dc-4f79-93d5-542fdd679200)
   
   after:
   
![return_null_nav_after](https://github.com/apache/netbeans/assets/9607501/4060ff14-6e03-49a1-82eb-c4654d565c0c)
   
   in documentation:
   
   before:
   
![return_null_doc_before](https://github.com/apache/netbeans/assets/9607501/8739e5df-c496-4ec4-a4c7-a22b0f9f3632)
   
   after:
   
![return_null_doc_after](https://github.com/apache/netbeans/assets/9607501/5c38c12e-1a30-4493-820a-804af144242f)
   
   phpDoc generation:
   
   before:
   
![return_null_phpdoc_before](https://github.com/apache/netbeans/assets/9607501/da6b2d3f-5774-4c57-9c30-1592f46fe06c)
   
   after:
   
![return_null_phpdoc_after](https://github.com/apache/netbeans/assets/9607501/0e8ca1f7-db90-4531-bba0-b92bbfb515e3)
   
   - Fixed broken tests
   - Added parser test for `true`, `false`, `null`
   - Added documentation test to guess the returned `null` type
   - Added phpDoc generation test to guess the returned `null` type
   
   
   The reason for these changes is that the return type of a function that 
contains the `return null` is guessed correctly only if `null` is parsed as a 
scalar.
   In this case the conditions are satisfied:
   
https://github.com/apache/netbeans/blob/c649c8287923460591fa7e343c6d8ac46b7e872b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/ModelVisitor.java#L314-L316
   
https://github.com/apache/netbeans/blob/c649c8287923460591fa7e343c6d8ac46b7e872b/php/php.editor/src/org/netbeans/modules/php/editor/model/impl/VariousUtils.java#L432-L445
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to