Skip to content

Commit bcbeb6b

Browse files
committed
🚿 protected -> private in final classes
1 parent 734a7c4 commit bcbeb6b

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

src/Psr7/MultipartStream.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
*/
2525
final class MultipartStream extends StreamAbstract{
2626

27-
protected string $boundary;
27+
private string $boundary;
2828

29-
protected bool $built = false;
29+
private bool $built = false;
3030

3131
/**
3232
* MultipartStream constructor.
@@ -118,7 +118,7 @@ public function addElement(array $e):MultipartStream{
118118
/**
119119
*
120120
*/
121-
protected function setElementHeaders(array $e):array{
121+
private function setElementHeaders(array $e):array{
122122
$hasFilename = $e['filename'] === '0' || $e['filename'];
123123

124124
// Set a default content-disposition header if none was provided
@@ -152,7 +152,7 @@ protected function setElementHeaders(array $e):array{
152152
/**
153153
*
154154
*/
155-
protected function hasHeader(array $headers, string $key):bool{
155+
private function hasHeader(array $headers, string $key):bool{
156156
$lowercaseHeader = strtolower($key);
157157

158158
foreach($headers as $k => $v){

src/Psr7/UploadedFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ final class UploadedFile implements UploadedFileInterface{
4848

4949
private bool $moved = false;
5050

51-
protected StreamFactory $streamFactory;
51+
private StreamFactory $streamFactory;
5252

5353
/**
5454
* @param \Psr\Http\Message\StreamInterface|string|resource $file

src/Psr7/Uri.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818

1919
use const FILTER_FLAG_IPV6, FILTER_VALIDATE_IP;
2020

21-
class Uri implements UriInterface{
21+
final class Uri implements UriInterface{
2222

23-
protected string $scheme = '';
23+
private string $scheme = '';
2424

25-
protected string $user = '';
25+
private string $user = '';
2626

27-
protected ?string $pass = null;
27+
private ?string $pass = null;
2828

29-
protected string $host = '';
29+
private string $host = '';
3030

31-
protected ?int $port = null;
31+
private ?int $port = null;
3232

33-
protected string $path = '';
33+
private string $path = '';
3434

35-
protected string $query = '';
35+
private string $query = '';
3636

37-
protected string $fragment = '';
37+
private string $fragment = '';
3838

3939
/**
4040
* Uri constructor.
@@ -101,7 +101,7 @@ public function __toString():string{
101101
* @return string
102102
* @throws \InvalidArgumentException
103103
*/
104-
protected function filterScheme($scheme):string{
104+
private function filterScheme($scheme):string{
105105

106106
if(!is_string($scheme)){
107107
throw new InvalidArgumentException('scheme must be a string');
@@ -146,7 +146,7 @@ public function withScheme($scheme):UriInterface{
146146
* @return string
147147
* @throws \InvalidArgumentException
148148
*/
149-
protected function filterUser($user):string{
149+
private function filterUser($user):string{
150150

151151
if(!is_string($user)){
152152
throw new InvalidArgumentException('user must be a string');
@@ -161,7 +161,7 @@ protected function filterUser($user):string{
161161
* @return string
162162
* @throws \InvalidArgumentException
163163
*/
164-
protected function filterPass($pass):string{
164+
private function filterPass($pass):string{
165165

166166
if(!is_string($pass)){
167167
throw new InvalidArgumentException('pass must be a string');
@@ -228,7 +228,7 @@ public function withUserInfo($user, $password = null):UriInterface{
228228
* @return string
229229
* @throws \InvalidArgumentException
230230
*/
231-
protected function filterHost($host):string{
231+
private function filterHost($host):string{
232232

233233
if(!is_string($host)){
234234
throw new InvalidArgumentException('host must be a string');
@@ -276,7 +276,7 @@ public function withHost($host):UriInterface{
276276
* @return int|null
277277
* @throws \InvalidArgumentException
278278
*/
279-
protected function filterPort($port):?int{
279+
private function filterPort($port):?int{
280280

281281
if($port === null){
282282
return null;
@@ -327,7 +327,7 @@ public function withPort($port):UriInterface{
327327
* @return string
328328
* @throws \InvalidArgumentException
329329
*/
330-
protected function filterPath($path):string{
330+
private function filterPath($path):string{
331331

332332
if(!is_string($path)){
333333
throw new InvalidArgumentException('path must be a string');
@@ -371,7 +371,7 @@ public function withPath($path):UriInterface{
371371
* @return string
372372
* @throws \InvalidArgumentException
373373
*/
374-
protected function filterQuery($query):string{
374+
private function filterQuery($query):string{
375375

376376
if(!is_string($query)){
377377
throw new InvalidArgumentException('query and fragment must be a string');
@@ -414,7 +414,7 @@ public function withQuery($query):UriInterface{
414414
*
415415
* @return string
416416
*/
417-
protected function filterFragment($fragment):string{
417+
private function filterFragment($fragment):string{
418418
return $this->filterQuery($fragment);
419419
}
420420

@@ -448,7 +448,7 @@ public function withFragment($fragment):UriInterface{
448448
*
449449
* @return void
450450
*/
451-
protected function parseUriParts(array $parts):void{
451+
private function parseUriParts(array $parts):void{
452452

453453
foreach(['scheme', 'user', 'pass', 'host', 'port', 'path', 'query', 'fragment'] as $part){
454454

@@ -468,7 +468,7 @@ protected function parseUriParts(array $parts):void{
468468
*
469469
* @return string
470470
*/
471-
protected function replaceChars(string $str, bool $query = null):string{
471+
private function replaceChars(string $str, bool $query = null):string{
472472
/** @noinspection RegExpRedundantEscape, RegExpUnnecessaryNonCapturingGroup */
473473
return preg_replace_callback(
474474
'/(?:[^a-z\d_\-\.~!\$&\'\(\)\*\+,;=%:@\/'.($query ? '\?' : '').']++|%(?![a-f\d]{2}))/i',
@@ -481,7 +481,7 @@ protected function replaceChars(string $str, bool $query = null):string{
481481
/**
482482
* @return void
483483
*/
484-
protected function removeDefaultPort():void{
484+
private function removeDefaultPort():void{
485485

486486
if(uriIsDefaultPort($this)){
487487
$this->port = null;
@@ -492,7 +492,7 @@ protected function removeDefaultPort():void{
492492
/**
493493
* @return void
494494
*/
495-
protected function validateState():void{
495+
private function validateState():void{
496496

497497
if(empty($this->host) && ($this->scheme === 'http' || $this->scheme === 'https')){
498498
$this->host = 'localhost';

0 commit comments

Comments
 (0)