Phalcon Framework 5.9.3

TypeError: App\Documentation\GithubSource::__construct(): Argument #1 ($component) must be of type App\Components\Component, null given, called in /srv/konekt.dev/web/releases/20250512132011/app/controllers/DocumentationController.php on line 95

/srv/konekt.dev/web/releases/20250512132011/app/src/Documentation/GithubSource.php (24)
#0App\Documentation\GithubSource->__construct
/srv/konekt.dev/web/releases/20250512132011/app/controllers/DocumentationController.php (95)
<?php
/**
 * Contains the DocumentationController class.
 *
 * @copyright   Copyright (c) 2019 Attila Fulop
 * @author      Attila Fulop
 * @license     MIT
 * @since       2019-06-08
 *
 */
 
use App\Components\Component;
use App\Documentation\CachedSource;
use App\Documentation\Contracts\Documentation;
use App\Documentation\GithubSource;
use App\Documentation\LocalSource;
 
class DocumentationController extends BaseController
{
    use ParsesMarkdown;
 
    /** @var Component|null */
    private $component;
 
    /** @var Documentation */
    private $documentation;
 
    public function initialize()
    {
        parent::initialize();
        $this->initializeMarkdown();
    }
 
    public function latestAction(string $component)
    {
        $this->loadComponent($component);
        $version = $this->getDocumentation()->getLatestVersion();
 
        $this->response->redirect([
            'for'       => 'documentation.show',
            'version'   => $version,
            'component' => $component,
            'page'      => $this->getDocumentation()->indexForVersion($version),
        ]);
    }
 
    public function indexAction(string $component, string $version)
    {
        $this->loadComponent($component);
 
        $this->response->redirect([
            'for'       => 'documentation.show',
            'version'   => $version,
            'component' => $component,
            'page'      => $this->getDocumentation()->indexForVersion($version),
        ]);
    }
 
    public function showAction(string $component, string $version, string $page)
    {
        $this->loadComponent($component);
        $doc = $this->getDocumentation();
 
        if ($version === 'current') {
            $version = $doc->getLatestVersion();
        }
 
        $content = $doc->getPage($page, $version);
 
        if (!$content) {
            return do404($this);
        }
 
        $title = $this->getPageTitle($content, $page);
        $toc   = $this->getDocumentation()->getPage('_sidebar', $version);
 
        $this->view->pick('documentation/show');
        $this->view->setVars([
            'version'          => $version,
            'versions'         => $doc->getVersions(),
            'page'             => $page,
            'currentComponent' => $this->component,
            'title'            => $title,
            'content'          => $this->markdownToHtml($content, $version),
            'toc'              => $this->markdownToHtml($toc, $version)
        ]);
    }
 
    private function getDocumentation(): Documentation
    {
        if (!$this->documentation) {
            $config = $this->di->get('config');
            $this->documentation = match($config->get('source')) {
                'local' => new LocalSource($this->component, $config),
                default => new CachedSource(new GithubSource($this->component), $config),
            };
        }
 
        return $this->documentation;
    }
 
    private function loadComponent(string $component)
    {
        $this->component = $this->componentRepository->findBySlug($component);
 
        if (!$component) {
            do404($this);
        }
    }
 
    private function getPageTitle($md, $fallback)
    {
        $match = [];
        if (preg_match('/^# ([\w ,\'"\.\?!\/\\\\`]+)\n/', $md, $match)) {
            return $match[1];
        }
 
        return $fallback;
    }
}
#1DocumentationController->getDocumentation
/srv/konekt.dev/web/releases/20250512132011/app/controllers/DocumentationController.php (62)
<?php
/**
 * Contains the DocumentationController class.
 *
 * @copyright   Copyright (c) 2019 Attila Fulop
 * @author      Attila Fulop
 * @license     MIT
 * @since       2019-06-08
 *
 */
 
use App\Components\Component;
use App\Documentation\CachedSource;
use App\Documentation\Contracts\Documentation;
use App\Documentation\GithubSource;
use App\Documentation\LocalSource;
 
class DocumentationController extends BaseController
{
    use ParsesMarkdown;
 
    /** @var Component|null */
    private $component;
 
    /** @var Documentation */
    private $documentation;
 
