all right so we love to cover somebody
get started on time here and people come
in late they can just kind of find a
seat so this is getting the most out of
each piece or burger plate obviously
with your plate is all object oriented
it's based on symphony so there's a lot
of differences between on your blade and
ripple Simon between procedural and our
target so it really changes how you use
your ID and how effectively your ID can
like make your day easier so we're
taking over a lot of the bass nut basics
but more as intermediary shortcuts and
screens and like things like XD bug
things that are you know you don't
necessarily need but make life easier
first a little bit about me I've been
working at digital bridge solutions for
just over two years now
I'm a senior developer they're mainly
focused on beautiful and recently aura
which is also a symphony based platform
my Google name and getup name is
controller lay down the slides will be
available later under my github and
we're actually viewing the same slides
that will be up there so there's so many
changes I don't have a personal Twitter
but feel free to treat my company deeper
in Chicago if you feel like shouting out
to us with me some don't get it back to
me not a little bit about you guys so
how many of you are currently using PHP
storm and how many of you currently had
the Drupal code styles that PHP storm
that's not good
all right is it I think it asks you to
set it if it all goes like this it will
yeah but if it doesn't you can also go
in the Senate manually does what it
provides actually meet all the it meets
the generic like syntax standards like
spaces tabs to spaces that for new lines
new lines with brackets where there
should be so yeah that's all good
how many of you are currently using ax
debug alright now as many people and how
many are using or using any kind of code
testing static analysis or sniffing when
you commit do repos alright in fewer so
those those are really nice they keep
repos nice and clean and the most
annoying part about using phpstorm well
is colleagues that don't use it well
because your ID starts looking really
cluttered from people committing stuff
that doesn't match what phpstorm was
expecting and the automated code testing
is sniffing just really helps with that
because it it forces those standards
across entire repo alright so plugins
that I have in phpstorm
that we'll be seeing today get I know a
lot of people use get on the command
line I personally do like 80% of my get
through phpstorm I find the interface
really intuitive and it does all the
easy things for me so there's no reason
to use the command line really
dalek nor and that ignore Gray's Alec
files that are ignored in the repo so
you know if you're editing something
that you know isn't going to be
committed
the symphony plug-in and the Drupal
Symphony bridge both of these are
plugins that make or integrate Symphony
into PHP storming provide a lot of
autocomplete dating and I'll I think
it's mostly just Auto completing various
and various singers one note about these
is the simply plug in those have to be
turned on for every project you can't
just turn it on in phpstorm so you have
to go in and turn on every time and
we'll go over that once I get into a PHP
storm PHP annotations is required by
symphony there's some people again and
that provides all the completes inside
about the annotation blocks inside if
you played and and keep them rotor X so
this is what I'm actually installed to
help me with this presentation what it
does is anytime it sees you doing
something that there's a shortcut for it
prompts you to use the shortcut well it
tells you that you could use the
shortcut and how many times you've
clicked instead of using a shortcut so
you'll see that popping up in the bottom
right of my phpstorm so first we're just
going to do a quick overview I'm not
gonna notice too much detail and one
note about this presentation the slides
are mainly for reference most of the
value will be like going through
phpstorm itself so if you can't read
something on the slide don't really
worry about it because we'll be doing it
in phpstorm
so first the tool window so you're going
to view tools windowed version control
it'll pop up without a window that shows
all to get information so view tool
windows version control and you can see
I have my get history here for this repo
and if I click on welcome its it pulls
up what's been changed and we do control
D it pulls up the dip for that specific
file and you can see I changed some text
in here
but also the see manager branches so see
where your branches are narrow narrow by
branch so that's the quick overview does
merging and pulling and rebasing I like
this stuff I do really enjoy the merge
resolution because it does a three pane
resolution where you get yours on the
left the server on the right and you
combine them in the middle and it does
the diff highlighting like character by
character so it does this as well or
highlights exactly what changed in the
line which makes it super easy to just
click things over into the middle file
and resolve everything
history we went over local history all
right so this isn't related to get but
phpstorm does attract the local local
file changes as you make them so if
you've made if you know you have a good
state in your file somewhere and you've
changed a bunch of things and you can't
remember how far back you have to go
with on do you can open up local history
show history and these are all the
various changes I've made over the past
hour getting ready for the ready for
this presentation this has been a bit
Aniki for me between sessions
so if PHP sort of closes unexpectedly or
the runs out of memory or something like
that this sometimes disappears so don't
rely on it entirely it's a really great
reference point or if you knew you had
something working at some point and you
just want to go back to it and you can
see this goes back all the way to
yesterday at 10:17 when I created the
repo
like I said that control-d any any blue
or green file and the local changes here
open up the diff also right-click
the history and that if
munching sniffing so this is probably
one of the most useful things do you
really get you in tune with what the
truthful coding standards really are
because it will really complain to you
that you're doing something wrong right
now well so peach BCS is peach pico
zippered which enforces the sniffing
standards for drupal if you download the
Drupal coder module I believe it is it
has a PHP CSS rule setting for Drupal
which is great and I've linked in
installation instructions they're fairly
simple but a little bit involved with
composer and Simulink and that kind of
stuff so I won't go over it in detail
but we can see right now I have some
pretty basic issues with this file we
drug this like it's telling me I'm not
declaring about the 19 I need to and
leave this the only issue is showing me
and I have some typos but if I go to
settings which is HP so this is the
wrong area for sniffing but symphony Wow
turn on you just go here so PHP Symphony
enable and make sure to change your web
directory some some hosts do web some
dude a fruit
Okwe does doctorate this is an aqueous
site so absent-minded doctor
editor because I know there we go editor
your Co style inspections peach because
it's never so once you install code
error correctly Drupal pop up here just
luck that
some people like to set this as air
instead of warning but I personally like
to take the air for things that actually
break the sight and warning for things
that are nice to fix but not necessary
so we turn that on and you can see right
now
now I was complaining that I'm exceeding
the line length limit you can is
complaining that there must be an
oblique line after an inline comment it
should be complaining that there's no
new line found so really this is all
some tactical stuff but it feeds up the
code and makes it a lot easier to look
at so we get rid of that great this up
we still have six feet for this phone
don't tell me this is indented correctly
it should be that there we go and put
these on your mind
alright that's good enough so if we get
rid of this because it needs that later
you can see this is this looks a lot
prettier than when we started
and phpstorm is obviously a lot happier
and it's a bit more obvious if you're
using a darker theme for the week
weddings are because are highlighted in
yellow by default day to day I have a
very dark theme but white is better
contrast for the projector style hunting
so you can do PHP code linting and then
there's a CSS unless it's a splitting
settlement is the Drupal standard as of
a point forward it's not available like
when there's a test run on themes and
matured modules it's not currently
available but there's an issue for it so
if will be there eventually and you can
install module for styling that or a
plug-in for styling that will highlight
all your
sdss issues according to the silent
settings personally as a front-end
developer I don't have a good feeling
for the defaults so it's nice to get
yelled at when I write a class name
wrong or use a use a hex instead of a
variable the insolence is the same thing
but for JavaScript I don't write that
much JavaScript so I haven't actually
set it up but it is available
incessant which is the one we actually
had installed on our sites it's the same
as style and just alternative and I
don't think I have MSDS file ready but
you can see right here right so color is
complaining about something field set
and like right here something there's
not gonna be a space between these or
that there's not a space between these
and really it's the same thing as HB
just keeps your style sheets nice and
clean and looking uniform navigating
code alright so this is where a lot of
the nice day-to-day things really our
lynching is great it makes you makes
your people look nice and clean but
really just actually work navigating
code actually gives you the answers for
your questions so searching everywhere
you can do shift shift if we want to
look up like a Content entity the
content entity class and go to that base
class open it up nice and quick
hierarchy view so if you're writing a
block class for the per block for the
first time and you want to find examples
another block you can do you can go to
this block base which the class is
extending do your controller H and it
will pull up all the other classes that
are sending this one so this is a great
way to find examples of things already
being done inside of Drupal
like the hook block it's obviously doing
quite a bit more than we're doing and
it's got quite a bit more logic inside
of our build but maybe that'd be useful
for us if we're actually building a
complex block and you can see that it
will even do like the hierarchy so this
views block base is it's lending the
block the base nerve is extending block
based but then there's other classes
that extend this one so it's showing you
that hierarchy inside the hierarchy
which is nice and you can always open up
with the base one if you want to see it
so Copic has obviously sometimes you
need to share a line of code with
somebody on your team to get their
opinion or frozen
let's check something out you can do
ctrl shift C to get the full path to the
file or you can get control or control
shift alt C you will get you path plus
the line number and that's just real
simple just like the 42 ctrl shift C and
there we go that's the relative path in
the repo which is super handy for just
pasting the slack I mean it can you
check this out or is this where I want
to be
function definitions so one of the first
things I was really annoyed about what
people ate is you go and look at a class
and like most of us added hair doc that
doesn't mean anything to me but if you
press ctrl Q on this it will just pop up
the documentation
I don't have this name frankly
all right there we go so now it's giving
us the documentation for why we're build
the built documentation is actually
found just great you can also do this on
function calls
so fan comment this do a ctrl Q I'll
tell us what this function is doing the
code I don't go look it up and now it's
on me
it should give me a link open it
yeah tell me where it is right here
that's pretty useful
I go into the function declaration so
let's say you did pull up the
documentation it wasn't enough for you
and you actually want to go to the
function you can do control B or
control-click and get to the same place
and then all right you actually we're
just function define you see the code
see what it's doing and if it's what you
wanted to be doing or if it's not
returnable you want it to return so it's
a nice way to quickly open up the code
that's actually being around find usages
so so that was finding the where the
function is fine but if you want to find
all the usages of that function you can
do alt f7 and this one's going to return
a bunch but you can see I said here's
the method we look up method calls 137
in these various files
and that wasn't the best example because
this woman only has method Falls but
it'll sort out what the different usages
are in here like the other one is like
in comments which is useful so if you're
looking for where it's called it'll be
method call as if you're looking for it
in comments that have been comments if
you're looking for word like in the
string that'll be in the string so as
breaks it up for us I'm just giving you
a list of everything you know as it
found it
most actions you can alt enter so it's
not always easy to know what's available
in phpstorm so we go back to our base
block and we do like lots of enter here
it will ask me to generate a Symphony
service I don't know if a storm would do
that for me that's cool we go here
alright so it open for the string inject
language
replace quotes alright so this will take
me to deciding to change things for
double close to single quotes apparently
and this little light bulb kind of does
the same stuff so I'd teach be common I
guess I did
that's not really useful if this was
like an entity you could say this is an
entity of block type block and then it
would start auto completing functions
for you actually so this is wrong
because markup is not a block but
phpstorm thinks it is so if we do markup
now we're getting all of the function is
for block
like gutter icons took me a while to
find this one but they are fairly useful
three have seen is ìoh i is implement so
it shows implications of parent methods
or children implementing a method so
[Music]
right
the other one is Oh which is shows of
methods overriding parent or is
overridden by a child and you tell based
on the arrows you know up or down in
this screenshot
there's narrowed down here and arrow up
here these are both oh this one is an
eye with an up arrow and the third one
is H which is folks not as relevant in
d8 but still kind of relevant it will
show you all the picking with
annotations and they'll also show you
where the book is defined so you can
open that up easily so here builders
overriding the base build and you can
see these are all the classes that
implement the building method
and if we open up in module five
so we have our hook help and we can go
up to so it'll show us where the book is
invoked it also show us the
documentation you can click on any of
those open up it's a real quick way to
kind of get to the definitions of folks
or seeing if something's being
overwritten or it method completion in
boilerplates so navigating code is fun
but eventually you have to write it and
what Stephanie comes a bit of
boilerplate code and a bit of guessing
at what name of things are and phpstorm
will help with that so first of all I
recommend Drupal console it's great for
generating things there's a lot of
generation commands it doesn't have
everything but it covers a lot it will
generate and that's the tea it'll I want
to say it'll generate a forum it'll
write a lot of code for you that you
don't necessarily need to know how to
write unless you really want to so
implementing or implement interface
methods so block base at some point
extends or implements an interface class
saying it needs this build method so if
we delete this
we do control I it'll say we should
implement the build method or these are
all that like kind of default optic ones
that you can ferment or there's a
translate apparently trait that we could
implant here so we cook this we can we
have a couple settings here maybe I can
shrink this so I'd phpdoc default copy
from base class or added her puck I was
like the third one and it just puts a
stop in for us but that's pretty useful
right if you don't know all the methods
you can implement just press control a
lot and I'll show you what's available
from the other classes
the other alternative to that is we
delete this again this is not
complaining that it's not saying all the
methods we need for extending this class
so if you press ENTER it'll add all the
method stubs for us and this one's a bit
annoying because it gives you the full
documentation that's that we write it so
like this could put in ten different
subs for you and if you don't know what
they all do having the documentation
there's handy and once you're done you
can just go ahead and hair doc and
that's that
you statements if you autocomplete
things in phpstorm
it'll add you you see it min for you so
block base you can see use pops up here
which is pretty cool
but say you copy some code in from Stack
Overflow or something and it doesn't use
but then you save in it if you we
convert this to an all Center it'll ask
us to import the class and it just kind
of assumed one we wanted but if there's
options it'll give you a drop-down you
pick which one you actually want to use
and then we do a bunch of stuff
all right
so
what I've done is I just removed the
full class name and now it just says
block so it's going to ask me to import
the class MA all right so we have this
up here down and it says it's on use and
that's because this actually isn't using
block is just kind of type in thing and
if we get rid of this entirely they'll
still say unused so we know we can
safely delete this because you don't
actually use it inside your code all to
complete options so this is by far one
of most handy things when it comes to
services and annotations and those are
the two main areas that I use them for
so you have a service and we have one
here
and it will type in I'll tell you what
the argument supposed to be from the
decorate declaration of the class and if
you kind of do a net and a control space
it'll pull every possible option for you
and there's tons of them but you can see
we're looking for intensity site manager
interface so it's kind of peach piece or
most guests at which ones we actually
want here so we want entity type manager
service and it will do the same thing
for tags so those bunch of different
tags that you can use this one's
supposed to be about subscriber let's
say you didn't know that you can control
space and because I used it recently
it's at the top here but that won't
always be the case
and just like services there's a
function them to choose from so this
kind of a great way to discover what the
valid options are for these areas if you
don't necessarily know what you're
supposed to be putting in there or maybe
you know you're referencing something it
doesn't it's not exactly the same
because like entity type manager has
changed I think in earlier versions of
Drupal 8 it's just entity manager and
then the change of density type and
there's just a small name change but it
couldn't really they're off like if
you're reading older questions or
documentation so that subscriber and
that's that the other useful part of
Auto completing is annotations so with a
block way to define our annotations if
you have no idea what's supposed to go
in here you can do control space then it
will pop up the ones that are supposed
to be in here so we need an ID
and I mean that in labor
so it's just that's another great way of
discovering valid options for this
annotation block because that can always
be difficult to kind of figure out what
what goes there
I've gotten covered annotation box
covered all right so we want what you
did the services file over there now in
this get container or container get we
can also all complete all available
services so once again great if you kind
of have an idea of what you want I don't
know the exact name
refactoring class names so if you decide
you want to reach Ange or change your
class name after you've written it and
maybe used it in a couple places a
couple other places in code because
final names do actually kind of matter
with classes you can right-click
refactor rename and would you like to be
sorted by the rate okay so that's
whatever you name your class to hit
enter and it'll ask me to rename file
and they'll also update any of the use
statements inside the code I don't have
any for this one but it will do that so
if you refactor your classes you don't
think about kind of flipping through
your code and making sure you catch
everything will do it for you
which is really nice and that's
something that's available for methods
as well I can fire your name this to
build broken broken it will look for all
the usages inside the code any time like
that classes use explicitly it'll look
up the build function to rename it to
build broken but there aren't any it's
not going to find any and inside of a
method it will do that for variables as
well so I keep I keep right-clicking but
you can shift f6
and they'll do that first either method
where is context like where that
variable is being used within this
context so if you want to kind of clean
up your code or change the name in to
make more sense phpstorm will make your
life a lot easier and update everything
for you it's pretty handy
okay and refactoring that's just the
screen we went through where I'll show
you everything is going to refactor and
why and on to X debug so this is the
really fun one my recommendation for
configuring X debug is to use something
that size it up for you I personally use
Drupal VM I believe and oval set up for
you aqua desktop I'm not sure most of
the docker images I've seen also come
with X debug it's really handy that's
kind of a pain to set up on the server
so I would recommend using something
assess it for you enabling xdebug once
you do have it on the server there's two
parts you need a browser extension to
send the piece the right X debug headers
to phpstorm then you need phpstorm
listening for those headers so we've got
my company website here
and we've got the extension and you can
see I've turned on XD bug if I turn off
this little bug goes gray and a phpstorm
well you've got this little phone here
so with the red and the green that's not
listening and now we're listening
and if you click in the gutter to set a
breakpoint
Hey broke something field open required
it's not like many names
fool
well
and this is working before the
presentation
which one do we want this one
revert
all right nothing kind of leap it should
work
and there we go all right we got next
book so when it hits the breakpoint here
it will stop and show you all the
variables available I'll show you a call
stack over here and any watches you have
set here so you can see we had this mark
up variable and then here market value
right here and then this will all the
default Drupal symfony stuff and server
server information cookie server session
all that good stuff this is really handy
for stopping right at this very specific
point and finding out the value so
instead of having to do with DPM and
refreshing page and seeing what it dumps
out you just kind of hit the big point
here and you're done
the next part is you can set multiple
and as it goes to the coda to stop it
all of them so like if you want to see
well the value is here before loop and
then you stop it immediately after the
to see what the value is that that's one
page fall instead of you know doing that
two or three times with DPM so on the
left here there's a couple of different
actions resume is it will just send
program off running again
stop stop debugging and just kill the
page request so that will like four or
four five hundred the window in the
browser this one shows you all I pick
three points in the code and you can
manage them from here
this will pause execution or pause great
points this is a super dangerous button
that can kill a lot of time so when you
click this X debug will not stop on any
of your great points in your code and
the only real notification you have is
that they turn gray and this box is
outlined in the shadow more than once I
have turned this on and then been
wondering why XD bug is not stopping my
fake points it's not a fun experience
let's turn that back on and these get
into window settings for X debug then on
the right here we have a couple of
different ones debugger is this window
console you can run some commands
literally at this point in time in the
code what was this one show execution
point so that'll take you back to the
break point if you can navigate to some
code and you're not really sure where
you've stopped step-over will take you
to the next step in the code without a
click it'll just take you to the next
step as if there was a great point there
so if we click step over here this is
what's called after the build function
completes and returns unset the little
hashtag block
step into will built into the line
you're at so when I click into this
we're going to go into the onset
function or alright so if I click this
will go into the if function
and is checking write is empty so
because we have this not element it
calls is empty a content and now we're
in the is empty function and we can
still see the values for this function
so elements and is checking if there's
anything here which there's four step
into I haven't had a lot of luck in but
this will take you into so let's say
that we're here and we want to go into
here regardless of the condition if you
for step into and it should take you
into there I don't use it all that often
I usually just hard code the conditions
if I want to get into the block but I
can't be useful and step out will take
us back so
that's two
yeah so you can see we were at this
empty and step out so goes to the next
line and if statement instead taking us
further into this right so we would we
could have gone into counts or array
keys or empty so flex debug like the
buggers are super powerful for helping
you navigate the code and seeing the
actual values that are being interpreted
at the specific times they're being
interpreted now let's say you have a
loop though and like you have a thousand
calls or a thousand things that you're
looping over well you don't want to
press resume a thousand times to get to
the 501 which is the problem so at your
break point you can right-click you can
turn them off and suspend them
individually so you can also write just
like simple if condition it's like empty
so this will only stop in this very
point if Marco is empty which is useful
if you're trying to figure out you know
if the markups empty and it's not
returning anything and that's why this
block isn't showing up so we'll resume
and not the page finishes loading and
we'll just set this completing a few
string and we'd expect this to stop now
because it is empty so because I took
too long
index debug the browser interpreted as a
this is fairly normal if you really get
into your sessions it's just kind of
part of life you have to do it to
refresh all right so it stopped because
markups empty and if we put the string
back
so yes 926
unexpected syntax
okay so that time we did not stop an XT
bug because the string is not empty so
yeah that condition is super useful if
you're going through loops or have kind
of complex conditions where you want to
stop if it's only breaking and not every
other time because there are there's
loops and there's also functions that
you called like a hundred times in page
build and you don't want to stop it all
hundred and try to figure out which one
you need to actually stop at setting
breakpoints all right you can
right-click on the gutter or not click
on the gutter and I was at the
breakpoint next about interface we went
over evaluating code so I got rid of the
condition if i refresh the page so when
you're stopped you can run any code you
want and I simply do it through
right-clicking in here evaluate
expression and you can literally run
anything so we just wanna get to buy up
markup which is really simple whatever
if we want to do like Drupal get
container and we want to get some
container I don't actually know what the
head maybe
oh I don't like it but you can write any
code you want in here and get the value
up it doesn't have to be related to
where you're stopped at all
you have the full of people bootstrap
that will return whatever it would
return if you wrote it in the code so
this is useful if you're trying to like
figure out how to navigate and that's T
or you trying to figure out if you need
a to string or a value function because
you can just check immediately like try
it three or four times without repeating
the refresh on the page and you know
stopping or changing your code so that's
evaluating expection expressions the
other thing to do is actually change the
value of your variables so if I
right-click and do set value
I've just added some text to the Marco
string so now when we hit resume we're
going to see that text on the page even
though the code even though the code
hasn't changed a phpstorm
it's showing up on page because we
changed it MIT process so if you really
want to make it live at it and see well
what would happen if this value is this
instead of this just do it in there and
it will evaluate as if that's what
happened before before you got to that
breakpoint vendor mapping so this is a
word of warning vendor isn't always
mapped if you're trying to set great
points inside offender so like inside of
a symphony or I don't think there's an
issue might be an issue with Drupal
modules but I don't remember anyways if
you go to settings
as usual languages in fingers please be
the bug no servers so here you can see
there's some mapping information this is
the local domain that I'm using and then
we have the file directory so this is in
phpstorm and this is the path to it on
the server so like because phpstorm
won't always make the connection to
vendor correctly I can set this to
that's not a Kurdish vendor and that'll
make sure that when xdebug is running
and knows where to find the code and
they don't hit the breakpoints inside
that code otherwise the mappings just
kind of mapping could not be set and
then actually bug doesn't know where to
stop so if you ever get a message on the
right or maybe it'll show me very fresh
so when that happens
yeah I don't have fun here it will pop
up an error message that says files may
not be mapped correctly that's when you
want to go in and make sure you're
mapping the very pointy files correctly
it also show up in this variables thing
if you set a breakpoint beforehand and
that's just one of those catches this
nice know about why breakpoints aren't
being hit inside the vendor
any questions on XD bug because that's a
very tough topic yes this might be
related to my Lando configuration but
when I try to set it up I've had a
situation where I was using
configuration for a new site that was
the same as the old though just with the
updated site name and everything it
wouldn't start for like three hours like
I was I just gave up on it and did
something else I came back and suddenly
asked if I was working does it take a
lot of memory or liquid
oh yeah that's actually a really good
point so X debug does slow down
page B and in extreme cases I heard 3
hours but it has turned like a minute :
- a 5-minute call or a minute call into
a 10-minute call and what I've noticed
the most is it depends on the number of
PHP files is trying to get through and
typically there's not really good answer
that because you are using a debugging
tool it's going to slow things down but
it's good to know that like if your
little pulse though and you're not using
X debug turn it off but you do have to
be like go into PHP D my peach beat that
any settings and actually turn it off
you can't just turn off the browser
extension and PC storm because it will
still be running on the server or like
on your site so yeah if you're having
performance issues next bug could be
hope for it
so this is kind of a bonus section
hatching so with the 8 there's a lot of
active film we going on which means
sometimes you need to apply patches to
your codebase from controller for and
phpstorm will do that for you I do
highly recommended like if you're gonna
be patching things to use the composer
patches package and what that does is in
your composer JSON you can define
patches to apply to your codebase when
you can post or install and you can
either define like a local path to the
patch or just a Drupal like a URL to a
Drupal patch on drupal.org so it's super
useful and it's a great way to make sure
the patches you apply actually apply
every time somebody installs a
repository
but if you're just trying out a patch
phpstorm will allow you to apply the
pads either from your clipboard or if
you select it I don't think I have one
base that I could apply let's take a
look
I'll see one here let's take a look at
our those are done Jason
so we don't have any patches on the side
at the moment but if I had a patch to
apply if you do a flight match and they
pick up a patch from in here and apply
it to the right code base so you could
take one for like address module and
Drupal and it would find address module
in your depository and apply it and tell
you what's going to change and if we can
apply it successfully so it's a great
way to test out patches really quickly
you don't really have to worry about
using it to apply them feature so we'll
just kind of do it for you you can just
copy it straight out of the people that
we're at issue queue and there's your
clipboard the other thing is sometimes
you have to write patches for controls
or court to fix errors that you wrote in
YouTube on are resolved yet the fastest
way I've done to do this like as a hacky
get the site working not necessarily
high you should be developing contribute
for it is install the module from source
which is composer installed with a
preferred source and what this will do
is it will clone the repo down to the
site or down into the Oklahoma module
repo into your code base and then in
phpstorm you can set it up as a sub git
repository so all the changes in that
folder structure will be tracked in your
gate changes so they would show up in
this version control like if I started
editing
all right so we got plenty pot here so
right now if I change anything inside a
pilot
she's not a good example because this
this refill track and compare attracting
check in this folder all right new
repository
so there's a couple things we can show
you here close that they saw a bunch of
patches alright so we have a lot of
patches for this repository and so we
probably don't need as many at this
point but as you can see there's no
limit so we can you can see that that
ignore is now showing us like these are
all grayed out because they're not being
tracked which is super useful and if I
want to actually change something it's
not gonna tell me that I can changed
because well that's not tracking it but
let's see if it was finished
all right
so this should be a repository now we go
to version control
you can all right so I've done this for
commerce let's go into the farmers
module members
so now if I start deleting things
should tell me
all right this isn't working as well as
it should the joys of live demos
anyways pretty follow the steps and not
do it on the fly it will show you to get
changes inside of phpstorm two modules
you've installed with me first source
and you can add them as sub git
repositories and the benefit to that is
when you make your changes you can just
create your patch directly from inside
your site repository
either you can upload Ino them or you
can just put them in your patches folder
which we've done a couple times on this
site so we have a patches directory at
the top level and some of these we've
written ourselves some ways we took from
other resources but most of them were
written by adding module as the sub git
repository inside phpstorm and just
writing it directly in there other
useful thing is if you're debugging in
module and you're trying to keep track
of the changes you have made this is
another great way to do it because the
tracks I think it and you can revert it
otherwise you're just kind of editing a
flat file and if you a composer may
install view back to the default State
all right so that's kind of a quick
patching or oh I do patching a PHP storm
PHP CBF is PHP code beautifier and what
this does is it'll actually go through
and automatically fix your code sniffing
issues it the set up is a bit involved
it is nice to them and it'll show you a
nice little message and see if I have it
working so
I don't think is on the screen with this
many tools external tools here we go
so it wasn't that useful you can see he
said fixing file zero by there oh so it
was useful so it fixed nine things and
if it's all of them but if we run it
again
I'm just going to the external tools
there we go yeah so it didn't find any
fixable ones because it corrected 9 the
first time that's a useful tool if
you're trying to update a lot of code at
once I would say it's not as useful if
you're writing good code the first time
it's easier just to fix it and you can
set it to do either sync a file
directory or just ice it it's really
good for bulk updating or fixing your
code and other things phpstorm will do
it does composer management to some
extent never tried it but it has told me
multiple times when they open a phpstorm
that don't match composer for me
and these perform will run Drupal tests
if you set it up correctly and mec
Lehman who is here as a plug-in for
running tests because Commerce has a
bunch of tests in it once again not
something I do a lot but it can't be set
up and questions yes
do you ever click on a directory and go
up to edit and refactor coverage yeah so
you're talking about if we undo the PHP
so you have stuff and you
reformat good yes yeah yeah that does a
very similar thing but it won't take the
coat sniffer settings it's just kind of
the settings inside of phpstorm so when
you go to settings editor Co style so
it's only applying like stuff in this
area and not actual the the code sniffer
settings any other questions I think
I've used it once or twice but it's
really just for running PHP code and
it's yeah yeah yeah it's very similar I
just kind of like the evaluate
expressions I'm taking face more yeah
does anybody like something in phpstorm
that I didn't cover control ship and
which I'll let you search by file name
so that could be useful control ships oh
that reminds me that you go to help
there's a key map reference in here
which opens up a PDF file a bunch of key
map references
controlling yeah
yep alright I guess one more thing up
here if you're trying to navigate so
let's say we do ctrl shift and and we go
to the entity class that's right we've
opened up that one file but it is not
open on the left here in your entity or
in your structure so if you actually
want to get to these files up here if
you click and you can open up any of the
files in the same directory or you can
double click and it'll open up on the
left so you're trying to get some
context and you have the file open and
navigate to the code for you
all right that's all I have we got two
minutes question yeah
see if I could get the right directory
here
yeah so let me show you the colors we
need to find them it's also got the
picker and we have in each week here
it will do some autocomplete iam
functions available or filters and
that's what the control space as well so
yeah peach use for muscle is very
powerful inside of tweak all right
[Applause]