Skip to content

Scalar type hints (version 0.1) #1044

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

Closed
wants to merge 7 commits into from
Closed

Conversation

dstogov
Copy link
Member

@dstogov dstogov commented Feb 2, 2015

This is a variation of version 0.1 Andrea's proposal (https://wiki.php.net/rfc/scalar_type_hints)

  • type hints work according to standard "zend parsing paramers" rules (reusing code from ZPP)
  • It's still possible to declare class with names "int", "float", etc, but they can't be used in type hinting anymore.
  • implemented support for return types
  • Type checking functions are optimized for speed and size

…Andrea's proposal (https://wiki.php.net/rfc/scalar_type_hints)

 - type hints work according to standard "zend parsing patramers" rules (reusing code from ZPP)
 - Only lowercased scalar type names are allowed - 'bool', 'int', float', 'string' and 'resource'. It's still possible to create "class Int" and even use "Int" as a "class type hint".
 - Type checking functions are optimized for speed and size
@smalyshev smalyshev added the RFC label Feb 2, 2015
* master: (65 commits)
  Add load time return type checking to match user land logic
  Add test function arguments
  fix data type mismatch
  fix unitialized val usage
  follow up fix for headers sent, checking a reference would be always true as well
  remove unused variable
  fix wars about importing of locally defined symbols
  fix data type
  Implemented internal function return types
  Updated NEWS
  Revert "Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat)"
  Removed TSRMLS_D
  5.6.7 now
  5.5.23 now
  Simplify code and add comments
  Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced.
  Revert "json_decode() should generate a syntax error when given ""."
  Add note aout $HTTP_RAW_POST_DATA
  Use object pointers instead of handles
  make buildconf work as expected; autoconf really needs some help with all those external m4s
  ...
It's still possible to create classes with the same names, but they can't be used as type hints anymore.
* master: (84 commits)
  Fixed dump_bt and printzv
  Avoid repeatable calls to strstr()
  fix json globals
  Improve and generalize class constant substitution
  regenerated scanner
  fix datatype mismatches
  fix inconsistend dll linkage warn
  size_t vs int
  use size_t for str length
  generate missing json files from config.w32
  Shut up, my lovely compiler; I do not like your warnings
  Márcio Almada 	remove dead tokens: T_CHARACTER, T_BAD_CHARACTER.
  fix detection of mbstate_t with clang
  Add missing NEWS and UPGRADING for bug #68938
  moved the part of the test into an appropriate place
  Removed unused REGISTER_PDO_CONST_LONG
  Fix another invalid free of CG(interned_empty_string)
  add tests for #68996
  Fixed #68790 (Missing return)
  Fixed #68790 (Missing return)
  ...
sapi/cli/php -r 'function hello(string $world) : string { var_dump(bin2hex($world)); return $world; } echo "foo" . hello(6) . "\n";'
* master: (225 commits)
  Improved ASSIGN_DIM handler
  Don't inline slow path
  Revert a part committted by mistake
  Fixed compilation warnings
  Fixed a bug that header value is not terminated by '\0' when accessed through getenv().
  better name
  Improve fix for #69038
  Update NEWs
  Fixed bug #69108 ("Segmentation fault" when (de)serializing SplObjectStorage)
  Added specialized versions of DO_FCALL handler:   DO_ICALL - for internal functions   DO_UCALL - for user functions   DO_FCALL_BY_NAME - plain, most probably user, funcstions (not methods)
  Use cache_slot offsets instead of indexes (simplify run-time instructions)
  Split INIT_FCALL_BY_NAME inti INIT_FCALL_BY_NAME(CONST+STRING) and INIT_DYNAMIC_CALL(CONST-STRING|TMPVAR|CV)
  Support list($a, $b) = $a
  Avoid unnecassary check
  Make zend_array_destroy() to free the corresponding zend_array
  Eliminate check on the fast path
  Make current() and key() receive argument by value.
  Use Firebird default home folder, replace Interbase with Firebird
  Updated NEWS
  updated NEWS
  ...
@smalyshev
Copy link
Contributor

I guess this is out of date and can be closed now.

@smalyshev smalyshev closed this Mar 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants