Title: Warning: ltrim() expects parameter 1 to be string, object given in vendor\magento\framework\Code\Generator\EntityAbstract.php on line 152

To fix this issue. There are three steps to resolve this issue:

01 Step:

Remove all folders in var folder


Command Syntax:

> rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* var/generation/*


Remove var folder

02 Step:

Run compile and clean cache commands from console:

> php bin/magento setup:di:compile
> php bin/magento cache:clean

03 Step (If error not fixed):

After removing var folder give permission to var folder

Command to give permission to var folders

> chmod -R 775 var/generation/ var/cache/ var/full_page/

After these steps refresh the page. If any CSS, JS error found then run static content deploy and cache clean commands

> php bin/magento setup:static-content:deploy
> php bin/magento cache:clean

If you have any question then please query! Thanks