minor #22195 [Workflow] Added more PHPDoc (lyrixx)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Workflow] Added more PHPDoc

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

---

asked by @fabpot / @HeahDude

Commits
-------

97787c6bdc [Workflow] Added more PHPDoc
This commit is contained in:
Grégoire Pineau 2017-03-28 10:39:12 +02:00
commit cbb0c1809b

View File

@ -36,14 +36,31 @@ class WorkflowExtension extends \Twig_Extension
);
}
public function canTransition($object, $transition, $name = null)
/**
* Returns true if the transition is enabled.
*
* @param object $subject A subject
* @param string $transitionName A transition
* @param string $name A workflow name
*
* @return bool true if the transition is enabled
*/
public function canTransition($subject, $transitionName, $name = null)
{
return $this->workflowRegistry->get($object, $name)->can($object, $transition);
return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName);
}
public function getEnabledTransitions($object, $name = null)
/**
* Returns all enabled transitions.
*
* @param object $subject A subject
* @param string $name A workflow name
*
* @return Transition[] All enabled transitions
*/
public function getEnabledTransitions($subject, $name = null)
{
return $this->workflowRegistry->get($object, $name)->getEnabledTransitions($object);
return $this->workflowRegistry->get($subject, $name)->getEnabledTransitions($subject);
}
public function hasMarkedPlace($object, $place, $name = null)