8000 completes hasSomething & removeSomething methods on the Classgenerator by basz · Pull Request #26 · zendframework/zend-code · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

completes hasSomething & removeSomething methods on the Classgenerator #26

Closed
wants to merge 21 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
introduce removeConstant method
  • Loading branch information
basz committed Jan 14, 2016
commit 0928fb1e76fa4b2b11f63b04e395d5b13a9eea0e
12 changes: 12 additions & 0 deletions src/Generator/ClassGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,18 @@ public function getConstants()
return $this->constants;
}

/**
* @param string $constantName
* @return ClassGenerator
*/
public function removeConstant($constantName)
{
if ($this->hasConstant($constantName)) {
unset($this->constants[$constantName]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can actually always directly unset(), as unset() doesn't raise any errors nor has any return values

}
return $this;
}

/**
* @param string $constantName
* @return bool
Expand Down
0