Skip to content

Commit

Permalink
[TASK] Fix phpstan checkFunctionArgumentTypes errors in ext:core Package
Browse files Browse the repository at this point in the history
This patch fixes incompatible type usage in function arguments
and is preparatory work for introducing native type hints and
strict mode in all core files.

Releases: master, 10.4
Resolves: #92257
Change-Id: I686d520009ac4fed95127c2c6098109cbc91bf46
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65681
Tested-by: Sascha Egerer <sascha@sascha-egerer.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Sascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
alexanderschnitzler authored and ervaude committed Sep 21, 2020
1 parent 52b1b43 commit c9d41ab
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions typo3/sysext/core/Classes/Package/PackageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,9 @@ public function getComposerManifest($manifestPath)
$composerManifest = null;
if (file_exists($manifestPath . 'composer.json')) {
$json = file_get_contents($manifestPath . 'composer.json');
$composerManifest = json_decode($json);
if ($json !== false) {
$composerManifest = json_decode($json);
}
if (!$composerManifest instanceof \stdClass) {
throw new InvalidPackageManifestException('The composer.json found for extension "' . PathUtility::basename($manifestPath) . '" is invalid!', 1439555561);
}
Expand Down Expand Up @@ -909,12 +911,18 @@ protected function mapExtensionManagerConfigurationToComposerManifest($packageKe
}
}
if (isset($extensionManagerConfiguration['autoload'])) {
$composerManifest->autoload = json_decode(json_encode($extensionManagerConfiguration['autoload']));
$autoload = json_encode($extensionManagerConfiguration['autoload']);
if ($autoload !== false) {
$composerManifest->autoload = json_decode($autoload);
}
}
// composer.json autoload-dev information must be discarded, as it may contain information only available after a composer install
unset($composerManifest->{'autoload-dev'});
if (isset($extensionManagerConfiguration['autoload-dev'])) {
$composerManifest->{'autoload-dev'} = json_decode(json_encode($extensionManagerConfiguration['autoload-dev']));
$autoloadDev = json_encode($extensionManagerConfiguration['autoload-dev']);
if ($autoloadDev !== false) {
$composerManifest->{'autoload-dev'} = json_decode($autoloadDev);
}
}

return $composerManifest;
Expand Down

0 comments on commit c9d41ab

Please sign in to comment.