Skip to content

Psalm refactoring#357

Open
danog wants to merge 1 commit into
webmozarts:masterfrom
danog:psalm_refactoring
Open

Psalm refactoring#357
danog wants to merge 1 commit into
webmozarts:masterfrom
danog:psalm_refactoring

Conversation

@danog
Copy link
Copy Markdown

@danog danog commented May 11, 2026

Various psalm-related fixes:

  • Turn all @psalm-param and @psalm-return annotations into @param and @return annotations (this avoids issues where @psalm- annotations are treated as second-class and forgotten about, and thus proper types aren't even mentioned in some cases). All major IDEs already support Psalm syntax in @param and @return annotations.
  • Autogenerate and run static analysis tests for both return and non-return usages
  • Remove some invalid assertions, and move assertions that were invalidly put into @psalm-param into a proper @psalm-assertion
  • Fix native return types of the mixin
  • Add a Psalm plugin to provide properly asserted return types to all methods
  • Describe some return assertions using templates (as fallback if the plugin isn't installed)
  • Fix template-based assertions in the mixin

@danog danog force-pushed the psalm_refactoring branch 2 times, most recently from 960e473 to 7bab1ae Compare May 11, 2026 09:00
Comment thread bin/src/MixinGenerator.php Outdated
Comment on lines +354 to +402
$type = Assert::isInstanceOf($type, ReflectionNamedType::class);
if (!$type instanceof ReflectionNamedType) {
throw new RuntimeException(sprintf(
'Expected a "%s" instance, got "%s".',
ReflectionNamedType::class,
get_debug_type($type)
));
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Refactoring artifact, fixed

@danog danog force-pushed the psalm_refactoring branch from 7bab1ae to 028db22 Compare May 11, 2026 16:13
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.

2 participants