Skip to content

Add type declarations, final classes, and modern PHP patterns#7

Merged
alganet merged 1 commit intoRespect:masterfrom
alganet:modernize-php
Mar 15, 2026
Merged

Add type declarations, final classes, and modern PHP patterns#7
alganet merged 1 commit intoRespect:masterfrom
alganet:modernize-php

Conversation

@alganet
Copy link
Member

@alganet alganet commented Mar 15, 2026

Type declarations:

  • Add typed properties to all classes (SplObjectStorage, array, ?string, mixed, bool, ?AbstractMapper, ?Collection)
  • Add return types to all methods (static, void, bool, mixed, string, ?string, array, RecursiveIteratorIterator)
  • Add parameter types throughout all interfaces and implementations
  • Replace array() with [] and new self() with new static()
  • Fix test mocks to return correct types

Modern patterns:

  • Mark leaf classes final: CollectionIterator, Filtered, Mix, Typed, CakePHP, NorthWind, Plural, Sakila
  • Use arrow function in AbstractStyle::separatorToCamelCase
  • Remove unnecessary nullable from CollectionIterator::getChildren

Raise PHPStan to level 5.

Type declarations:
- Add typed properties to all classes (SplObjectStorage, array,
  ?string, mixed, bool, ?AbstractMapper, ?Collection)
- Add return types to all methods (static, void, bool, mixed,
  string, ?string, array, RecursiveIteratorIterator)
- Add parameter types throughout all interfaces and implementations
- Replace array() with [] and new self() with new static()
- Fix test mocks to return correct types

Modern patterns:
- Mark leaf classes final: CollectionIterator, Filtered, Mix,
  Typed, CakePHP, NorthWind, Plural, Sakila
- Use arrow function in AbstractStyle::separatorToCamelCase
- Remove unnecessary nullable from CollectionIterator::getChildren

Raise PHPStan to level 5.
@alganet alganet marked this pull request as ready for review March 15, 2026 01:48
@alganet alganet merged commit ed0b702 into Respect:master Mar 15, 2026
2 checks passed
@alganet alganet deleted the modernize-php branch March 15, 2026 01:48
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.

1 participant