Skip to content

fix: update psalm and fix its errors - #218

Closed
cristianscheid wants to merge 2 commits into
masterfrom
fix/noid/update-psalm
Closed

fix: update psalm and fix its errors#218
cristianscheid wants to merge 2 commits into
masterfrom
fix/noid/update-psalm

Conversation

@cristianscheid

@cristianscheid cristianscheid commented Jun 30, 2026

Copy link
Copy Markdown
Member
  • Resolves:

Summary

Fixes psalm errors.

  • updated vimeo/psalm to ^6.16 to fix following error:
Uncaught RuntimeException: PHP Error: Using null as an array offset is deprecated, use an empty string instead in /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php:211 for command with CLI args "./vendor-bin/psalm/vendor/bin/psalm --threads=1 --threads=1 --monochrome --no-progress --output-format=github" in /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/ErrorHandler.php:75
Stack trace:
#0 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/Call/MethodCallAnalyzer.php(211): Psalm\Internal\ErrorHandler::{closure:Psalm\Internal\ErrorHandler::installErrorHandler():68}(8192, 'Using null as a...', '/home/runner/ac...', 211)
#1 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(211): Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Context), true, NULL)
#2 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(90): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Context), false, NULL, false, NULL, false)
#3 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/Expression/AssignmentAnalyzer.php(243): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\MethodCall), Object(Psalm\Context))
#4 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(501): Psalm\Internal\Analyzer\Statements\Expression\AssignmentAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\PropertyFetch), Object(PhpParser\Node\Expr\MethodCall), NULL, Object(Psalm\Context), NULL, Array, NULL)
#5 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(203): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyzeAssignment(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Assign), Object(Psalm\Context), true)
#6 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/Statements/ExpressionAnalyzer.php(90): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::handleExpression(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Assign), Object(Psalm\Context), false, Object(Psalm\Context), true, NULL, false)
#7 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(563): Psalm\Internal\Analyzer\Statements\ExpressionAnalyzer::analyze(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Expr\Assign), Object(Psalm\Context), false, Object(Psalm\Context), true)
#8 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/StatementsAnalyzer.php(197): Psalm\Internal\Analyzer\StatementsAnalyzer::analyzeStatement(Object(Psalm\Internal\Analyzer\StatementsAnalyzer), Object(PhpParser\Node\Stmt\Expression), Object(Psalm\Context), Object(Psalm\Context))
#9 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FunctionLikeAnalyzer.php(511): Psalm\Internal\Analyzer\StatementsAnalyzer->analyze(Array, Object(Psalm\Context), Object(Psalm\Context), true)
#10 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(1859): Psalm\Internal\Analyzer\FunctionLikeAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Internal\Provider\NodeDataProvider), Object(Psalm\Context))
#11 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ClassAnalyzer.php(447): Psalm\Internal\Analyzer\ClassAnalyzer->analyzeClassMethod(Object(PhpParser\Node\Stmt\ClassMethod), Object(Psalm\Storage\ClassLikeStorage), Object(Psalm\Internal\Analyzer\ClassAnalyzer), Object(Psalm\Context), Object(Psalm\Context))
#12 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/FileAnalyzer.php(201): Psalm\Internal\Analyzer\ClassAnalyzer->analyze(Object(Psalm\Context), Object(Psalm\Context))
#13 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(1587): Psalm\Internal\Analyzer\FileAnalyzer->analyze()
#14 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(518): Psalm\Internal\Codebase\Analyzer->analysisWorker(0, '/home/runner/ac...')
#15 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Codebase/Analyzer.php(272): Psalm\Internal\Codebase\Analyzer->doAnalysis(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 1)
#16 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php(538): Psalm\Internal\Codebase\Analyzer->analyzeFiles(Object(Psalm\Internal\Analyzer\ProjectAnalyzer), 1, false, true)
#17 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/src/Psalm/Internal/Cli/Psalm.php(379): Psalm\Internal\Analyzer\ProjectAnalyzer->check('/home/runner/ac...', true)
#18 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/vimeo/psalm/psalm(9): Psalm\Internal\Cli\Psalm::run(Array)
#19 /home/runner/actions-runner/_work/globalsiteselector/globalsiteselector/vendor-bin/psalm/vendor/bin/psalm(119): include('/home/runner/ac...')
#20 {main}
(Psalm 5.26.1@d747f6500b38ac4f7dfc5edbcae6e4b637d7add0 crashed due to an uncaught Throwable)
Script ./vendor-bin/psalm/vendor/bin/psalm --threads=1 handling the psalm event returned with error code 1
Error: Process completed with exit code 1.
  • after updating psalm, set ensureOverrideAttribute="false" on psalm.xml

    • this avoids MissingOverrideAttribute errors
    • did not use composer run psalm -- --alter --issues=MissingOverrideAttribute since PHP override attribute requires PHP >= 8.3.0 and phpVersion="8.1" on psalm.xml
    • this approach can also be seen on other Nextcloud repos
  • as a last step, added missing stub ocp_config_lexicon_ilexicon.php

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
@cristianscheid cristianscheid changed the title fix: update psalm and fix it's errors fix: update psalm and fix its errors Jun 30, 2026
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
* This interface needs to be implemented if you want to define a config lexicon for your application
* The config lexicon is used to avoid conflicts and problems when storing/retrieving config values
*/
#[Implementable(since: '32.0.0')]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be exposed in nextcloud/ocp already, why do we need to declare as stubs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe nextcloud/ocp is not the latest version

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching this! To be able to update nextcloud/ocp with composer update, php version in composer.json needs to be bumped from 8.2 to 8.3:

// composer.json at root of app
"platform": {
    "php": "8.3"
},

I understand this is needed since php 8.2 support was dropped on master. Looking at psalm.xml there is phpVersion="8.1". I wonder if we should update the version there as well or keep it as 8.1?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @come-nc or @CarlSchwan can enlighten us on that topic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This application supports 32 according to https://github.com/nextcloud/globalsiteselector/blob/master/appinfo/info.xml#L24 so it needs to support PHP 8.1. (or to drop support for 32 on master branch)
You should require nextcloud/ocp:dev-stable32 instead of nextcloud/ocp:dev-master.

@CarlSchwan

Copy link
Copy Markdown
Member

Pushed a similar fix as part of #183

@CarlSchwan CarlSchwan closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants