<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule-e7vrqq2fn" -->

---
title: Stop Repeating Yourself in Code Review: Build a Custom...
description: Scott Keck-Warren demonstrates how to build a custom Mago lint rule to enforce framework-specific import conventions in PHP codebases, such as requiring...
canonical: https://daily.dev/posts/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule-e7vrqq2fn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Stop Repeating Yourself in Code Review: Build a Custom Mago Lint Rule | daily.dev
og:description: Scott Keck-Warren demonstrates how to build a custom Mago lint rule to enforce framework-specific import conventions in PHP codebases, such as requiring...
og:url: https://daily.dev/posts/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule-e7vrqq2fn
og:image: https://api.daily.dev/og/posts/e7VRqQ2Fn.png
og:image:alt: Stop Repeating Yourself in Code Review: Build a Custom Mago Lint Rule
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop Repeating Yourself in Code Review: Build a Custom Mago Lint Rule

**[PHP Architect](https://daily.dev/sources/phparchitect)** · [@shocm](https://daily.dev/shocm) · 1 min read · 0 upvotes · 0 comments

## Summary

Scott Keck-Warren demonstrates how to build a custom Mago lint rule to enforce framework-specific import conventions in PHP codebases, such as requiring Illuminate\Support\Carbon instead of Carbon\Carbon. The walkthrough covers writing the rule test-first so unwritten team conventions get codified into an automated check that runs before code reaches CI, rather than being repeated manually during code review.

## Content

Every team has rules that live in someone's head instead of in a tool. In this article, Scott Keck-Warren walks through building a custom Mago lint rule to catch framework-specific import violations — like using Carbon\Carbon instead of Illuminate\Support\Carbon — test-first, before they ever block CI.

https://www.phparch.com/2026/08/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule/

---

Tags: [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel), [#code-review](https://daily.dev/tags/code-review)

[View this post on daily.dev](https://daily.dev/posts/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule-e7vrqq2fn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule-e7vrqq2fn","headline":"Stop Repeating Yourself in Code Review: Build a Custom Mago Lint Rule","text":"Scott Keck-Warren demonstrates how to build a custom Mago lint rule to enforce framework-specific import conventions in PHP codebases, such as requiring Illuminate\\Support\\Carbon instead of Carbon\\Carbon. The walkthrough covers writing the rule test-first so unwritten team conventions get codified into an automated check that runs before code reaches CI, rather than being repeated manually during code review.","url":"https://daily.dev/posts/stop-repeating-yourself-in-code-review-build-a-custom-mago-lint-rule-e7vrqq2fn","datePublished":"2026-08-29T16:06:34.165Z","dateModified":"2026-08-29T16:06:51.287Z","author":{"@type":"Person","name":"Eric Johnson","url":"https://daily.dev/shocm","image":"https://media.daily.dev/image/upload/s--EPMJ-a-K--/f_auto/v1755890250/avatars/avatar_y7ct3dSEp45NFSALYHve6?_a=BAMClqZW0","description":"PHP Architect team member. I am powered by 16-year-old single malt Scotch and baseball.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":300}},"image":"https://media.daily.dev/image/upload/s--89yIUBYb--/f_auto/v1788019594/posts/e7VRqQ2Fn?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/phparchitect","name":"PHP Architect"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PHP Architect","item":"https://daily.dev/squads/phparchitect"},{"@type":"ListItem","position":3,"name":"Stop Repeating Yourself in Code Review: Build a Custom Mago Lint Rule"}]}
```

