تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

Introducing Error Detection0:00

Let's figure out how to do error detection. So, for example, imagine somewhere, it doesn't matter, if we have some kind of gibberish code. Maybe we forgot a semicolon, or maybe we have too many parentheses. Things like that. How can we have a way to automatically detect that? Okay, let's set that up. But first, really quickly, I'm going to hit command + comma. And personally, I actually like my padding bottom and top. Think of that as the line height, to be a little bit larger. Maybe five.

Installing SublimeLinter Packages0:28

Think of that as the line height, to be a little bit larger. Maybe five. So I will hit Shift + Command + P, and let's install a package called sublime-linter. Okay, cool, we have that. And then also we want an extension for that, the PHP one. So install sublime-linter-php. That's the one we want. Okay, great. Now, right off the bat, we'll see a little warning here, which is great. So let's go ahead and add a semicolon.

Seeing Live Lint Warnings0:51

Now, right off the bat, we'll see a little warning here, which is great. So let's go ahead and add a semicolon. And remove the ( and ). And we see it disappear. Pretty nice, right? That just automatically runs. Now, what's really nice about this, at least in my opinion, is it's just instant. So if I accidentally leave off a (, it just automatically shows up. Or let's do this again, where I say if $request thing, then continue on. Well, it automatically picks up on that.

Fixing Errors on Save1:58

But as soon as I save it, you'll see a little pop-up. So for example, let's do a handful of mistakes here. name equals Joe, no semicolon. If id, too many equal signs, like so. Okay, so now, if I save my file, it'll take me to that mistake. Fix it, save it. It'll take me instantly to the next mistake. Save it. You get the basic idea here. And yeah, that's it.

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