Lint rule to prevent html code in php files

Viewed 18

I would like to prevent developer to put Html code in php logic to force them to handle presentation layer on template engine.

I found the following code in the project and would like to set up a linter that would prevent such code commitment to repository. Is there any support such rule?

        $message = sprintf(
            'Successfully changed "%s" status for %d out of %d users.',
            $bulkStatusTitle,
            $successfulChangeUsersCount,
            $totalUsers
        ) . '<br>';

        if ($notChangedUsersCount) {
            /** @var string $notChangedIds */
            $notChangedIds = implode(', ', $notChangedUsers);
            $message .= sprintf(
                ' Status "%s" could not be changed for users %s.',
                $bulkStatusTitle,
                $notChangedIds
            ) . '<br>';
        }

Basically linter should complain about <br> something like 'Data representation should be handle by template engine'

0 Answers
Related