Skip to content

Conversation

@mlocati
Copy link
Contributor

@mlocati mlocati commented Sep 26, 2021

This is an attempt to fix #28

I take these exact same steps, and I see tons of psalm warnings.

But when running it as a github everything seems to be fine... I don't know why...

@mlocati
Copy link
Contributor Author

mlocati commented Sep 26, 2021

Here's the errors I have:

Scanning files...
Analyzing files...



ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:48:23 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
        $site = $app->make('site')->getSite();

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:53:34 - Method Concrete\Core\Entity\Site\Site::getSiteName does not exist (see https://psalm.dev/022)
            ->setSiteName($site->getSiteName())

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:54:37 - Method Concrete\Core\Entity\Site\Site::getSiteCanonicalURL does not exist (see https://psalm.dev/022)
            ->setUrl((string)$site->getSiteCanonicalURL());

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:71:28 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
            $this->output->writeln('Removing temporary directory...');

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:84:24 - Cannot call method success on possibly null value (see https://psalm.dev/083)
        $this->output->success('Backup complete!');

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:142:37 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
        $fileStorageFactory = $app->make(StorageLocationFactory::class);

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:146:48 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::getConfigurationObject does not exist (see https://psalm.dev/022)
            $configuration = $storageLocation->getConfigurationObject();

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:148:32 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
                $this->output->writeln(

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:151:43 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::getName does not exist (see https://psalm.dev/022)
                        $storageLocation->getName(),

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:152:41 - Method Concrete\Core\File\StorageLocation\Configuration\LocalConfiguration::getRootPath does not exist (see https://psalm.dev/022)
                        $configuration->getRootPath()

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:156:99 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::getID does not exist (see https://psalm.dev/022)
                $storageLocationOutput = $storageOutput . DIRECTORY_SEPARATOR . $storageLocation->getID() . '/';

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:165:47 - Method Concrete\Core\File\StorageLocation\Configuration\LocalConfiguration::getRootPath does not exist (see https://psalm.dev/022)
                        rtrim($configuration->getRootPath(), '/') . '/',

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:180:39 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::getID does not exist (see https://psalm.dev/022)
                    $storageLocation->getID(),

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:181:39 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::getName does not exist (see https://psalm.dev/022)
                    $storageLocation->getName(),

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:182:39 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::isDefault does not exist (see https://psalm.dev/022)
                    $storageLocation->isDefault(),

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:186:32 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
                $this->output->writeln(

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:190:43 - Method Concrete\Core\Entity\File\StorageLocation\StorageLocation::getName does not exist (see https://psalm.dev/022)
                        $storageLocation->getName()

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:206:24 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
        $this->output->writeln('Exporting application/ directory...');

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:251:24 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
        $this->output->writeln('Exporting packages/ directory...');

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:253:46 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
        $packages = $this->getApplication()->make(PackageService::class);

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:254:33 - Method Concrete\Core\Package\PackageService::getInstalledHandles does not exist (see https://psalm.dev/022)
        $installed = $packages->getInstalledHandles();

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:256:29 - Method Concrete\Core\Package\PackageService::getAvailablePackages does not exist (see https://psalm.dev/022)
        foreach ($packages->getAvailablePackages() as $package) {

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:296:28 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
            $this->output->writeln('Exporting concrete/ directory...');

ERROR: UndefinedMethod - src/Command/Backup/BackupCommand.php:328:31 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
            $siteName = $app->make('site')->getSite()->getSiteName();

ERROR: PossiblyNullReference - src/Command/Backup/BackupCommand.php:334:24 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
        $this->output->writeln(sprintf('Compressing directory: %s', $outputFile));

ERROR: PossiblyNullReference - src/Command/Backup/InspectCommand.php:21:28 - Cannot call method error on possibly null value (see https://psalm.dev/083)
            $this->output->error('Backup file not found.');

ERROR: PossiblyNullReference - src/Command/Backup/InspectCommand.php:28:28 - Cannot call method error on possibly null value (see https://psalm.dev/083)
            $this->output->error('Unable to load manifest from backup file.');

ERROR: PossiblyNullReference - src/Command/Backup/InspectCommand.php:38:28 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
            $this->output->writeln(json_encode($manifest, JSON_PRETTY_PRINT));

ERROR: PossiblyNullReference - src/Command/Backup/InspectCommand.php:50:24 - Cannot call method table on possibly null value (see https://psalm.dev/083)
        $this->output->table(['basics'], [

ERROR: PossiblyNullReference - src/Command/Backup/InspectCommand.php:116:32 - Cannot call method error on possibly null value (see https://psalm.dev/083)
                $this->output->error('Cannot access "' . $path . '": No such file or directory');

ERROR: PossiblyNullReference - src/Command/Backup/InspectCommand.php:143:24 - Cannot call method table on possibly null value (see https://psalm.dev/083)
        $this->output->table($headers, $table);

ERROR: PossiblyNullReference - src/Command/Backup/RestoreCommand.php:36:29 - Cannot call method confirm on possibly null value (see https://psalm.dev/083)
        if (!$this->output->confirm('Are you sure you want to restore this backup?')) {

ERROR: UndefinedMethod - src/Command/Database/DumpCommand.php:18:25 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
        $config = $app->make('config')->get('database');

ERROR: PossiblyNullReference - src/Command/Database/DumpCommand.php:40:32 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
                $this->output->writeln(sprintf('Exporting database: %s', $connectionRow['database']));

ERROR: PossiblyNullReference - src/Command/Database/DumpCommand.php:63:24 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
        $this->output->writeln('<error>Unable to locate default Concrete database connection.</error>');

ERROR: PossiblyNullReference - src/Command/Phar/SelfUpdateCommand.php:49:33 - Cannot call method isQuiet on possibly null value (see https://psalm.dev/083)
            if (!$this->output->isQuiet()) {

ERROR: PossiblyNullReference - src/Command/Phar/SelfUpdateCommand.php:62:29 - Cannot call method isQuiet on possibly null value (see https://psalm.dev/083)
        if (!$this->output->isQuiet()) {

ERROR: PossiblyNullReference - src/Command/Phar/SelfUpdateCommand.php:108:28 - Cannot call method isVerbose on possibly null value (see https://psalm.dev/083)
        if ($this->output->isVerbose()) {

ERROR: PossiblyNullReference - src/Command/Phar/SelfUpdateCommand.php:133:28 - Cannot call method isVerbose on possibly null value (see https://psalm.dev/083)
        if ($this->output->isVerbose()) {

ERROR: InvalidArgument - src/Command/Phar/SelfUpdateCommand.php:144:27 - Argument 1 of set_error_handler expects callable(int, string, string=, int=, array<array-key, mixed>=):bool|null, impure-Closure(int, string):void provided (see https://psalm.dev/004)
        set_error_handler(static function(int $errno, string $errstr) use (&$error): void {
            $error = trim($errstr);
            if ($error === '') {
                $error = "Unknown error (code: {$errno})";
            }
        }, -1);

ERROR: PossiblyNullReference - src/Command/Phar/SelfUpdateCommand.php:168:28 - Cannot call method isVerbose on possibly null value (see https://psalm.dev/083)
        if ($this->output->isVerbose()) {

ERROR: InvalidArgument - src/Command/Phar/SelfUpdateCommand.php:172:27 - Argument 1 of set_error_handler expects callable(int, string, string=, int=, array<array-key, mixed>=):bool|null, pure-Closure():void provided (see https://psalm.dev/004)
        set_error_handler(static function(): void {}, -1);

ERROR: InvalidArgument - src/Command/Phar/SelfUpdateCommand.php:182:27 - Argument 1 of set_error_handler expects callable(int, string, string=, int=, array<array-key, mixed>=):bool|null, impure-Closure(int, string):void provided (see https://psalm.dev/004)
        set_error_handler(static function(int $errno, string $errstr) use (&$error): void {
            $error = trim($errstr);
            if ($error === '') {
                $error = "Unknown error (code: {$errno})";
            }
        }, -1);

ERROR: PossiblyUndefinedVariable - src/Command/Phar/SelfUpdateCommand.php:188:41 - Possibly undefined variable $tempFile, first seen on line 176 (see https://psalm.dev/018)
        $savedBytes = file_put_contents($tempFile, $pharContents);

ERROR: InvalidArgument - src/Command/Phar/SelfUpdateCommand.php:194:27 - Argument 1 of set_error_handler expects callable(int, string, string=, int=, array<array-key, mixed>=):bool|null, impure-Closure(int, string):void provided (see https://psalm.dev/004)
        set_error_handler(static function(int $errno, string $errstr) use (&$error): void {
            $error = trim($errstr);
            if ($error === '') {
                $error = "Unknown error (code: {$errno})";
            }
        }, -1);

ERROR: InvalidArgument - src/Command/Phar/SelfUpdateCommand.php:203:31 - Argument 1 of set_error_handler expects callable(int, string, string=, int=, array<array-key, mixed>=):bool|null, pure-Closure():void provided (see https://psalm.dev/004)
            set_error_handler(static function(): void {}, -1);

ERROR: InvalidArgument - src/Command/Phar/SelfUpdateCommand.php:209:31 - Argument 1 of set_error_handler expects callable(int, string, string=, int=, array<array-key, mixed>=):bool|null, pure-Closure():void provided (see https://psalm.dev/004)
            set_error_handler(static function(): void {}, -1);

ERROR: UndefinedMethod - src/Command/Site/InfoCommand.php:19:23 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
        $info = $app->make(Info::class);

ERROR: PossiblyNullReference - src/Command/Site/InfoCommand.php:20:24 - Cannot call method writeln on possibly null value (see https://psalm.dev/083)
        $this->output->writeln('<info># Location</info>');

ERROR: PossiblyNullReference - src/Command/Site/SyncCommand.php:36:24 - Cannot call method outputStep on possibly null value (see https://psalm.dev/083)
        $this->output->outputStep('Backing up remote site');

ERROR: ParamNameMismatch - src/Concrete/Connection/ApplicationEnabledConnection.php:20:41 - Argument 1 of Concrete\Console\Concrete\Connection\ApplicationEnabledConnection::connect has wrong name $application, expecting $app as defined by Concrete\Console\Concrete\Connection\ApplicationEnabledConnectionInterface::connect (see https://psalm.dev/230)
    public function connect(Application $application): void

ERROR: DeprecatedClass - src/Concrete/Restore/Strategy/AbstractDirectoryExtractStrategy.php:49:26 - Class League\Flysystem\Handler is marked as deprecated (see https://psalm.dev/098)
                    if (!$fs->get($file)->delete()) {

ERROR: UndefinedMethod - src/Concrete/Restore/Strategy/RestoreDatabase.php:147:58 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
                $config = $connection->getApplication()->make('config');

ERROR: UndefinedMethod - src/Concrete/Restore/Strategy/RestoreStorageLocations.php:33:37 - Method Concrete\Core\Application\Application::make does not exist (see https://psalm.dev/022)
        $fileStorageFactory = $app->make(StorageLocationFactory::class);

ERROR: UndefinedMethod - src/Concrete/Restore/Strategy/RestoreStorageLocations.php:50:52 - Method Concrete\Core\File\StorageLocation\StorageLocationFactory::fetchByID does not exist (see https://psalm.dev/022)
            $locationObject = $fileStorageFactory->fetchByID($location['id']);

ERROR: ParamNameMismatch - src/Installation/InstallationAwareTrait.php:13:50 - Argument 1 of Concrete\Console\Installation\InstallationAwareTrait::setInstallation has wrong name $connection, expecting $installation as defined by Concrete\Console\Installation\InstallationAwareInterface::setInstallation (see https://psalm.dev/230)
    public function setInstallation(Installation $connection): void

ERROR: MissingPropertyType - src/Util/Installation.php:12:22 - Property Concrete\Console\Util\Installation::$pathCache does not have a declared type - consider array{application: array, core: array} (see https://psalm.dev/045)
    protected static $pathCache = [

------------------------------
57 errors found
------------------------------
178 other issues found.
You can display them with --show-info=true
------------------------------

Checks took 1.09 seconds and used 8.096MB of memory
No files analyzed
Psalm was able to infer types for 93.8492% of the codebase

@KorvinSzanto
Copy link
Member

Yes very bizarre, I wonder if it's attempting to only alert on changed files

@mlocati
Copy link
Contributor Author

mlocati commented Sep 30, 2021

We could try to rm -rf .git to see what happens

@KorvinSzanto
Copy link
Member

Looks like removing the .git breaks the upload step and still doesn't show any failures for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

psalm does not detect errors

2 participants