When does a PhD end? I know this is a very general question on this forum, but let us consider a CS-engineering group. What is the usual and primary consideration for letting the student finish officially?
Is it the number of years spent, when the professor feels nothing more useful will come out of working on the problem (or of the student!)?
Is it the logical conclusion of the problem and the thesis? A student works to complete a problem in 3 years and publishes a couple of journal papers, and finds there is no more to the problem. Will he be allowed to finish or forced to work on some tangential problem simply to prolong his PhD?
Generally speaking, there are well established "mile stones" for the completion of a PhD. This typically comes in the form of writing a dissertation - either in book form or a series of papers - and the presentation (and defense) of those results to a committee of professors (and sometimes a general audience).
It is usually not "years spent" or exhausting a project's potential (or the students).
There are however often some established timelines to prevent students from defending their dissertation too fast - required coursework, certain timing restrictions etc. This is usually intended to keep a student from rushing their studies and meeting the letter of the graduation requirements, but not the spirit - that they be well trained in their field and capable of doing independent work. But if they meet that, and defend their dissertation, no one is going to make them "run out the clock" or the like.