hoaproject/Consistency

`void` is a new reserved keyword

Closed this issue · 10 comments

Hywan commented

Hello,

Apparently, void is a new reserved keyword (see atoum/atoum#598 (comment) and https://github.com/php/php-src/blob/php-7.1.0alpha2/UPGRADING). The Hoa\Consistency\Consistency::isKeyword method must be updated accordingly and we should probably update some Hoa's code.

@vonglasow, can you handle that?

@Hywan yep, I will see that.

First of all, we need to identify the word which will replace void, here a list of available synonym, fell free to complete it:

  • nil
  • bare
  • emptied
  • vacuous
  • blank
  • vacuum
  • hole
  • cavity
  • chasm
  • abyss
  • oblivion
  • nihility
  • nothing
Hywan commented

👍 for nil.

👍 for nil too and it's shortest than void

List of void not in documentations or to discuss to change:

  • Hoa/Core/Core.php:146: static::_define('void', (unset) null);
  • Hoa/Test/Report/Cli/Cli.php:204: $runnerVoidField = new Fields\Void();
  • Hoa/Test/Report/Cli/Fields/Void.php:41:class Void extends fields\runner\tests\void\cli
  • Hoa/Consistency/Prelude.php:73:$define('void', (unset) null);

Part to discuss

  • Hoa/Praspel/Grammar.pp:102:%token null null|void
  • Hoa/View/Viewable.php:63: * @ensures \result: void;

Part rejected.

No modification will be done for there entries: No needed.

  • Hoa/Test/Report/Cli/Fields/Void.php:48: $voidMethods = $this->runner->getScore()->getVoidMethods();
  • Hoa/Test/Report/Cli/Fields/Void.php:49: $sizeOfVoidMethod = sizeof($voidMethods);
  • Hoa/Test/Report/Cli/Fields/Void.php:51: if (0 < $sizeOfVoidMethod) {
  • Hoa/Test/Report/Cli/Fields/Void.php:59: 'There is %d void test case',
  • Hoa/Test/Report/Cli/Fields/Void.php:60: 'There are %d void test cases',
  • Hoa/Test/Report/Cli/Fields/Void.php:61: $sizeOfVoidMethod
  • Hoa/Test/Report/Cli/Fields/Void.php:63: $sizeOfVoidMethod
  • Hoa/Test/Report/Cli/Fields/Void.php:68: foreach ($voidMethods as $voidMethod) {
  • Hoa/Test/Report/Cli/Fields/Void.php:71: $this->methodColorizer->colorize(sprintf('%s::%s()', $voidMethod['class'], $voidMethod['method'])) .

Regarding the part to discuss, what should be done for them in grammar.pp we use void and in viewable also but for praspel. So do we keep it like this or also change it ?

#11

Hywan commented

Quoting @Metalaka from hoaproject/Core#101 (comment):

Backward Incompatible Changes

Like the names reserved by the Scalar Type Declarations and Reserve More Types in PHP 7 RFCs, the void return type does not become a reserved word proper, but is instead prohibited from use as the name of a class or interface. …

from https://wiki.php.net/rfc/void_return_type

I didn't use many PHP7 new features but, is there any confusion here about reserved keyword ?

Hoa\Consistency does not separate the concept of reserved keywords in names or real language keywords. In any way, we must add it because it is used to compute entity names dynamically (in factories & co.), so we must add 'void' to the list of Hoa\Consistency\Consistency::isKeyword method.

Hywan commented

@vonglasow Any progress here? What do you need? Help?

it's almost done. The main things it's to review the others PR but for this issue I will update the checkbox list. Maybe just the changelog to complete and answer the question in first comment.

What should be done for the praspel void part ?

Hywan commented

Sorry to ask again… what is the state of this PR?

This issue was also to reference everything else regarding the problem on other library but it's should not be a good thing. This issue is almost done, the latest thing is to merge the PR on hoaproject/Test#71 but It's not regarding the issue for this library. So I think we can close it.