1010 * @category Entries
1111 * @package Po
1212 * @author Richard Griffith <richard@geekwright.com>
13- * @copyright 2015 Richard Griffith
13+ * @copyright 2015-2018 Richard Griffith
1414 * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
1515 * @link https://github.com/geekwright/Po
1616 */
@@ -45,7 +45,7 @@ public function __construct()
4545 * @param string $value value to store
4646 * @return void
4747 */
48- public function add ($ type , $ value )
48+ public function add (string $ type , string $ value ): void
4949 {
5050 if ($ this ->entry [$ type ] === null ) {
5151 $ this ->entry [$ type ] = array ();
@@ -61,7 +61,7 @@ public function add($type, $value)
6161 * @param string $value value to store
6262 * @return void
6363 */
64- public function addQuoted ($ type , $ value )
64+ public function addQuoted (string $ type , string $ value ): void
6565 {
6666 if ($ value [0 ]=='" ' ) {
6767 $ value = substr ($ value , 1 , -1 );
@@ -86,7 +86,7 @@ public function addQuoted($type, $value)
8686 * @param string $value value to store
8787 * @return void
8888 */
89- public function addQuotedAtPosition ($ type , $ position , $ value )
89+ public function addQuotedAtPosition (string $ type , int $ position , string $ value ): void
9090 {
9191 if ($ value [0 ]=='" ' ) {
9292 $ value = substr ($ value , 1 , -1 );
@@ -111,7 +111,7 @@ public function addQuotedAtPosition($type, $position, $value)
111111 *
112112 * @return string|string[]|null
113113 */
114- public function get ($ type )
114+ public function get (string $ type )
115115 {
116116 return $ this ->entry [$ type ];
117117 }
@@ -122,7 +122,7 @@ public function get($type)
122122 * @param string $type PoToken constant
123123 * @return string|null
124124 */
125- public function getAsString ($ type )
125+ public function getAsString (string $ type ): ? string
126126 {
127127 $ ret = $ this ->entry [$ type ];
128128 if (is_array ($ ret )) {
@@ -139,7 +139,7 @@ public function getAsString($type)
139139 *
140140 * @return string[]|null
141141 */
142- public function getAsStringArray ($ type )
142+ public function getAsStringArray (string $ type ): ? array
143143 {
144144 $ plurals = $ this ->entry [$ type ];
145145 $ plurals = is_array ($ plurals ) ? $ plurals : array ('' , '' );
@@ -156,11 +156,11 @@ public function getAsStringArray($type)
156156 /**
157157 * set the value of a specified type
158158 *
159- * @param string $type PoToken constant
160- * @param string $value value to set
159+ * @param string $type PoToken constant
160+ * @param string|string[]|null $value value to set
161161 * @return void
162162 */
163- public function set ($ type , $ value )
163+ public function set (string $ type , $ value ): void
164164 {
165165 $ this ->entry [$ type ] = $ value ;
166166 }
@@ -170,7 +170,7 @@ public function set($type, $value)
170170 *
171171 * @return string
172172 */
173- public function dumpEntry ()
173+ public function dumpEntry (): string
174174 {
175175 $ output = $ this ->dumpEntryComments ();
176176
@@ -205,7 +205,7 @@ public function dumpEntry()
205205 *
206206 * @return string
207207 */
208- protected function dumpEntryComments ()
208+ protected function dumpEntryComments (): string
209209 {
210210 $ commentKeys = array (
211211 PoTokens::TRANSLATOR_COMMENTS ,
@@ -236,13 +236,13 @@ protected function dumpEntryComments()
236236 * format a string for output by escaping control and double quote
237237 * characters, then surrounding with double quotes
238238 *
239- * @param string|null $value string to prepare
240- * @param boolean $bare true for bare output, default false adds leading
241- * space and trailing newline
239+ * @param string|string[]| null $value string to prepare
240+ * @param boolean $bare true for bare output, default false adds leading
241+ * space and trailing newline
242242 *
243243 * @return string
244244 */
245- protected function formatQuotedString ($ value , $ bare = false )
245+ protected function formatQuotedString ($ value , bool $ bare = false ): string
246246 {
247247 if (is_array ($ value )) {
248248 $ string = '' ;
@@ -266,7 +266,7 @@ protected function formatQuotedString($value, $bare = false)
266266 *
267267 * @return boolean true if flag is set, otherwise false
268268 */
269- public function hasFlag ($ name )
269+ public function hasFlag (string $ name ): bool
270270 {
271271 $ flags = array ();
272272 $ flagEntry = $ this ->entry [PoTokens::FLAG ];
@@ -290,7 +290,7 @@ public function hasFlag($name)
290290 *
291291 * @return void
292292 */
293- public function addFlag ($ name )
293+ public function addFlag (string $ name ): void
294294 {
295295 if (!$ this ->hasFlag ($ name )) {
296296 $ flagEntry = $ this ->entry [PoTokens::FLAG ];
0 commit comments