From the course: Building PHP Applications with Generative AI
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Creating Doc Blocks
From the course: Building PHP Applications with Generative AI
Creating Doc Blocks
- [Instructor] Docblocks describe functions, what they do, the arguments they take, and what they return. There are lots of tools that help us generate these for our code, but AI, especially GitHub's Copilot with VSCode come in very handy here. Let's document the person class we've been using, and this is where Copilot is pretty great. I'm going to highlight the get_age function here, click on the two stars, and then type /doc. This is going to generate a docblock for us. And you can see this one is pretty simple, doesn't accept any parameters, returns and int, and it tells us what the function does. So I'm going to accept this. I'll do the same thing for the constructor and, in fact, something else it does really well here is, I can highlight multiple functions. Click the two stars, click doc, and then it'll generate docblock for all of those functions. So you can see that it actually documented the entire class here, which is a bit strange 'cause I didn't highlight the whole class…