Skip to content

Commit

Permalink
add test to prevent lint from failing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdeniau committed Sep 5, 2018
1 parent 422cf7d commit c795299
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 126 deletions.
28 changes: 15 additions & 13 deletions src/Php54/Resources/stubs/CallbackFilterIterator.php
Expand Up @@ -9,20 +9,22 @@
* file that was distributed with this source code.
*/

class CallbackFilterIterator extends FilterIterator
{
private $iterator;
private $callback;

public function __construct(Iterator $iterator, $callback)
if (PHP_VERSION_ID < 50400) {
class CallbackFilterIterator extends FilterIterator
{
$this->iterator = $iterator;
$this->callback = $callback;
parent::__construct($iterator);
}
private $iterator;
private $callback;

public function accept()
{
return call_user_func($this->callback, $this->current(), $this->key(), $this->iterator);
public function __construct(Iterator $iterator, $callback)
{
$this->iterator = $iterator;
$this->callback = $callback;
parent::__construct($iterator);
}

public function accept()
{
return call_user_func($this->callback, $this->current(), $this->key(), $this->iterator);
}
}
}
36 changes: 19 additions & 17 deletions src/Php54/Resources/stubs/RecursiveCallbackFilterIterator.php
Expand Up @@ -9,25 +9,27 @@
* file that was distributed with this source code.
*/

class RecursiveCallbackFilterIterator extends CallbackFilterIterator implements RecursiveIterator
{
private $iterator;
private $callback;

public function __construct(RecursiveIterator $iterator, $callback)
if (PHP_VERSION_ID < 50400) {
class RecursiveCallbackFilterIterator extends CallbackFilterIterator implements RecursiveIterator
{
$this->iterator = $iterator;
$this->callback = $callback;
parent::__construct($iterator, $callback);
}
private $iterator;
private $callback;

public function hasChildren()
{
return $this->iterator->hasChildren();
}
public function __construct(RecursiveIterator $iterator, $callback)
{
$this->iterator = $iterator;
$this->callback = $callback;
parent::__construct($iterator, $callback);
}

public function getChildren()
{
return new static($this->iterator->getChildren(), $this->callback);
public function hasChildren()
{
return $this->iterator->hasChildren();
}

public function getChildren()
{
return new static($this->iterator->getChildren(), $this->callback);
}
}
}
132 changes: 67 additions & 65 deletions src/Php54/Resources/stubs/SessionHandlerInterface.php
Expand Up @@ -29,74 +29,76 @@
* @author Drak <drak@zikula.org>
* @author Tobias Schultze <http://tobion.de>
*/
interface SessionHandlerInterface
{
/**
* Re-initializes existing session, or creates a new one.
*
* @see http://php.net/sessionhandlerinterface.open
*
* @param string $savePath Save path
* @param string $sessionName Session name, see http://php.net/function.session-name.php
*
* @return bool true on success, false on failure
*/
public function open($savePath, $sessionName);
if (PHP_VERSION_ID < 50400) {
interface SessionHandlerInterface
{
/**
* Re-initializes existing session, or creates a new one.
*
* @see http://php.net/sessionhandlerinterface.open
*
* @param string $savePath Save path
* @param string $sessionName Session name, see http://php.net/function.session-name.php
*
* @return bool true on success, false on failure
*/
public function open($savePath, $sessionName);

/**
* Closes the current session.
*
* @see http://php.net/sessionhandlerinterface.close
*
* @return bool true on success, false on failure
*/
public function close();
/**
* Closes the current session.
*
* @see http://php.net/sessionhandlerinterface.close
*
* @return bool true on success, false on failure
*/
public function close();

/**
* Reads the session data.
*
* @see http://php.net/sessionhandlerinterface.read
*
* @param string $sessionId Session ID, see http://php.net/function.session-id
*
* @return string Same session data as passed in write() or empty string when non-existent or on failure
*/
public function read($sessionId);
/**
* Reads the session data.
*
* @see http://php.net/sessionhandlerinterface.read
*
* @param string $sessionId Session ID, see http://php.net/function.session-id
*
* @return string Same session data as passed in write() or empty string when non-existent or on failure
*/
public function read($sessionId);

/**
* Writes the session data to the storage.
*
* Care, the session ID passed to write() can be different from the one previously
* received in read() when the session ID changed due to session_regenerate_id().
*
* @see http://php.net/sessionhandlerinterface.write
*
* @param string $sessionId Session ID , see http://php.net/function.session-id
* @param string $data Serialized session data to save
*
* @return bool true on success, false on failure
*/
public function write($sessionId, $data);
/**
* Writes the session data to the storage.
*
* Care, the session ID passed to write() can be different from the one previously
* received in read() when the session ID changed due to session_regenerate_id().
*
* @see http://php.net/sessionhandlerinterface.write
*
* @param string $sessionId Session ID , see http://php.net/function.session-id
* @param string $data Serialized session data to save
*
* @return bool true on success, false on failure
*/
public function write($sessionId, $data);

/**
* Destroys a session.
*
* @see http://php.net/sessionhandlerinterface.destroy
*
* @param string $sessionId Session ID, see http://php.net/function.session-id
*
* @return bool true on success, false on failure
*/
public function destroy($sessionId);
/**
* Destroys a session.
*
* @see http://php.net/sessionhandlerinterface.destroy
*
* @param string $sessionId Session ID, see http://php.net/function.session-id
*
* @return bool true on success, false on failure
*/
public function destroy($sessionId);

/**
* Cleans up expired sessions (garbage collection).
*
* @see http://php.net/sessionhandlerinterface.gc
*
* @param string|int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed
*
* @return bool true on success, false on failure
*/
public function gc($maxlifetime);
/**
* Cleans up expired sessions (garbage collection).
*
* @see http://php.net/sessionhandlerinterface.gc
*
* @param string|int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed
*
* @return bool true on success, false on failure
*/
public function gc($maxlifetime);
}
}
6 changes: 4 additions & 2 deletions src/Php70/Resources/stubs/ArithmeticError.php
@@ -1,5 +1,7 @@
<?php

class ArithmeticError extends Error
{
if (PHP_VERSION_ID < 70000) {
class ArithmeticError extends Error
{
}
}
6 changes: 4 additions & 2 deletions src/Php70/Resources/stubs/AssertionError.php
@@ -1,5 +1,7 @@
<?php

class AssertionError extends Error
{
if (PHP_VERSION_ID < 70000) {
class AssertionError extends Error
{
}
}
6 changes: 4 additions & 2 deletions src/Php70/Resources/stubs/DivisionByZeroError.php
@@ -1,5 +1,7 @@
<?php

class DivisionByZeroError extends Error
{
if (PHP_VERSION_ID < 70000) {
class DivisionByZeroError extends Error
{
}
}
6 changes: 4 additions & 2 deletions src/Php70/Resources/stubs/Error.php
@@ -1,5 +1,7 @@
<?php

class Error extends Exception
{
if (PHP_VERSION_ID < 70000) {
class Error extends Exception
{
}
}
6 changes: 4 additions & 2 deletions src/Php70/Resources/stubs/ParseError.php
@@ -1,5 +1,7 @@
<?php

class ParseError extends Error
{
if (PHP_VERSION_ID < 70000) {
class ParseError extends Error
{
}
}
@@ -1,23 +1,25 @@
<?php

interface SessionUpdateTimestampHandlerInterface
{
/**
* Checks if a session identifier already exists or not.
*
* @param string $key
*
* @return bool
*/
public function validateId($key);
if (PHP_VERSION_ID < 70000) {
interface SessionUpdateTimestampHandlerInterface
{
/**
* Checks if a session identifier already exists or not.
*
* @param string $key
*
* @return bool
*/
public function validateId($key);

/**
* Updates the timestamp of a session when its data didn't change.
*
* @param string $key
* @param string $val
*
* @return bool
*/
public function updateTimestamp($key, $val);
/**
* Updates the timestamp of a session when its data didn't change.
*
* @param string $key
* @param string $val
*
* @return bool
*/
public function updateTimestamp($key, $val);
}
}
6 changes: 4 additions & 2 deletions src/Php70/Resources/stubs/TypeError.php
@@ -1,5 +1,7 @@
<?php

class TypeError extends Error
{
if (PHP_VERSION_ID < 70000) {
class TypeError extends Error
{
}
}

0 comments on commit c795299

Please sign in to comment.