protected function findPackage()
    {
        if ($this->package !== null) {
            return;
        }

        $file = $this->getFile();

        $parts = explode(DIRECTORY_SEPARATOR, $file);

        $key = array_search('src', array_reverse($parts, true), true);
        if ($key === false) {
            $this->package = new \stdClass();
            return;
        }

        $composerFile = implode(DIRECTORY_SEPARATOR, array_slice($parts, 0, $key)).DIRECTORY_SEPARATOR.'composer.json';
        if (!file_exists($composerFile)) {
            $this->package = new \stdClass();
            return;
        }

        $composerContent = file_get_contents($composerFile);
        if ($composerContent === false) {
            $this->package = new \stdClass();
            return;
        }

        $this->package = json_decode($composerContent);
        if ($this->package === null) {
            $this->package = new \stdClass();
        }
    }