    public function initialize()
    {
        parent::initialize();
        $this->initializeMarkdown();
    }
 
    public function latestAction(string $component)
    {
        $this->loadComponent($component);
        $version = $this->getDocumentation()->getLatestVersion();
 
        $this->response->redirect([
            'for'       => 'documentation.show',
            'version'   => $version,
            'component' => $component,
            'page'      => $this->getDocumentation()->indexForVersion($version),
        ]);
    }
 
    public function indexAction(string $component, string $version)
    {
        $this->loadComponent($component);
 
        $this->response->redirect([
            'for'       => 'documentation.show',
            'version'   => $version,
            'component' => $component,
            'page'      => $this->getDocumentation()->indexForVersion($version),
        ]);
    }
 
    public function showAction(string $component, string $version, string $page)
    {
        $this->loadComponent($component);
        $doc = $this->getDocumentation();
 
        if ($version === 'current') {
            $version = $doc->getLatestVersion();
        }
 
        $content = $doc->getPage($page, $version);
 
        if (!$content) {
            return do404($this);
        }
 
        $title = $this->getPageTitle($content, $page);
        $toc   = $this->getDocumentation()->getPage('_sidebar', $version);
 
        $this->view->pick('documentation/show');
        $this->view->setVars([
            'version'          => $version,
            'versions'         => $doc->getVersions(),
            'page'             => $page,
            'currentComponent' => $this->component,
            'title'            => $title,
            'content'          => $this->markdownToHtml($content, $version),
            'toc'              => $this->markdownToHtml($toc, $version)
        ]);
    }
 
    private function getDocumentation(): Documentation
    {
        if (!$this->documentation) {
            $config = $this->di->get('config');
            $this->documentation = match($config->get('source')) {
                'local' => new LocalSource($this->component, $config),
                default => new CachedSource(new GithubSource($this->component), $config),
            };
        }
 
        return $this->documentation;
    }
 
    private function loadComponent(string $component)
    {
        $this->component = $this->componentRepository->findBySlug($component);
 
        if (!$component) {
            do404($this);
        }
    }
 
    private function getPageTitle($md, $fallback)
    {
        $match = [];
        if (preg_match('/^# ([\w ,\'"\.\?!\/\\\\`]+)\n/', $md, $match)) {
            return $match[1];
        }
 
        return $fallback;
    }
}
#2DocumentationController->showAction
#3Phalcon\Dispatcher\AbstractDispatcher->callActionMethod
#4Phalcon\Dispatcher\AbstractDispatcher->dispatch
#5Phalcon\Mvc\Application->handle
/srv/konekt.dev/web/releases/20250512132011/public/index.php (21)
<?php
 
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
define('VAR_PATH', BASE_PATH . '/var');
define('PUBLIC_PATH', BASE_PATH . '/public');
 
if (true || 'dev' == getenv('APP_ENV')) {
    ini_set('display_errors', 1);
 
    $debug = new \Phalcon\Support\Debug();
    $debug->listen();
}
 
require_once BASE_PATH . '/vendor/autoload.php';
 
$application = require_once(APP_PATH . '/boot.php');
 
