php - Is there any way to apply strict typing to the parameters of a function? -


I know that some of the beauty of PHP is with loose typing, but I want to create a strictly typed PHP class I'm Object Oriented Functions.

I tried what I thought:

  ... [index.php] 24: Include './documentation-builder.php'; 25: $ creator = new dockbuilder ('documentation'); ... [documentation-builder.php] 5: class docbilder 6: {7: function __ composition (string $ heading) 8: {9: $ this-> Title = $ heading; 10:} 11:}  

But I found the following error:

Catchable fatal error : 1 document doc -Bilder passed: __Construct () string should be an example, given string, which is on path 25 \ path \ to \ index.php and \ path \ to \ documentation-builder .php is defined in the line 5

The fact is that "logic 1 ... Should be an example of string, given string "I feel Why have received that I am close, but forgot

I need strict typing on your PHP functions?

Just point to classes and arrays in this way.

Type signals can not be used with scalar type such as int or string. Resources and symptoms are also not allowed.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -