Digital read (boolean value) from phototransistor

It's not clear that you do. Or you have a different idea about what is hard:

  int photoDetector = analogRead(thePin);
  bool isItDark = photoDetector < 512;

  if (itIsDark) turnOnTheLight();

You could have other values for bright, dim, dark, whatever. Turn them into true or false.

a7