rector icon indicating copy to clipboard operation
rector copied to clipboard

[php] Error processing of trait for php73

Open Nazariy opened this issue 7 years ago • 1 comments

Just runned in to issue while trying to inspect my code I run in to this issue:

 [ERROR] Could not process "/mnt/d/var/www/phalcon/blank/app/Controllers/BaseController/ResourceHandler.php" file by    
         "Rector\Php\Rector\FuncCall\StringifyStrNeedlesRector", due to:                                                
         "".    

The code it doesn't like:

<?php

namespace NS\Controllers\BaseController;

use Phalcon\Assets\Manager;

/**
 * Trait ResourceHandler
 * @package NS\Controllers\BaseController
 * @property Manager assets
 */
trait ResourceHandler
{
    /**
     * addResourceByType
     * @param string $path
     * @return ResourceHandler
     */
    protected function addResourceByType(string $path): self
    {
        $local = !(strpos($path, 'http') === 0);
        switch (pathinfo($path, PATHINFO_EXTENSION)) {
            case 'css':
                $this->assets->addCss($path, $local);
                break;
            case 'js':
                $this->assets->addJs($path, $local);
                break;
        }

        return $this;
    }

}

Other levels inspection seems to be OK

Nazariy avatar May 06 '19 14:05 Nazariy

Thanks for reporting!

If you add this file as failing tests to StringifyStrNeedlesRectorTest, I'll fix it right away

TomasVotruba avatar May 06 '19 14:05 TomasVotruba