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

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
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 | 12 views

1 Answer

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

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,187 answers
40,796 users