Improve php cs fixer rules #823

Merged
cooperaj merged 11 commits from cooperaj/kbin-core:symfony-ruleset-not-strict-enough into develop 2023-09-12 14:14:47 +00:00

Quite frankly the idea that the @Symfony ruleset does not include strictness checks horrifies me.

Quite frankly the idea that the @Symfony ruleset does not include strictness checks horrifies me.

Please allow risky in config file instead, run the fixer and verify nothing can break in fixed files

Please allow risky in config file instead, run the fixer and verify nothing can break in fixed files
cooperaj changed title from Improve php cs fixer rules to WIP: Improve php cs fixer rules 2023-07-20 15:27:22 +00:00
cooperaj changed title from WIP: Improve php cs fixer rules to Improve php cs fixer rules 2023-07-20 16:35:05 +00:00

Why remove my todo comment?

Why remove my todo comment?
Poster
Owner

oh, mostly cause i didn't consider it to apply anymore? cs fixer is a linter, it just runs in fix mode by default.

i can add it back but should probably have a ticket created to track it. numberless todos in code bases rarely get fixed and are mostly forgotten without a ticket.

oh, mostly cause i didn't consider it to apply anymore? cs fixer is a linter, it just runs in fix mode by default. i can add it back but should probably have a ticket created to track it. numberless todos in code bases rarely get fixed and are mostly forgotten without a ticket.

if you run the fixer right now on the /src directory what output are you getting?

we spoke about running this tool in my ticket here: #802 (comment)

In that case it removed the '?' on the properties of the class. if this is the expected case then that's fine.

I've tried running this for my PR and it still

if you run the fixer right now on the /src directory what output are you getting? we spoke about running this tool in my ticket here: https://codeberg.org/Kbin/kbin-core/pulls/802#issuecomment-992318 In that case it removed the '?' on the properties of the class. if this is the expected case then that's fine. I've tried running this for my PR and it still
Poster
Owner

In that case it removed the '?' on the properties of the class. if this is the expected case then that's fine

it looks like this is an explicitly configured rule under the @Symfony preset.

> In that case it removed the '?' on the properties of the class. if this is the expected case then that's fine it looks like this is an explicitly configured rule under the @Symfony preset.
cooperaj force-pushed symfony-ruleset-not-strict-enough from 5c7e753a49 to 165817cd19 2023-07-21 09:46:19 +00:00 Compare
cooperaj force-pushed symfony-ruleset-not-strict-enough from 165817cd19 to 118522ac3f 2023-07-21 22:16:52 +00:00 Compare
cooperaj force-pushed symfony-ruleset-not-strict-enough from 118522ac3f to 4b06c7efe7 2023-07-22 13:15:41 +00:00 Compare
cooperaj force-pushed symfony-ruleset-not-strict-enough from 4b06c7efe7 to 6d172f0500 2023-07-22 16:53:46 +00:00 Compare
cooperaj force-pushed symfony-ruleset-not-strict-enough from 6d172f0500 to f00800eeb6 2023-07-23 13:53:32 +00:00 Compare

oh, mostly cause i didn't consider it to apply anymore? cs fixer is a linter, it just runs in fix mode by default.

i can add it back but should probably have a ticket created to track it. numberless todos in code bases rarely get fixed and are mostly forgotten without a ticket.

Yea OK agreed. PHP-CS-Fixer is both a linter and a formatter.

> oh, mostly cause i didn't consider it to apply anymore? cs fixer is a linter, it just runs in fix mode by default. > > i can add it back but should probably have a ticket created to track it. numberless todos in code bases rarely get fixed and are mostly forgotten without a ticket. Yea OK agreed. PHP-CS-Fixer is both a linter and a formatter.
melroy89 approved these changes 2023-07-23 20:14:52 +00:00
ernest added the
backend
label 2023-07-28 14:37:23 +00:00
cooperaj force-pushed symfony-ruleset-not-strict-enough from f00800eeb6 to fcdc69cadf 2023-08-11 11:14:56 +00:00 Compare
cooperaj force-pushed symfony-ruleset-not-strict-enough from fcdc69cadf to ab26a3b5a8 2023-08-16 09:35:19 +00:00 Compare
cooperaj force-pushed symfony-ruleset-not-strict-enough from ab26a3b5a8 to d278c1b4e3 2023-09-10 16:59:38 +00:00 Compare

@cooperaj Let's fix the failed job again. And merge?

@cooperaj Let's fix the failed job again. And merge?
cooperaj force-pushed symfony-ruleset-not-strict-enough from d278c1b4e3 to 953473ce2f 2023-09-12 14:12:07 +00:00 Compare
cooperaj added 1 commit 2023-09-12 14:13:03 +00:00
Kbin CI/CD pipeline / unit-test (pull_request) Successful in 21s Details
Kbin CI/CD pipeline / build (pull_request) Successful in 39s Details
Kbin CI/CD pipeline / fixer-dry-run (pull_request) Successful in 28s Details
fa8896c970
Update with phpcs fixes
cooperaj merged commit e3eb627b8e into develop 2023-09-12 14:14:47 +00:00
cooperaj deleted branch symfony-ruleset-not-strict-enough 2023-09-12 14:14:56 +00:00

Great. done.

Great. done.

Unfortunately, adding strict_types everywhere caused a few methods to start throwing exceptions. KbinQueryAdapter::getNbResults apparently serializes its values to json to create a cache key, and if that json serialization fails, it previously did not throw an exception. The json serialization failures occurred when serializing User entities, so adding JsonSerializable to the User entity should fix the issue.

I'll be creating a PR adding those fixes soon.

Unfortunately, adding strict_types everywhere caused a few methods to start throwing exceptions. KbinQueryAdapter::getNbResults apparently serializes its values to json to create a cache key, and if that json serialization fails, it previously did not throw an exception. The json serialization failures occurred when serializing User entities, so adding JsonSerializable to the User entity should fix the issue. I'll be creating a PR adding those fixes soon.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Kbin/kbin-core#823
There is no content yet.