try {
    $request = new Phalcon\Http\Request();
    $response = $application->handle($request->getURI());
 
    $response->send();
} catch (\Exception $e) {
    $errorHtml = file_get_contents(dirname(__DIR__) . '/app/views/error/500.html');
    echo str_replace('{{ error_message }}', $e->getMessage(), $errorHtml);
}
KeyValue
KeyValue
USERkonekt
HOME/srv/konekt.dev
HTTP_X_BUNNYPROXY_DIAGNOSTICS_GUID265826fa-b32d-480e-841d-e3bbe4632762
HTTP_ACCEPT_ENCODINGzstd, br, gzip
HTTP_X_FORWARDED_FOR216.73.216.173
HTTP_X_REAL_IP216.73.216.173
HTTP_CDN_PULLZONEID3692418
HTTP_VIABunnyCDN
HTTP_CDN_PROXYVER1.28
HTTP_CDN_LOOPCOUNT1
HTTP_CDN_REQUESTID425c811001e07895fec281de5d777d98
HTTP_CDN_REQUESTSTATECODEOH
HTTP_CDN_REQUESTCOUNTRYCODEUS
HTTP_BUNNYCDN_LBKEYj0YiR5gUfYiZmQrWSLV6opVewPUZFwJD21K1W9dkKWg4EnYSjbS5c9
HTTP_X_FORWARDED_PROTOhttps
HTTP_CDN_MOBILEDEVICEfalse
HTTP_CDN_CONNECTIONID8386178998
HTTP_CDN_HOSTkonekt.dev
HTTP_CDN_SERVERZONEIL
HTTP_CDN_SERVERID941
HTTP_USER_AGENTMozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT*/*
HTTP_HOSTkonekt.dev
PATH_INFO
SCRIPT_FILENAME/srv/konekt.dev/web/current/public/index.php
REDIRECT_STATUS200
SERVER_NAMEkonekt.dev
SERVER_PORT80
SERVER_ADDR10.19.0.6
REMOTE_USER
REMOTE_PORT22029
REMOTE_ADDR185.93.1.250
SERVER_SOFTWAREnginx/1.22.1
GATEWAY_INTERFACECGI/1.1
REQUEST_SCHEMEhttp
SERVER_PROTOCOLHTTP/1.1
DOCUMENT_ROOT/srv/konekt.dev/web/releases/20250512132011/public
DOCUMENT_URI/index.php
REQUEST_URI/xtend/1.0/registry
SCRIPT_NAME/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHODGET
QUERY_STRING
FCGI_ROLERESPONDER
PHP_SELF/index.php
REQUEST_TIME_FLOAT1749337228.6911
REQUEST_TIME1749337228
#Path
0/srv/konekt.dev/web/releases/20250512132011/public/index.php
1/srv/konekt.dev/web/releases/20250512132011/vendor/autoload.php
2/srv/konekt.dev/web/releases/20250512132011/vendor/composer/autoload_real.php
3/srv/konekt.dev/web/releases/20250512132011/vendor/composer/platform_check.php
4/srv/konekt.dev/web/releases/20250512132011/vendor/composer/ClassLoader.php
5/srv/konekt.dev/web/releases/20250512132011/vendor/composer/autoload_static.php
6/srv/konekt.dev/web/releases/20250512132011/app/src/helpers.php
7/srv/konekt.dev/web/releases/20250512132011/app/boot.php
8/srv/konekt.dev/web/releases/20250512132011/app/routes.php
9/srv/konekt.dev/web/releases/20250512132011/app/controllers/DocumentationController.php
10/srv/konekt.dev/web/releases/20250512132011/app/controllers/BaseController.php
11/srv/konekt.dev/web/releases/20250512132011/app/controllers/SharesConfigWithViews.php
12/srv/konekt.dev/web/releases/20250512132011/app/controllers/SharesComponentsWithViews.php
13/srv/konekt.dev/web/releases/20250512132011/app/controllers/ParsesMarkdown.php
14/srv/konekt.dev/web/releases/20250512132011/config/config.php
15/srv/konekt.dev/web/releases/20250512132011/app/src/Components/ComponentRepository.php
16/srv/konekt.dev/web/releases/20250512132011/app/src/Cache/InteractsWithCache.php
17/srv/konekt.dev/web/releases/20250512132011/app/src/Components/Contracts/ComponentRepository.php
18/srv/konekt.dev/web/releases/20250512132011/app/src/Components/Component.php
19/srv/konekt.dev/web/releases/20250512132011/app/src/Packagist/Package.php
20/srv/konekt.dev/web/releases/20250512132011/app/src/Github/Repository.php
21/srv/konekt.dev/web/releases/20250512132011/vendor/erusev/parsedown-extra/ParsedownExtra.php
22/srv/konekt.dev/web/releases/20250512132011/vendor/erusev/parsedown/Parsedown.php
23/srv/konekt.dev/web/releases/20250512132011/app/src/Documentation/MarkdownPreprocessor.php
24/srv/konekt.dev/web/releases/20250512132011/app/src/Documentation/CachedSource.php
25/srv/konekt.dev/web/releases/20250512132011/app/src/Documentation/Contracts/Documentation.php
26/srv/konekt.dev/web/releases/20250512132011/app/src/Documentation/GithubSource.php
Memory
Usage2097152