Skip to content

Commit f3d06fc

Browse files
committed
tidy up
1 parent 63d9607 commit f3d06fc

File tree

2 files changed

+7
-63
lines changed

2 files changed

+7
-63
lines changed

composer.lock

+1-58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/posts/2023/2023-12-28-3-signs-your-project-is-becoming-legacy-arrays-creep.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,18 @@ After 2 hours of digging into code, we learn that:
7575
* in another `array<string|null>`
7676
* and in another `array<string|false>`
7777

78-
You want to quit such a project, right? There is a way out.
78+
You want to quit such a project, right? Wait, there is another a way out.
7979

8080
<br>
8181

8282
You might be thinking, "Let's refactor the array to collections." It is also a way, but it takes more energy, more studying, and most importantly - much more than 1 line.
8383

84-
Our job is to deliver for a reasonable price, so I always aim for cost-effective solutions.
84+
**Our job is to deliver for a reasonable price, so I always aim for cost-effective solutions.**
85+
8586

8687
## The Single Line
8788

88-
I learned the following approach from a friend of mine about 10 years ago, way before PHP 7.0 with type declarations was released. Simple but effective.
89+
I learned the following approach from a [friend of mine](https://www.outofdark.com/) about 10 years ago, way before PHP 7.0 with type declarations was released. Simple but effective.
8990

9091
**Validate with assert**. I don't mean the native `assert()` native function that is often disabled in php config. I mean assert PHP package, like `webmozart/assert`, that fails hard with an exception not correct:
9192

@@ -99,9 +100,9 @@ public function __construct(array $codes)
99100
}
100101
```
101102

102-
They used this approach 10 years and I was thinking "lol, what an anxious approach to coding, they're so afraid they have to check everything".
103+
They used this approach 10 years ago and I was thinking "lol, what an anxious approach to coding, they're so afraid they have to check everything".
103104

104-
Little did I know, nowadays, with similar projects, **I'm the one who checks everything because I have to manually verify the exact type of each variable. Those guys are already working on the 20th project and keep delivering.
105+
Little did I know, nowadays, with similar projects, **I'm the one who checks everything because I have to manually verify the exact type of each variable**. Those guys are already working on the 20th project and keep delivering.
105106

106107
This takes about **half of our focus while working with projects** in [Rector upgrade team](https://getrector.com/hire-team) projects.
107108

0 commit comments

Comments
 (0)