Tom McFarlin

Software, Development, and WordPress

Resolving PHP and PHP CodeSniffer Errors

macOS is still shipping with PHP (though how this looks for future versions of the OS is likely going to change in some way.).

Anyway, imagine you’re in a situation where you’re working on a project that requires three different components:

  1. PHP,
  2. A set of coding standards,
  3. PHP CodeSniffer that work with said coding standards,
  4. The inability to properly see results of sniffing the code either in your terminal or your IDE.

When this happens, this is almost always a result of a version of PHP, the version of the various dependencies, and making sure they all play well together.

In short, it’s about making sure the tools like PHP CodeSniffer work well with the same version of PHP you have installed. And in this case, the latest and greatest isn’t necessarily the best course of action.

It is, however, close. And in the following steps, you should be able to get everything working exactly as needed for your specific set up.

Continue reading

Going Nuclear For Unalloyed Benefit

Before I Start

The longer I’ve kept this post in draft, the more work I’ve been doing to try to edit it to make it sound better than it actually does. And one of the things I dislike about blogging for myself, at least, is when I spend too much time trying to write something that doesn’t really sound like me.

And that’s what this post is in danger of becoming. So forget about it. For the sake of hitting publish, I’m going to share what I have and then go with it. No perfect time like the present to hit publish, I suppose.

Okay, Let’s Go

A couple of weeks ago, I came across the phrase “unalloyed benefit” when reading this post:

No half measures here; ditch your habits without abandon and only add back in the things that contribute an unalloyed benefit to your life.

Cal Newport

“Unalloyed benefit,” I thought. And kept thinking. That sounds good. I want that (or at least to aim for that). But here’s the self-deprecating truth: I’d never read those two words together.

  • Unalloyed: Complete; unqualified.
  • Benefit: Something that promotes or enhances well-being; an advantage.

Yes, please.

But let me back up for a moment: It’s been a long time – in Internet time, at least – since I’ve written anything here. That’s a bummer for me because it’s something I really enjoy doing.

Further, it’s been a while since I’ve written a a long-form post. Granted, I try not to do that since it either comes off as rambling, too long, or not as interesting. And maybe this is going to be the same or maybe this is the exception or maybe it’s one of those Schrödinger’s posts where it’s both – its state just depends on who you are.

Further, I was going to publish this in September but there’s no real compelling reason to do so. So here it is.

Continue reading

Setting Up PHP CodeSniffer Per Project

A few years ago, I wrote a post about Setting Up PHP CodeSniffer in Visual Studio Code (and I’ve recently updated it, too).

But it’s been four years since that post was originally written and, in that time, a lot can change in terms of how we write code.

Four years is roughly an Internet Age, isn’t it?

Anyway, the basic points of that article still stand, but if you’re working on a variety of projects and some of them require different configurations, settings, and standards, then the way you go about installing and configuring PHP CodeSniffer may be different than how you configure it on a system-level.

So if you’re in that position, here’s how you can configure PHP CodeSniffer on a per project basis using Visual Studio Code.

Continue reading

Awesome WP-CLI: A First-Rate Starting Place

One of the more challenging aspects of working with WordPress is working the fragmented nature of documentation. And I don’t necessarily mean the Codex nor do I mean the Developer Resources.

But I mean the fact that there’s a ton of information spread across blogs (mine not exempt), subreddits, questions and answers on Stack Exchange, and shares via Twitter, and so on.

I’m not making a case that this is inherently bad or good but I am making the case that when given the opportunity to provide a central repository of information for a feature, set of APIs, or tools that it can be extremely helpful especially if it’s written an maintained by the author of something like one of the aforementioned issues.

Case in point: WP-CLI and Alain Schlesser.

Continue reading

Building Assets, Merging Git Branches, and Creating Releases

Everyone has a different git workflow set up but for the purposes of this post, assume that you’ve got something like the following:

  1. A branch in which all of your assets, unbuilt, reside.
  2. A system of continuous integration that builds the assets and creates a new branch or perhaps a new version.
  3. A branch that’s created by the continuous integration system that contains the built assets.

The main component of this workflow is the continuous integration system. That is, if it fails, then the work responsible for building the assets and creating a new branch no longer work.

And when that happens, we’re left having to do it manually. It’s tedious, sure, but not difficult. If you find yourself in this position, here’s how you can go about building assets, merging git branches, and creating a versioned release.

Continue reading
« Older posts

© 2020 Tom McFarlin

Theme by Anders NorenUp ↑