pdt icon indicating copy to clipboard operation
pdt copied to clipboard

codeassist erroneously thinks file_get_contents's $offset argument is nullable

Open divinity76 opened this issue 3 years ago • 0 comments

Describe the bug codeassist erroneously thinks file_get_contents's $use_include_path and $offset arguments are nullable. since at least PHP7.0.0 this results in

Fatal error: Uncaught TypeError: file_get_contents() expects parameter 2 to be boolean, null given in /in/CbHTq:3

with declare(strict_types=1); , and in 8.1RC1 this throws an E_DEPRECATED error even with strict_types=0 (that probably means PHP8.1 will start complaining, but it's possible that it's just a bug in 8.1RC1, i haven't actually investigated)

Describe the eclipse environment Eclipse Version: 2021-09 (4.21.0) Build id: 20210910-1417 PDT version 7.2.0.202005271851

Describe your system

  • OS: Xubuntu Linux 20.04
  • Version (?? do you mean Eclipse version or OS version? 20.04 kernel 5.4.0-88-generic x86_64)

To Reproduce Steps to reproduce the behavior: 1: open a php file and write

<?php file_get_contents();

then go inside the () and press ctrl+shift+space

Expected behavior code assist should inform us that $use_include_path and $offset are not nullable.

Screenshots image

Additional context

just checked the code generating the typehints, and my first thought was https://stackoverflow.com/a/1732454/1067003

divinity76 avatar Oct 31 '21 17:10 divinity76