Skip to content

Commit d1a5752

Browse files
author
Bastian Schwarz
committed
Added warning function
1 parent e97f02b commit d1a5752

4 files changed

Lines changed: 42 additions & 1 deletion

File tree

MIGRATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ If you use the All class you don't need to do anything.
2020
The iAll interface was extended with the iWarning interface. If you created your own implementation of iAll you need to implement the iWarning interface as well.
2121
If you use the All class you don't need to do anything.
2222

23+
### Writeln Method
24+
The iAll interface was extended with the iWriteln interface. If you created your own implementation of iAll you need to implement the iWriteln interface as well.
25+
If you use the All class you don't need to do anything.
26+
2327
## 1.x -> 2.x
2428

2529
The ssh connection string is now part of `\Deployer\Host\Host`. This means the

src/functions/All.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
use function Deployer\upload;
4646
use function Deployer\warning;
4747
use function Deployer\within;
48+
use function Deployer\writeln;
4849

4950
/**
5051
* Implements all method interfaces so we a "all drop-in" class to easily access the methods
@@ -184,4 +185,8 @@ public function within(string $path, callable $callback) : mixed {
184185
public function info(string $message) : void {
185186
info($message);
186187
}
188+
189+
public function writeln(string $message) : void {
190+
writeln($message);
191+
}
187192
}

src/functions/iAll.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
*
2323
* The idea is to provide a stable, typed API and also a level of abstraction to the global deployer functions so testing is easier.
2424
*/
25-
interface iAll extends iAdd, iAfter, iBefore, iCurrentHost, iDownload, iGet, iHost, iInfo, iInput, iLocalhost, iOn, iParse, iRun, iSet, iTask, iUpload, iWarning, iWithin { }
25+
interface iAll extends iAdd, iAfter, iBefore, iCurrentHost, iDownload, iGet, iHost, iInfo, iInput, iLocalhost, iOn, iParse, iRun, iSet, iTask, iUpload, iWarning, iWithin, iWriteln {}

src/functions/iWriteln.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php declare(strict_types=1);
2+
/*
3+
* Copyright 2023 Bastian Schwarz <bastian@codename-php.de>.
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
namespace de\codenamephp\deployer\base\functions;
19+
20+
/**
21+
* Interface for the Deployer\writeln function
22+
*/
23+
interface iWriteln {
24+
25+
/**
26+
* Writes a message to the console and adds a newline at the end
27+
*
28+
* @param string $message The message to write
29+
* @return void
30+
*/
31+
public function writeln(string $message) : void;
32+
}

0 commit comments

Comments
 (0)