The function plupload_file_uri_to_object() says in the docblock

@return boolean
- *   A file object, or FALSE on error.

This is wrong in two ways. Firstly if it was to return a file object or boolean then the @return should be either boolean|\stdClass or mixed. However, as the function creates a new stdClass and returns that (there is no conditional to return something else), it won't ever return a bool.

This will cause a problem in an IDE such as PHPStorm because if you want to call plupload_file_uri_to_object() it expects a boolean but in fact a stdClass object is returned.

Also there is a line that says $wrapper = file_stream_wrapper_get_instance_by_uri($uri); but $wrapper is never used so that can be removed.

Patch coming up.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DrupalGideon created an issue. See original summary.

DrupalGideon’s picture

Status: Active » Needs review
FileSize
826 bytes
DrupalGideon’s picture

Title: plupload_file_uri_to_object() docblock error - IDE's complain » plupload_file_uri_to_object() docblock error - IDEs complain