for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Github\Client;
class Repository
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
private $owner;
private $name;
private $public;
private $branches;
const PublicVisibility = 'public';
/**
* @param string $owner
* @param string $name
* @param string $visibility
*/
public function Repository(string $owner, string $name, string $visibility)
__construct()
$this->owner = $owner;
$this->name = $name;
$this->public = $visibility === PublicVisibility;
$this->client = new Client($_SERVER['API_TOKEN']);
client
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
}
* @return string
public function getFullName(): string
return $this->owner . $this->name;
* @return bool
public function getPublic(): bool
return $this->public;
* @param string $title
* @param string $description
public function createIssue(string $title, string $description)
$this->client->createIssue($this->getFullName, $title, $description);
getFullName
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.