Skip to content

Commit e97f02b

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

4 files changed

Lines changed: 42 additions & 3 deletions

File tree

MIGRATION.md

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

19+
### Warning Method
20+
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.
21+
If you use the All class you don't need to do anything.
22+
1923
## 1.x -> 2.x
2024

2125
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
@@ -43,6 +43,7 @@
4343
use function Deployer\runLocally;
4444
use function Deployer\set;
4545
use function Deployer\upload;
46+
use function Deployer\warning;
4647
use function Deployer\within;
4748

4849
/**
@@ -172,6 +173,10 @@ public function upload(string $source, string $destination, array $config = [])
172173
upload($source, $destination, $config);
173174
}
174175

176+
public function warning(string $message) : void {
177+
warning($message);
178+
}
179+
175180
public function within(string $path, callable $callback) : mixed {
176181
return within($path, $callback);
177182
}

src/functions/iAll.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +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, iWithin {
26-
27-
}
25+
interface iAll extends iAdd, iAfter, iBefore, iCurrentHost, iDownload, iGet, iHost, iInfo, iInput, iLocalhost, iOn, iParse, iRun, iSet, iTask, iUpload, iWarning, iWithin { }

src/functions/iWarning.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\warning function
22+
*/
23+
interface iWarning {
24+
25+
/**
26+
* Writes a warning message to the console
27+
*
28+
* @param string $message The message to write
29+
* @return void
30+
*/
31+
public function warning(string $message) : void;
32+
}

0 commit comments

Comments
 (0)