diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 64d7f74c47b6..781f3db0996c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -32,10 +32,12 @@ parameters: - '#Access to an undefined property CodeIgniter\\Database\\Forge::\$dropConstraintStr#' - '#Access to an undefined property CodeIgniter\\Database\\BaseConnection::\$mysqli|\$schema#' - '#Access to an undefined property CodeIgniter\\Database\\ConnectionInterface::(\$DBDriver|\$connID|\$likeEscapeStr|\$likeEscapeChar|\$escapeChar|\$protectIdentifiers|\$schema)#' + - '#Access to an undefined property CodeIgniter\\HTTP\\Request::\$uri#' - '#Access to protected property CodeIgniter\\Database\\BaseConnection::(\$DBDebug|\$DBPrefix|\$swapPre|\$charset|\$DBCollat|\$database)#' - '#Call to an undefined method CodeIgniter\\Database\\BaseConnection::_(disable|enable)ForeignKeyChecks\(\)#' - '#Call to an undefined method CodeIgniter\\Database\\BaseConnection::supportsForeignKeys\(\)#' - '#Call to an undefined method CodeIgniter\\Database\\ConnectionInterface::(tableExists|protectIdentifiers|setAliasedTables|escapeIdentifiers|affectedRows|addTableAlias|getIndexData)\(\)#' + - '#Call to an undefined method CodeIgniter\\HTTP\\Request::(getPath|getSegments|getMethod|setLocale|getPost)\(\)#' - '#Call to an undefined method CodeIgniter\\Router\\RouteCollectionInterface::(getDefaultNamespace|isFiltered|getFilterForRoute|getRoutesOptions)\(\)#' - '#Cannot access property [\$a-z_]+ on ((bool\|)?object\|resource)#' - '#Cannot call method [a-zA-Z_]+\(\) on ((bool\|)?object\|resource)#' diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index ab5c103bd755..1feb20931991 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -408,7 +408,7 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache return $returnResponse ? $possibleResponse : $possibleResponse->pretend($this->useSafeOutput)->send(); } - if ($possibleResponse instanceof RequestInterface) + if ($possibleResponse instanceof Request) { $this->request = $possibleResponse; } @@ -586,6 +586,7 @@ protected function getRequestObject() return; } + // @phpstan-ignore-next-line if (is_cli() && ENVIRONMENT !== 'testing') { // @codeCoverageIgnoreStart @@ -840,6 +841,7 @@ protected function determinePath() return $this->path; } + // @phpstan-ignore-next-line return (is_cli() && ! (ENVIRONMENT === 'testing')) ? $this->request->getPath() : $this->request->uri->getPath(); }