Skip to content

ProjectTransition: Use properties in constructor, not array.#1596

Open
bpfoley wants to merge 1 commit into
DistributedProofreaders:masterfrom
bpfoley:pt-default
Open

ProjectTransition: Use properties in constructor, not array.#1596
bpfoley wants to merge 1 commit into
DistributedProofreaders:masterfrom
bpfoley:pt-default

Conversation

@bpfoley

@bpfoley bpfoley commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

This way is a bit denser, but more importantly, allows phpstan to statically check the types of all the arguments.

While here, tighten up the types:

  • disabled_during_SR = null doesn't diff from false.
  • Make all the properties readonly.

@bpfoley

bpfoley commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

Test environment at https://www.pgdp.org/~bfoley/c.branch/pt-default

'settings_template' => '',
'collateral_actions' => null,
]
project_restriction: null,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thoughts on not including the null ones in the definitions since that's the default value? It would make it more denser and perhaps make it easier to see what's unique about each of the definitions.

I'm on the fence about the idea but thought I'd toss it out there.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ACK. I thought about removing all the defaults, but I figured you had them in there for a reason, and they might be explicitly there to make it easier for the skim-reader. I'm happy to go either way.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This code predates my time at DP so it's been there for a while. Let's leave it like you have it.

Comment thread pinc/ProjectTransition.inc Outdated
@cpeel cpeel requested a review from srjfoo July 12, 2026 15:58
@bpfoley bpfoley force-pushed the pt-default branch 3 times, most recently from a296c96 to f9e8848 Compare July 12, 2026 16:44
This way is a bit denser, but more importantly, allows phpstan
to statically check the types of all the arguments.

While here, tighten up the types:
* disabled_during_SR = null doesn't diff from false.
* Make all the properties readonly.
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