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

Add type hints for scalar arguments and return values in Zend3 #1658

Merged

Conversation

danhunsaker
Copy link
Contributor

Fixes #1656

@danhunsaker danhunsaker mentioned this pull request Jun 29, 2018
@danhunsaker
Copy link
Contributor Author

Discussion of the failed checks, and how to handle them properly, was started in #1656 before this WIP was submitted for reference.

}

if (file_exists('ext')) {
exec('rm -rf ext/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you adopt this to use in AppVeyor (Windows) too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. fair point. I'll need to take a peek at the other test I pulled this block from and adjust it, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is addressed. Now handling the other issues that are preventing this WIP from becoming a true PR.

@danhunsaker danhunsaker force-pushed the improve/compile-type-hints branch 2 times, most recently from a1b5337 to d16348f Compare July 1, 2018 21:50
@danhunsaker danhunsaker changed the title [WIP] Add type hints for scalar arguments and return values in Zend3 Add type hints for scalar arguments and return values in Zend3 Jul 1, 2018
@danhunsaker
Copy link
Contributor Author

OK, should be ready to go. The most recent change was to start using the PHP version to detect whether we have support for strict typing or not, and adjusting the expected exception accordingly. With declare(strict_types=1) in the files where strict type checks are appropriate, PHP throws TypeError before we see values passed to Zephir code. Otherwise, PHP coerces values to the expected type automatically, also before we see them. PHP 5.x doesn't support strict typing in any of its incarnations, nor does it support type hinting in the first place, so Zephir code will compile to the same C code as before, with ZE2.

@sergeyklay sergeyklay merged commit fa32159 into zephir-lang:development Jul 4, 2018
@sergeyklay
Copy link
Contributor

Thank you!

@danhunsaker danhunsaker deleted the improve/compile-type-hints branch July 7, 2018 09:59
sergeyklay added a commit that referenced this pull request Nov 25, 2018
sergeyklay added a commit that referenced this pull request Nov 25, 2018
sergeyklay added a commit that referenced this pull request Nov 26, 2018
@sergeyklay sergeyklay mentioned this pull request Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants