You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP Fatal error: Uncaught Error: Object of class PhpParser\Node\UnionType could not be converted to string in /vendor/php-censor/phpdoc-checker/src/FileProcessor.php:173
#49
Open
kaurov opened this issue
Nov 24, 2022
· 0 comments
PHPDOCCHECK
PHPDoc Checker
PHP Fatal error: Uncaught Error: Object of class PhpParser\Node\UnionType could not be converted to string in /vendor/php-censor/phpdoc-checker/src/FileProcessor.php:173
was caused by: public function getInstance(Class1|Class2 $item = null): self
and temporarily fixed by
either removal of null: public function getInstance(Class1|Class2 $item): self
either adding the null to types: public function factoryMethod(Class1|Class2|null $item = null): self
Acceptance Criteria:
PHPDoc Checker can read functions with union typed properties without the causing PHP error and output readable notice about deveoper's error. Something like:
Please add |null to $item in getInstance() to be able to set the value = null.
The text was updated successfully, but these errors were encountered:
was caused by:
public function getInstance(Class1|Class2 $item = null): self
and temporarily fixed by
either removal of null:
public function getInstance(Class1|Class2 $item): self
either adding the null to types:
public function factoryMethod(Class1|Class2|null $item = null): self
Acceptance Criteria:
PHPDoc Checker can read functions with union typed properties without the causing PHP error and output readable notice about deveoper's error. Something like:
Please add |null to $item in getInstance() to be able to set the value = null.
The text was updated successfully, but these errors were encountered: