Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit c229d47

Browse files
committed
Update code style
- Force PHP7 as minimum required version - Use PHP7's type hinting - Remove unnecessary phpdoc comments (due to PHP7's type hinting) - Add license header to all the files
1 parent 51ab1e5 commit c229d47

21 files changed

+206
-176
lines changed

src/Actions/Action.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Actions;
513

src/Actions/ExecuteAction.php

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Actions;
513

@@ -35,13 +43,7 @@ final class ExecuteAction implements Action
3543
/** @var int */
3644
private $execCount;
3745

38-
/**
39-
* ExecuteAction constructor.
40-
* @param JupyterBroker $broker
41-
* @param SocketWrapper $iopubSocket
42-
* @param SocketWrapper $shellSocket
43-
* @param Shell $shellSoul
44-
*/
46+
4547
public function __construct(
4648
JupyterBroker $broker, SocketWrapper $iopubSocket, SocketWrapper $shellSocket, Shell $shellSoul
4749
)
@@ -62,14 +64,10 @@ public function call(array $header, array $content)
6264
$this->execCount = isset($content->execution_count) ? $content->execution_count : 0;
6365
$this->code = $content['code'];
6466

65-
$closure = $this->getClosure();
66-
$closure();
67+
($this->getClosure())();
6768
}
6869

69-
/**
70-
* @param string $message
71-
*/
72-
public function notifyMessage($message)
70+
public function notifyMessage(string $message)
7371
{
7472
$this->broker->send($this->shellSocket, 'execute_reply', ['status' => 'ok'], $this->header);
7573
$this->broker->send($this->iopubSocket, 'stream', ['name' => 'stdout', 'data' => $message], $this->header);
@@ -82,10 +80,7 @@ public function notifyMessage($message)
8280
$this->broker->send($this->iopubSocket, 'status', ['execution_state' => 'idle'], $this->header);
8381
}
8482

85-
/**
86-
* @return callable
87-
*/
88-
private function getClosure()
83+
private function getClosure(): callable
8984
{
9085
$closure = function () {
9186
extract($this->shellSoul->getScopeVariables());

src/Actions/HistoryAction.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Actions;
513

@@ -17,11 +25,6 @@ final class HistoryAction implements Action
1725
private $shellSocket;
1826

1927

20-
/**
21-
* ExecuteAction constructor.
22-
* @param JupyterBroker $broker
23-
* @param SocketWrapper $shellSocket
24-
*/
2528
public function __construct(JupyterBroker $broker, SocketWrapper $shellSocket)
2629
{
2730
$this->broker = $broker;

src/Actions/KernelInfoAction.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Actions;
513

@@ -19,12 +27,7 @@ final class KernelInfoAction implements Action
1927
/** @var SocketWrapper */
2028
private $iopubSocket;
2129

22-
/**
23-
* ExecuteAction constructor.
24-
* @param JupyterBroker $broker
25-
* @param SocketWrapper $shellSocket
26-
* @param SocketWrapper $iopubSocket
27-
*/
30+
2831
public function __construct(JupyterBroker $broker, SocketWrapper $shellSocket, SocketWrapper $iopubSocket)
2932
{
3033
$this->broker = $broker;

src/Actions/ShutdownAction.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Actions;
513

src/ConnectionSettings.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* This file is part of Jupyter-PHP.
55
*
6-
* (c) 2015-2016 Litipk
6+
* (c) 2015-2017 Litipk
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -17,7 +17,7 @@ final class ConnectionSettings
1717
/**
1818
* @return array[string]mixed
1919
*/
20-
public static function get()
20+
public static function get(): array
2121
{
2222
global $argv;
2323
if (!isset($argv) || empty($argv)) {
@@ -47,7 +47,7 @@ public static function get()
4747
* @param null|array $connectionSettings
4848
* @return array[string]string
4949
*/
50-
public static function getConnectionUris(array $connectionSettings = null)
50+
public static function getConnectionUris(array $connectionSettings = null): array
5151
{
5252
if (null === $connectionSettings) {
5353
$connectionSettings = self::get();

src/Handlers/HbErrorHandler.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Litipk\JupyterPHP\Handlers;
413

514

src/Handlers/HbMessagesHandler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Handlers;
513

src/Handlers/IOPubMessagesHandler.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Handlers;
513

src/Handlers/ShellMessagesHandler.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<?php
22

3+
/*
4+
* This file is part of Jupyter-PHP.
5+
*
6+
* (c) 2015-2017 Litipk
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
311

412
namespace Litipk\JupyterPHP\Handlers;
513

@@ -36,13 +44,7 @@ final class ShellMessagesHandler
3644
/** @var Logger */
3745
private $logger;
3846

39-
/**
40-
* ShellMessagesHandler constructor.
41-
* @param JupyterBroker $broker
42-
* @param SocketWrapper $iopubSocket
43-
* @param SocketWrapper $shellSocket
44-
* @param Logger $logger
45-
*/
47+
4648
public function __construct(
4749
JupyterBroker $broker, SocketWrapper $iopubSocket, SocketWrapper $shellSocket, Logger $logger
4850
)
@@ -63,9 +65,6 @@ public function __construct(
6365
$this->shellSoul->setOutput( new KernelOutput($this->executeAction, $this->logger->withName('KernelOutput')));
6466
}
6567

66-
/**
67-
* @param $msg
68-
*/
6968
public function __invoke(array $msg)
7069
{
7170
list($zmqId, $delim, $hmac, $header, $parentHeader, $metadata, $content) = $msg;

0 commit comments

Comments
 (0)