How to implement the return value of the function resource in php with strong typing and transfer function resource?

0 like 0 dislike
3 views
Good day

Want to use strong typing in PHP. Wanted to create a method that returns the type of resource, but eclipse started swearing. climb on the documentation, figure out what to pass to the function or method arguments of type resource is impossible. About specify the type of the return item can't find anything.
<?phpclass a{public function set_resource(resource $r){var_dump($r);}public function get_resource(): resource{return fopen('ляляля.txt', 'r");}</code>


some reason you can't do that. Basics explain how in these cases you need to do? How to explicitly specify strict typing resource in both cases?

Thank you for your attention and answers.
by | 3 views

1 Answer

0 like 0 dislike
afaik, piche strong typing applies only to scalar types to which the resource applies.
by

Related questions

0 like 0 dislike
2 answers
asked May 22, 2019 by yurypanyukov
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
asked Aug 10, 2019 by CiSharper
0 like 0 dislike
2 answers
asked May 20, 2019 by sharkdest
110,608 questions
257,186 answers
0 comments
33,949 users